Обнаружение объектов с помощью YOLOv3 в Keras- ValueError: Если ваши данные представлены в виде символьных c тензоров - PullRequest
0 голосов
/ 28 марта 2020

Любая помощь будет оценена. Я практикую «Обнаружение объектов с помощью 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).

1 Ответ

0 голосов
/ 29 марта 2020

Я исправил эту ошибку, добавив «steps = 2» к команде прогнозирования, как показано ниже:

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