Skip to content

Commit f70c29b

Browse files
author
Songki Choi
authored
Fix classification model download logic to resolve zip issue (#1967)
* Replace model download logic by pytorchcv to resolve zip issue * Update change log * Fix pre-commit * Configure checkpoint before model * Add pytorchcv to cls/seg requirement --------- Signed-off-by: Songki Choi <[email protected]>
1 parent ca159a9 commit f70c29b

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ All notable changes to this project will be documented in this file.
88

99
- Fix exception -> warning for anomaly dump_feature option
1010
- Remove `dataset.with_empty_annotations()` to keep original input structure (<https://github.com/openvinotoolkit/training_extensions/pull/1964>)
11-
- Fix OV batch inference (saliency map generation) (<https://github.com/openvinotoolkit/training_extensions/pull/1965>)
11+
- Fix OV batch inference (saliency map generation) (<https://github.com/openvinotoolkit/training_extensions/pull/1965>)
12+
- Replace EfficentNetB0 model download logic by pytorchcv to resolve zip issue (<https://github.com/openvinotoolkit/training_extensions/pull/1967>)
1213

1314
## \[v1.1.1\]
1415

otx/algorithms/classification/adapters/mmcls/tasks/stage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def configure(self, model_cfg, model_ckpt, data_cfg, training=True, **kwargs):
3030

3131
# Recipe + model
3232
cfg = self.cfg
33-
self.configure_model(cfg, model_cfg, **kwargs)
3433
self.configure_ckpt(cfg, model_ckpt, kwargs.get("pretrained", None))
34+
self.configure_model(cfg, model_cfg, **kwargs)
3535
self.configure_data(cfg, data_cfg, training)
3636
self.configure_task(cfg, training)
3737
return cfg

otx/algorithms/common/adapters/mmcv/models/backbones/efficientnet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from mmcv.cnn import build_activation_layer
1919
from mmcv.cnn.bricks import ConvModule
2020
from mmcv.runner import load_checkpoint
21+
from pytorchcv.models.model_store import download_model
2122
from torch import nn
2223
from torch.nn import init
2324

@@ -1281,5 +1282,5 @@ def init_weights(self, pretrained=None):
12811282
load_checkpoint(self, pretrained)
12821283
logger.info(f"init weight - {pretrained}")
12831284
elif pretrained is not None:
1284-
load_checkpoint(self, pretrained_urls[self.model_name])
1285+
download_model(net=self, model_name=self.model_name)
12851286
logger.info(f"init weight - {pretrained_urls[self.model_name]}")

requirements/classification.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ mmcv-full==1.7.0
44
mmcls==0.25.0
55
timm
66
otxdeploy==0.12.1 # FIXME: mmdeploy==? when PyPI packages are available
7+
pytorchcv

requirements/segmentation.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ mmsegmentation==0.30.0
55
scikit-image
66
otxdeploy==0.12.1 # FIXME: mmdeploy==? when PyPI packages are available
77
timm
8+
pytorchcv

0 commit comments

Comments
 (0)