gpt4 book ai didi

python-3.x - Keras 中使用 YOLOv3 进行对象检测 - ValueError : If your data is in the form of symbolic tensors

转载 作者:行者123 更新时间:2023-12-03 08:42:06 26 4
gpt4 key购买 nike

任何帮助将不胜感激。
我正在练习“在 Keras 中使用 YOLOv3 进行对象检测”,作为教程模型的一部分,您可以在此网站上找到该教程模型:(https://machinelearningmastery.com/how-to-perform-object-detection-with-yolov3-in-keras/)。
在我试图“进行预测”的以下代码块中:

# make prediction
yhat = model.predict(Image_file)
# summarize the shape of the list of arrays
print([a.shape for a in yhat])

我收到以下错误:
--------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-35-278b18af4867> in <module>
1 # make prediction
----> 2 yhat = model.predict(Image_file)
3 # summarize the shape of the list of arrays
4 print([a.shape for a in yhat])

~/anaconda3/lib/python3.7/site-packages/keras/engine/training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing)
1460 verbose=verbose,
1461 steps=steps,
-> 1462 callbacks=callbacks)
1463
1464 def train_on_batch(self, x, y,

~/anaconda3/lib/python3.7/site-packages/keras/engine/training_arrays.py in predict_loop(model, f, ins, batch_size, verbose, steps, callbacks)
248 batch_size=batch_size,
249 steps=steps,
--> 250 steps_name='steps')
251
252 # Check if callbacks have not been already configured

~/anaconda3/lib/python3.7/site-packages/keras/engine/training_utils.py in check_num_samples(ins, batch_size, steps, steps_name)
569 raise ValueError(
570 'If your data is in the form of symbolic tensors, '
--> 571 'you should specify the `' + steps_name + '` argument '
572 '(instead of the `batch_size` argument, '
573 'because symbolic tensors are expected to produce '

ValueError: If your data is in the form of symbolic tensors, you should specify the `steps` argument (instead of the `batch_size` argument, because symbolic tensors are expected to produce batches of input data).

最佳答案

我通过在预测命令中添加“steps = 2”来修复此错误,如下所示:

yhat = model.predict(Image_file,steps=2)

关于python-3.x - Keras 中使用 YOLOv3 进行对象检测 - ValueError : If your data is in the form of symbolic tensors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60906218/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com