Skip to content

Commit

Permalink
Merge back bug fixes in release 1.1.2 (#1971)
Browse files Browse the repository at this point in the history
* Fix exception -> warning for anomaly dump_feature option

* Remove `dataset.with_empty_annotations()` to keep original input structure (#1964)

* Fix OV batch inference (saliency map generation)  (#1965)

* Release 1.1.2 RC1

* 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

* Hot fix for numpy attr for ResultMediaEntity

* Release 1.1.2

* Update exportable code demo commit

---------

Co-authored-by: Evgeny Tsykunov <evgeny.tsykunov@intel.com>
  • Loading branch information
goodsong81 and negvet authored Apr 5, 2023
1 parent cc5ae21 commit 6939daf
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ All notable changes to this project will be documented in this file.
- OpenVINO(==2022.3) IR inference is not working well on 2-stage models (e.g. Mask-RCNN) exported from torch==1.13.1
(working well up to torch==1.12.1) (<https://github.com/openvinotoolkit/training_extensions/issues/1906>)

## \[v1.1.2\]

### Bug fixes

- 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>)
- Replace EfficentNetB0 model download logic by pytorchcv to resolve zip issue (<https://github.com/openvinotoolkit/training_extensions/pull/1967>)

## \[v1.1.1\]

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion otx/algorithms/anomaly/tasks/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def export(
Exception: If export_type is not ExportType.OPENVINO
"""
if dump_features:
raise NotImplementedError(
logger.warning(
"Feature dumping is not implemented for the anomaly task."
"The saliency maps and representation vector outputs will not be dumped in the exported model."
)
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
2 changes: 0 additions & 2 deletions otx/algorithms/classification/tasks/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def infer(
logger.info("called infer()")
stage_module = "ClsInferrer"
self._data_cfg = self._init_test_data_cfg(dataset)
dataset = dataset.with_empty_annotations()

dump_features = True
dump_saliency_map = not inference_parameters.is_evaluation if inference_parameters else True
Expand Down Expand Up @@ -169,7 +168,6 @@ def explain(
logger.info("called explain()")
stage_module = "ClsExplainer"
self._data_cfg = self._init_test_data_cfg(dataset)
dataset = dataset.with_empty_annotations()

results = self._run_task(
stage_module,
Expand Down
2 changes: 1 addition & 1 deletion otx/algorithms/classification/tasks/openvino.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def explain(
dataset_item.append_labels(item_labels)
add_saliency_maps_to_dataset_item(
dataset_item=dataset_item,
saliency_map=np.copy(saliency_map),
saliency_map=saliency_map,
model=self.model,
labels=self.task_environment.get_labels(),
predicted_scored_labels=item_labels,
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 @@ -1308,5 +1309,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]}")
2 changes: 1 addition & 1 deletion otx/algorithms/detection/adapters/openvino/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def explain(

add_saliency_maps_to_dataset_item(
dataset_item=dataset_item,
saliency_map=np.copy(saliency_map),
saliency_map=saliency_map,
model=self.model,
labels=labels,
predicted_scored_labels=predicted_scored_labels,
Expand Down
2 changes: 1 addition & 1 deletion otx/api/entities/result_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(
self.annotation_scene = annotation_scene
self.roi = Annotation(Rectangle.generate_full_box(), labels=[]) if roi is None else roi
self.label = label
self.numpy = numpy
self._numpy = np.copy(numpy)

def __repr__(self):
"""Returns a string with all the attributes of the ResultMediaEntity."""
Expand Down
2 changes: 1 addition & 1 deletion otx/api/usecases/exportable_code/demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openvino==2022.3.0
openmodelzoo-modelapi==2022.3.0
otx @ git+https://github.com/openvinotoolkit/training_extensions/@9753acd6fef11fa83240e6ed3a031fb9a3e62b0f#egg=otx
otx @ git+https://github.com/openvinotoolkit/training_extensions/@dd03235da2319815227f1b75bce298ee6e8b0f31#egg=otx
numpy>=1.21.0,<=1.23.5 # np.bool was removed in 1.24.0 which was used in openvino runtime
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 6939daf

Please sign in to comment.