david8862/keras-YOLOv3-model-set

Evaluate yolo v3 tiny

Closed this issue · 2 comments

rzese commented

Hi all,
I am trying to run the file eval.py on the COCO2017 dataset. I have run the script to convert the annotations and I thought that I had set all the files correctly. However, when I try to run eval.py using the yolov3-tiny network, which is the default one for this tutorial, I get the following error

Traceback (most recent call last):
  File "eval.py", line 1397, in <module>
    main()
  File "eval.py", line 1391, in main
    eval_AP(model, model_format, annotation_lines, anchors, class_names, model_image_size, args.eval_type, args.iou_threshold, args.conf_threshold, args.elim_grid_sense, args.v5_decode, args.save_result, class_filter=class_filter)
  File "eval.py", line 1241, in eval_AP
    pred_classes_records = get_prediction_class_records(model, model_format, annotation_records, anchors, class_names, model_image_size, conf_threshold, elim_grid_sense, v5_decode, save_result)
  File "eval.py", line 402, in get_prediction_class_records
    pred_boxes, pred_classes, pred_scores = yolo_predict_keras(model, image, anchors, len(class_names), model_image_size, conf_threshold, elim_grid_sense, v5_decode)
  File "eval.py", line 348, in yolo_predict_keras
    pred_boxes, pred_classes, pred_scores = yolo3_postprocess_np(prediction, image_shape, anchors, num_classes, model_image_size, max_boxes=100, confidence=conf_threshold, elim_grid_sense=elim_grid_sense)
  File "/mnt/c/src/trenz-dev/shared/07-yolov4-tutorial/keras-YOLOv3-model-set/yolo3/postprocess_np.py", line 37, in yolo3_postprocess_np
    predictions = yolo3_decode(yolo_outputs, anchors, num_classes, input_dims=model_image_size, elim_grid_sense=elim_grid_sense)
  File "/mnt/c/src/trenz-dev/shared/07-yolov4-tutorial/keras-YOLOv3-model-set/yolo3/postprocess_np.py", line 18, in yolo3_decode
    assert len(predictions) == len(anchors)//3, 'anchor numbers does not match prediction.'
AssertionError: anchor numbers does not match prediction.
Eval model:   0%|                                                                              | 0/4952 [00:00<?, ?it/s]

What could I have done wrong?

Thank you in advance

@rzese which file do you use for --anchors_path? yolov3-tiny should pick configs/tiny_yolo3_anchors.txt

rzese commented

Sorry, my bad. I had not seen that file.
Using tiny_yolo3_anchors.txt it works fine.