Multi pretrained weights: Cleanups and Refactoring
See original GitHub issueCandidates:
- Reduce code duplication on model builders by refactoring. For example potentially push the weigh loading mechanism in the private builder methods currently inherited from
torchvision.models
. Also we could provide apretrained
deprecation method. - Review recipe links and ensure they are accurate for all Community Contributed models. Check if possible for some of them to remap their training process to our current ref scripts.
- Decide how quantized models will link to their unquantized versions.
- Naming conventions:
- The name of the
Weights
baseEnum
class and the naming convention of the inheriting classes. Also make sure that all classes are aligned with the model builder names. How are we going to handle_
in names (for example on inception_v3 and the resnext models)? - The name of the
WeightEntry
data class. - The name of
Weights.verify()
method (because it does more than just verification). - The names of the enum values; also their styles (all capital?). Example:
ImageNet1K_RefV1
- Currently the
_RefV1
of one model doesn’t have to be_RefV1
of another model. For example ResNet vs RegNets use different recipes with the same enum value. In other cases, we skip_RefV1
and go directly to_RefV2
, for example the WideResNet50 weights. Is this a problem?
- The name of the
- Decide the signature of
models._api.get_weight()
and make it public. Ensure it’s torchhub-friendly.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Cleanup Quantized ShuffleNet #4854 - pytorch/vision - GitHub
Adds quantized weights for shufflenet_v2_x0_5 variant, so that the equivalent model builder ... Multi pretrained weights: Cleanups and Refactoring #4652.
Read more >Changelog — MMDetection 2.18.0 documentation
Refactor dense heads to decouple onnx export logics from get_bboxes and speed up inference ... Fix download links of RegNet pretrained weights (#5655)....
Read more >Multi-Criteria Code Refactoring Using Search-Based Software ...
In this article, we propose a multi-objective search-based approach for automating the recommendation of refactorings. The process aims at ...
Read more >(PDF) Comparing Commit Messages and Source Code Metrics for ...
We used a multi-objective algorithm to generate refactoring solutions that ... fied from the survey (refactor, clean-up, rewrite, restructure, redesign, ...
Read more >Files · 24b91ae0c4ed84987f645a1c216cac1df5d8db1f · maxmzkr ...
The multi-task loss simplifies and speeds up training. ... the next sections to download pre-computed object proposals and pre-trained ImageNet models ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@NicolasHug Thanks for the thoughts. Another idea we discussed with @jdsgomes offline was the fact that the names of Enums are too long due to our naming conventions for some models. For example for
fasterrcnn_resnet50_fpn()
the enum isFasterRCNNResNet50FPNWeights
which frankly is too long and too unreadable. One option would be to drop completly the “Weights” from the inheriting classes. For example:FasterRCNNResNet50FPN
.At any case, please everyone feel free to add candidates on the list. To unblock the multi-pretrained initiative we were lenient on the reviews concerning nitpicking, naming etc, so we should definitely do a more careful round before moving the code to main torchvision. 😃
Thanks for opening this discussion @jdsgomes , I agree naming is important! (and hard)
In this case, everything is private right? If we don’t expect users to interact directly with these classes (i.e they won’t be inheriting from them), I feel like there isn’t too much risk in choosing an imperfect naming, because this will only really affect us (the devs).
I personally don’t mind
Weights
andWeightEntry
, they’re not super obvious at first but it becomes clear when one sees the instanciation of e.g. theResNet50Weights
class. I think this will be the case for any naming we choose IMHO. My only note about the current naming is thatWeightEntry
could probably beWeightsEntry
.I think your suggestions above are good too. I’ll just add another one:
WeightsEnum
andWeights
. e.g.: