@m000ritz, @hkristen Can you make Object Detection work with fast.ai v1 ? There are no more ObjectDetectDataset in fastai library . Are there any example of this in fast. ai v1, no matter Retina or the previous used technique SSD ?
For the fastai coco subset I was able to create the data object with the datablocks api like this:
PATH = Path('.../coco_sample')
ANNOT_PATH = 'annotations'
images, lbl_bbox = get_annotations(PATH / ANNOT_PATH / 'train_sample.json')
img2bbox = dict(zip(images, lbl_bbox))
get_y_func = lambda o:img2bbox[o.name]
data = (ObjectItemList.from_folder(PATH / 'train_sample')
#Where are the images?
.random_split_by_pct()
#How to split in train/valid? -> randomly with the default 20% in valid
.label_from_func(get_y_func)
#How to find the labels? -> use get_y_func
.transform(get_transforms(), tfm_y=True, padding_mode='zeros', do_crop=False, size=128,)
#Data augmentation? -> Standard transforms with tfm_y=True
.databunch(bs=16, collate_fn=bb_pad_collate))
#Finally we convert to a DataBunch and we use bb_pad_collate
Then I am stuck at the above described error. Ithink I`ll need more time or maybe help from @sgugger to resolve this
Since the creation of the notebook model_size changed its behaviour. You can now use: sfs_szs = model_sizes(encoder, size=imsize) hooks = hook_outputs(encoder)
instead. That should work for you.
Thanks @hkristen . So I think play with object detection in fast.ai now is quite difficult because it misses example and the library is still changing. I switch to read last year course with SSD and hope Jeremy will tell something about it in the last session of part 1 v3
This creates a Dynamic SSD based on the number of grid cells, zoom levels and aspect ratios for the anchor boxes.
We haven’t trained the network fully in the dev notebook… like unfreezing and fine-tuning, and using Focal Loss (which is supported) etc, but are getting good results already. Hope you find it useful!
So the code in fastai v1 for object detection will not be ready until part 2? I see already in the docs the yolov3 architecture… It is not yet 100% ready?
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.
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.