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

Integration with Mantisshrimp #50

Closed lgvaz closed 3 years ago

lgvaz commented 4 years ago

Hello Ross!

First of all, thank you for all the amazing work put into this repo, your efforts into making sure your implementation could replicate the original results from the paper makes your code stand out.

The team I'm a part of is developing an object detection library called mantisshrimp and we're looking forward to add efficientdet to our arsenal.

Before I go to questions, let me give you a very brief background:

Differently than other object detection libraries, our main goal is not to implement everything ourselves, but instead to provide a framework that makes it really easy to integrate implementations made by the community.

As an example, the library does not contain any implementation of a training loop! Instead, we provide adapters to libraries like fastai and lightning that handle the training loop, if you're curious to learn more, take a look at our introduction guide.

The same can be said for models, we currently only have support for torchvision's rcnns, and we choose this implementation of efficientdet to add next 🥳

Now that you know a little bit about the background, let me get to the questions (sorry for the long list):

lgvaz commented 4 years ago

What happens if I feed samples with empty annotations while training? Should I take care that does not happen or the model already handles it?

rwightman commented 4 years ago

@lgvaz I don't have time for an in depth response right now, but a few quick things

lgvaz commented 4 years ago

Thanks for the quick answer Ross!! I'll close the issue since it's not really related to this repo

I believe this will help with Finetuning and questions like #49 as well, I hope people like it 😁

If I have additional questions, can I continue asking in this thread even with the issue closed?

Thanks again!

lgvaz commented 4 years ago

Hello Ross! I hope you are doing great!

So I'm almost done with the integration, I successfully trained a model which gave great results, but before I announce it, I want to make some clarification questions


This is how I'm creating a model:

    config = get_efficientdet_config(model_name=model_name)
    net = EfficientDet(config, pretrained_backbone=False)
    # load pretrained weights
    ...
    # configure head
    config.num_classes = num_classes
    config.image_size = img_size
    net.class_net = HeadNet(config, num_outputs=num_classes, norm_kwargs=dict(eps=0.001, momentum=0.01))

I'm customizing config only to create the head, is that correct?

Any recommendation for norm_kwargs values? Maybe I should just leave it to the default ones


I want to pad my images for training to maintain the aspect ratio like so:

image

I understood that for validation/inference we need to pass a list img_size with the image sizes before padding, do I have to pass anything similar while training?


For prediction I'm doing the following:

model2 = unwrap_bench(model) # model is DetBenchTrain
model2 = DetBenchPredict(model2, model.config)

Which seems to be working correclty, results with tf_efficientdet_lite0 on the fridge dataset:

image