Object Detection With YOLOv3 in Keras- ValueError: If your data is in the form of symbolic tensors

Object Detection With YOLOv3 in Keras- ValueError: If your data is in the form of symbolic tensors

如有任何帮助,我们将不胜感激。 我正在练习 "Object Detection With YOLOv3 in Keras",作为您可以在该网站上找到的教程模型的一部分:(https://machinelearningmastery.com/how-to-perform-object-detection-with-yolov3-in-keras/)。 在下面的代码块中,我试图 "make prediction":

# 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)