GithubHelp home page GithubHelp logo

Finetuning about efficientdet-pytorch HOT 5 CLOSED

Naivepro1990 avatar Naivepro1990 commented on August 19, 2024
Finetuning

from efficientdet-pytorch.

Comments (5)

rwightman avatar rwightman commented on August 19, 2024

You can use the training script here for custom datasets so long as you have your custom dataset in a coco compatible annotation format (train / val json files).

To finetune, during model creation, adding a one liner that relplaces the HeadNet would be the easiest solution.

model.class_net = HeadNet(config, num_outputs=your_num_classes, norm_kwargs=dict(eps=.001, momentum=.01))

You could probably get a bit more granular and just replace the final layer of the head net
model.class_net.predict = ... but that requires some more code.

In both cases you need to hack together a weight init that only inits the modified head weights properly, especially the predict weights. It's best to do this by modifying the create factory, or creating your own... at line 28 after pretrained weights are loaded, not where the FIXME is.

https://github.com/rwightman/efficientdet-pytorch/blob/master/effdet/factory.py#L28

from efficientdet-pytorch.

rwightman avatar rwightman commented on August 19, 2024

Also, default training hparams won't necessarily work great for finetuning. I'd start with --opt adam --sched plateau and lr between 1e-3 to 1e-4.

from efficientdet-pytorch.

Naivepro1990 avatar Naivepro1990 commented on August 19, 2024

Thanks,

It will be good idea to include the finetuning as an option in the code, by default it should be false.

And instead of hardcoding the prediction classes, it should be a parameter like in the original code.

from efficientdet-pytorch.

rwightman avatar rwightman commented on August 19, 2024

from efficientdet-pytorch.

Naivepro1990 avatar Naivepro1990 commented on August 19, 2024

@rwightman It seems the above solution doesn;t quite work for finetuning as the location you specified HeadNet is not defined. I did tried to import but still it gives error.

from efficientdet-pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.