Comments (5)
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.
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.
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.
from efficientdet-pytorch.
@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)
- [BUG] Significant difference between Windows and Ubuntu validate.py result HOT 3
- 'NestedTensor' object has no attribute 'size' HOT 3
- CocoEvaluator fails when two training jobs are run at the same time
- TypeError: 'FeatureInfo' object is not callable HOT 1
- [BUG] Issue title...Results do not correspond to current coco set HOT 1
- [BUG] pip can't find the package on Kaggle & Colab HOT 2
- [BUG] "nan" Training loss in beginning of the training HOT 1
- PyTorch 1.12 HOT 4
- Problem with create model from pretrained checkpoint
- Maybe buf fix
- [BUG] Cannot save torchscripted model
- [BUG] Can't use different image size than what's specified in the config HOT 5
- [BUG] UserWarning: __floordiv__ is deprecated HOT 1
- Inference code
- A new release? HOT 2
- [BUG] Float16 Training Stability Fix
- Tried all the way. It sucks.
- [FEATURE] Freezing Layers HOT 1
- [BUG] Stack shapes mismatch with non-square images HOT 7
- Can't use Pytorch backward hooks because of inplace ReLU6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efficientdet-pytorch.