Object detection using fastai v2

Sorry for the delay, had a slow few days…

Here is the link to my fork with the notebook “06_Object_Detection_changed” being the modified notebook. I removed the setup/installation code as I run this locally. In the object_detection_metrics folder the code is copied from rafaelpadilla/Object-Detection-Metrics.

There are 3 modifications to @muellerzr code:

  1. the RetinaNet only returns the box and class predictions (in this order), and the dynamically computed sizes are stored in self.sizes
  2. RetinaNetFocalLoss takes a reference to the model, from which it gets the computed sizes
  3. RetinaNetFocalLoss has a decodes method, that applies the argmax over the predicted scores over all classes. (We need the scores for the non-max-suppression, but want the argmax for displaying the result)

These changes make it possible to use show_results as the output of the model now is similar to the dependent variables of the dataloaders (boxes and classes).

Then the notebook contains a non-max-suppression callback which uses the torchvision operator, and a mAP metric using the github repo linked above.

If you have any questions, ideas for improvement, or see find any bugs, please share them

DISCLAIMER: THIS IS NOT FINISHED CODE,
I don’t have much time to work on it at the moment and it is not getting results anywhere near good. I’m sharing this so others can have a look and improve the approach so we can get closer to good object detection in fastai2 :slight_smile:

3 Likes