Pass losses as callables when building detection models
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
🚀 The feature
Some models currently accept normalization strategies as callables (mobilenet_backbone accepts a norm_layer argument for example) but loss functions are currently hardcoded (F.cross_entropy for fastercnn.roi_heads for example).
Following what has been done on normalization strategies loss function could be passed as callables in the modules constructor. This shouldn't break any backward compatibility. Reduction strategies still need to be properly handled.
Motivation, pitch
Currently, trying different loss functions requires to use some dirty model patches. Accepting the losses in the model constructors would provide a much cleaner way to hack around the models.
If any interest I can propose a first PR modifying the Faster-RNN models.
Alternatives
No response
Additional context
No response
cc @datumbox
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cited fastercnn.roi_heads use of F.cross_entropy and inspect the detection model constructors, then compare how mobilenet_backbone accepts norm_layer callables. Done means loss functions can be supplied through constructors without breaking existing usage, with reduction strategies handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision, machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100