keras-team / keras-cv

Industry-strength Computer Vision workflows with Keras
Other
1.01k stars 331 forks source link

Error replicating RetinaNet example #2013

Open silvada95 opened 1 year ago

silvada95 commented 1 year ago

Hi, I am trying to replicate the example from https://github.com/keras-team/keras-cv/blob/master/examples/training/object_detection/pascal_voc/retinanet.py.

The following error is appearing during the validation:

Traceback (most recent call last):

File "/home/silvada/anaconda3/envs/my_env/lib/python3.9/site-packages/keras_cv/callbacks/pycoco_callback.py", line 132, in on_epoch_end metrics = compute_pycoco_metrics(ground_truth, predictions) File "/home/silvada/anaconda3/envs/my_env3/lib/python3.9/site-packages/keras_cv/metrics/coco/pycoco_wrapper.py", line 219, in compute_pycoco_metrics coco_predictions = _convert_predictions_to_coco_annotations(predictions) File "/home/silvada/anaconda3/envs/my_env/lib/python3.9/site-packages/keras_cv/metrics/coco/pycoco_wrapper.py", line 131, in _convert_predictions_to_coco_annotations predictions["detection_boxes"][i][j]

IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

I am using tensorflow 2.13.0 and keras-cv 0.6.1

jbischof commented 1 year ago

This is an old version of the guide. You can see the latest at https://keras.io/guides/keras_cv/object_detection_keras_cv/. Another newer resource is https://keras.io/examples/vision/yolov8/

silvada95 commented 1 year ago

This is an old version of the guide. You can see the latest at https://keras.io/guides/keras_cv/object_detection_keras_cv/. Another newer resource is https://keras.io/examples/vision/yolov8/

Hi, I am using this one. My detector works well, but the Box Coco Metrics is not working fine. It always gives almost zero values despite the fact of the detections being almost perfect.

jbischof commented 1 year ago

@silvada95 could you share a minimal colab gist replicating the issue? Unfortunately it is hard to replicate this unexpected performance.

silvada95 commented 1 year ago

Here is the code I am using. If you look at the example at https://keras.io/guides/keras_cv/object_detection_keras_cv/, you will see that the author did not get any mAP after 20 epochs.

https://colab.research.google.com/drive/1vD7p8qjAX8sXpKuFZpkZl9619yMGqYTE?usp=sharing

jbischof commented 1 year ago

@silvada95 I do not see any output saved in that notebook.

silvada95 commented 1 year ago

@silvada95 I do not see any output saved in that notebook.

Hi, I did not run it on Colab because it would take too much time.

However, I attached some prints of the same code running on my local Ubuntu machine.

sachinprasadhs commented 1 week ago

Thanks for reporting the issue.

RetinaNet with the new implementation is now part of KerasHub a consolidated KerasNLP and KerasCV package. The model weights are available in Kaggle, for details and usage refer https://www.kaggle.com/models/keras/retinanet

We will not be making any changes to the models in KerasCV which are made available in KerasHub or the APIs/Utils made available in Keras. If you still face any issue, please file a new issue in keras-hub