从TF.TENSOR模型提取编号

发布于 2025-01-30 01:20:50 字数 474 浏览 2 评论 0原文

我正在使用softmax从基于CNN-MFCC的模型中获取概率向量。我已经开始使用命令,

model(prediction_feature)

而不是

 model.predict(prediction_feature)

在通过循环传递model.predict命令时,我一直在获取警告消息。但是,现在,当我记录概率时,值将以表单返回:

tf.Tensor(0.00087791355, shape=(), dtype=float32)

而仅对于使用model.predict.predict命令时的数字0.00087791355。

有没有一种方法可以从模型(Prediction_Feature)方法中提取数字?

I am using softmax to get the probability vector from a CNN-MFCC based model. I've started to use the command

model(prediction_feature)

instead of

 model.predict(prediction_feature)

as I kept getting warning messages while passing the model.predict command over a loop. However, now when I record the probability, the value gets returned in the form:

tf.Tensor(0.00087791355, shape=(), dtype=float32)

instead for just the number 0.00087791355 when I use the model.predict command.

Is there a way to extract just the number from the model(prediction_feature) approach?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2025-02-06 01:20:50

您可以使用numpy使用numpy.Array(tensor)tensor.numpy() method进行张量。

例如:

import numpy
model(prediction_feature).numpy()
#Or
numpy.array(model(prediction_feature))

,但是,请让我们知道使用model.predict(prediction_feature)时收到的警告消息。

You can convert a tensor to a NumPy array either using numpy.array(tensor) or the tensor.numpy() method.

For example:

import numpy
model(prediction_feature).numpy()
#Or
numpy.array(model(prediction_feature))

However, please let us know the warning messages you get while using model.predict(prediction_feature).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文