Skip to content

Commit

Permalink
Fix classification model download logic to resolve zip issue (openvin…
Browse files Browse the repository at this point in the history
…otoolkit#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 <songki.choi@intel.com>
  • Loading branch information
goodsong81 committed Apr 4, 2023
1 parent 01e0045 commit 712c15b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ All notable changes to this project will be documented in this file.

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

## \[v1.1.1\]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def configure(self, model_cfg, model_ckpt, data_cfg, training=True, **kwargs):

# Recipe + model
cfg = self.cfg
self.configure_model(cfg, model_cfg, **kwargs)
self.configure_ckpt(cfg, model_ckpt, kwargs.get("pretrained", None))
self.configure_model(cfg, model_cfg, **kwargs)
self.configure_data(cfg, data_cfg, training)
self.configure_task(cfg, training)
return cfg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from mmcv.cnn import build_activation_layer
from mmcv.cnn.bricks import ConvModule
from mmcv.runner import load_checkpoint
from pytorchcv.models.model_store import download_model
from torch import nn
from torch.nn import init

Expand Down Expand Up @@ -1281,5 +1282,5 @@ def init_weights(self, pretrained=None):
load_checkpoint(self, pretrained)
logger.info(f"init weight - {pretrained}")
elif pretrained is not None:
load_checkpoint(self, pretrained_urls[self.model_name])
download_model(net=self, model_name=self.model_name)
logger.info(f"init weight - {pretrained_urls[self.model_name]}")
1 change: 1 addition & 0 deletions requirements/classification.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ mmcv-full==1.7.0
mmcls==0.25.0
timm
otxdeploy==0.12.1 # FIXME: mmdeploy==? when PyPI packages are available
pytorchcv
1 change: 1 addition & 0 deletions requirements/segmentation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ mmsegmentation==0.30.0
scikit-image
otxdeploy==0.12.1 # FIXME: mmdeploy==? when PyPI packages are available
timm
pytorchcv

0 comments on commit 712c15b

Please sign in to comment.