Extend EfficientNet pretrained support to B2-B8#4963
Extend EfficientNet pretrained support to B2-B8#4963itrushkin wants to merge 1 commit intoopen-edge-platform:developfrom
Conversation
|
Since we used base models, we need to be sure that "c" variants are backward compatible and the performance of the b0 backbone remains same or better. |
|
Hi @kprokofi, To confirm backward compatibility: all existing unit tests continue to pass, and model calls with dummy inputs execute successfully, indicating that the integration of the "c" variants doesn’t break existing functionality. The performance improvements for the "c" variants come from the AdvProp paper. I haven't independently benchmarked the b0 backbone myself, but the original authors state that these models match or exceed the baseline performance. |
| if pretrained: | ||
| cache_dir = Path.home() / ".cache" / "torch" / "hub" / "checkpoints" | ||
| download_model(net=model, model_name=f"{model_name}", local_model_store_dir_path=str(cache_dir)) | ||
| download_model(net=model, model_name=f"{model_name}c", local_model_store_dir_path=str(cache_dir)) |
There was a problem hiding this comment.
Thanks Ilya for the contribution. I think here we can not just replace this weights without a set of comprehensive experiments. 100% positive correlation with IN-top1 is not given, there could be sudden outlier which we'd like to avoid.
To tackle that, I'd propose moving this version parameter to init of EfficientNetBackbone and forwarding it from the endpoint classes (EfficientNetMulticlassCls etc). Once done, the model version is configurable from model recipe yaml file. Corner case of b0 and b1 should be handled.
| ) | ||
| def test_forward(self, model_name): | ||
| model = EfficientNetBackbone(model_name, pretrained=None) | ||
| @pytest.mark.parametrize("pretrained", [True, False]) |
There was a problem hiding this comment.
Please, don't download anything here to avoid increase of UTs duration and reliability. You could mock download_model if the idea is to check that the URL is correct somehow.
|
This PR is stale because it has been open 90 days with no activity. |

Summary
Adds support for downloading and using pretrained EfficientNet weights for models larger than B1 (B2-B8).
In pytorchcv, the “c” denotes the community re-trained EfficientNet variants (ported via https://www.github.com/rwightman/timm) that use PyTorch-native ops and shapes, distinct from the original TF-trained baselines.
Checklist
Warning
This PR may increase test runtime because it involves downloading large models.