Object detection in fast.ai v1

Seems like yolo is more famous. Just for curiosity, why would we pick retina net over yolov3 for lecture? Is retina net easier to teach or other reasons?

RetinaNet uses a pretrained ResNet backbone, while Yolov3 uses Darknet53 as a backbone. There is no pretrained Darknet53 model available in fastai, which you would need to implement Yolov3. This is why fastai will use RetinaNet.

FWIW, I tried to load the weights from the original Darknet53 implementation in C into the fastai implementation. I could never get it to quite work. I think the weights were loaded correctly, but since fastai uses a slightly different output layer than the original C implementation, I couldnā€™t validate it. Iā€™ve since moved on to trying to train fastai Darknet53 on imagenet from scratch. Iā€™ll share my results on the forum when I get the top-1 accuracy into the 70%+ range.

11 Likes

Thanks for this, nice work!

I have a problem. When I run the code to transfer the pre-training model: learn=create_cnn(ā€¦), the code will automatically download the model, but it will be interrupted due to time and network speed, so I download the pre-training model in advance. When you run this code again, it will be stuck here. How can I solve this problem? Please help everyone.

Hi Sgugger,
I am trying to run the dev notebook 102a_coco and I receive the error objectdetectdataset not defined how do I fix this error?
Thanks


there are new notebook for retinaNet Objection

1 Like

Hi,

I tried to put all the pieces for object detection in fast.ai v1 with RetinaNet together.

With kind regrads,
Christian

18 Likes

Nice work! Have you tried to train on Pascal VOC and/or COCO datasets and measure mAPs?

I put everything together to do so including writing a callback for fast.ai, but IĀ“m a little bit short on computational resources to do so.

Thank you very much, this looks great!

My only problem are some imports in:

ObjectDetection/callbacks/callbacks.py

from BoundingBox import BoundingBox
from BoundingBoxes import BoundingBoxes
from Evaluator import *
from utils import *

Iā€™ve never seen those BoundingBox classes before which leads me to think you wrote them yourself and did not commit them.
Also I canā€™t find Evaluator or utils in the repo.

You can find them from https://github.com/rafaelpadilla/Object-Detection-Metrics

2 Likes

Hey,

sorry for not pointing that out more clearly.
You have to install Object-Detection-Metrics as I mentioned in the readme.

With kind regards,
Christian

2 Likes

Oh no, my bad sorry, I overread that 3 times apparently.
Thank you for the clarification!

i tried running that notebook (pascal.ipynb )and only got 17% mAP. did anyone get better results?

hi kristen
I get an error in line 2 items self in original coco notebook
train_ds = ObjectDetectDataset.from_json(PATH/ā€˜train2017ā€™, ANNOT_PATH/ā€˜train_sample.jsonā€™)

  1. objectdetect Dataset etc are not available where are they defined ?
  2. what is the purpose of bb_pad_collate used in
  3. If we are already given the xy,xmax,ymax then we can directly use them without having read i from any json source ?

Very nice work @Bronzi88 . Thank you so much.

I have just tried your notebook and everything works great. Can I ask you one question ? What is the output of your Retina Net ? How can I get the bounding box from the output. I have just tried it with an image and the output is a list with 3 items. The 1st one size is [1, 24480, 3] so I guess it is related to the probability of the class, 2nd one size is [1, 24480, 4] so I think it is the bounding box. The last one is [[32, 32], [16, 16], [8, 8], [4, 4]]], I donā€™t know what it is.

I want to understand the output because I donā€™t use fast.ai for inference. Thank you so much

I have digged in your code and understand how it works now. Thank you so much.

hi thereā€¦
Thanks for postingā€¦
how did you install.obd metric .is there .git for installation

You can just clone it and add your sys with Object-Detection-Metrics/lib/ . Thatā€™s what I did :smiley: