rwightman / efficientdet-pytorch

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights
Apache License 2.0
1.58k stars 293 forks source link

[FEATURE] Inference Resource/Notebook #142

Closed haadkhan closed 3 years ago

haadkhan commented 3 years ago

Is your feature request related to a problem? Please describe. Once I have an efficientdet model, its not clear how the test time augmentation is being done.

Describe the solution you'd like Ideally a function or brief description in how to get the predictions using DetBenchPredict

Describe alternatives you've considered I have looked at Alex kaggle notebook. I see he is using Albumentation library to augment his test data but its not exactly clear how its happening.

I am not really looking for the whole notebook. Just general guidance. Once I get it I will PR my evaluation notebook.

rwightman commented 3 years ago

There is no test-time augmentation done here. The models perform better than many larger ones that use TTA. That said, TTA could be a benefit but hasn't been a priority. I'd accept a TTA solution that cleanly integrates with the validation script + prediction bench and provides a noteworthy bump to the mAP on pretrained weights with COCO.

An inference script that visualizes the bbox overlayed on image (simple matplotlib style rendering) has been on the list of things to add for sometime. But again, have other todos on various projects ahead of that. I'd also accept a PR for that if it fit the style of validation script and coding standards / style here.

I'm not planning to add notebooks here. Made a mistake in adding in notebooks in other projects, they bloat the repository. If I ever get to the point of adding notebooks it'd be in a separate effdet-demo repo. As already stated in the README I will add links to suitable external examples... either repositories or colab, kaggle, etc notebooks that demo uses of these models.

Ekta246 commented 3 years ago

@haadkhan you can simply save the bbox detections coordinates out of the detection dictionary generated in add_predictions function. Save it to a.json file maybe. And then plot on the images using cv2(OpenCV). Remember, don't shuffle the images for test so that the image_id, bbox, scores , categor_id in the detection dictionary remains sequential which makes much more easier to plot the bbox on the test images