Skip to content

Commit

Permalink
Merge back changes in release 1.1.0 (#1947)
Browse files Browse the repository at this point in the history
* Bump up version to 1.1.0rc1

* Updated daily workflow (#1905)

- remove if statement to allow running on any branch by manually

* [FIX] Wrong test temp directory path (#1902)

* Fix wrong test temp directory

* Update tests/unit/algorithms/action/adapters/mmaction/utils/test_action_config_utils.py

* Update test_action_config_utils.py

* Update PR template (#1914)

* Update . location.

* Fix OTX1.1 -> Geti1.4 integration issues (#1910)

* Add dill to requirements/api.txt

* Return None instead of raising NotImplementedError in IMedia2DEntity.path

* Move utils HPO uses into HPO directory (#1912)

move utils into hpo dir

* [FIX] Add stability to explain detection (#1901)

Add stability to explain detection

* [Fix] e2e tests FQ references (#1918)

Fix FQ references

* Move mpa.deploy to otx.algorithms.common (#1903)

* Move deploy modules to otx

* test: fix mmdeploy api replacement error

* Fix pre-commit issues

* Update otx/mpa/det/exporter.py

* Update otx/mpa/exporter_mixin.py

* Update otx/mpa/seg/exporter.py

* Update otx/mpa/cls/exporter.py

* Update otx/algorithms/common/adapters/mmdeploy/utils/mmdeploy.py

* Update otx/algorithms/common/adapters/mmdeploy/utils/operations_domain.py

* Add mmcls.VisionTransformer backbone support (#1908)

* Add mmcls transformer backbones

* Fix VisionTransformeroutput check

* Add changes

* Disable recording forward hooks in inferrer

* Remove unused import

* Move semantic-segmentation related codes to otx adapters (#1911)

* Added security.md

Add the security related notification

* Update security.md

fix prettier issue

* Add custom exception class for CLI (#1919)

* Add custom exception class for CLI

* Fixed TCs for config_manager

* Correct License to Apache

* Remove temp hot key values (#1916)

* Refactor OTX classification phase 1: move modules from MPA to OTX (#1893)

* Revert TrainType typo (#1928)

* Fix Conflict

* Fix conflict

* Fix unit-tests

* Fix cli tests

* Fix cli tests

* Fix type

* Move all hooks in MPA into OTX common mmcv adapter (#1922)

* Add explanation for XAI & minor doc fixes (#1923)

* [CI] Updated daily workflow (#1904)

Updated daily workflow

- remove if statement to allow running on any branch by manually

* [FIX] re-bugfix: ATSS head loss (#1907)

re bugfix

* Fix typos

* Explanation of Explanation

* Add images & typo fixes

* Fixes from comments

* Add accuracy for OD explanation

* Tutorial update

* Add accuracy for BCCD and WGISD

* Fix

* Move utils to OTX common & adapter (#1931)

* [CI] Updated daily workflow (#1904)

Updated daily workflow

- remove if statement to allow running on any branch by manually

* [FIX] re-bugfix: ATSS head loss (#1907)

re bugfix

* Added security.md

Added the security related notification.

* Update security.md

fix prettier issue

* Move utils

* Fix typo

* Move classification unit tests to OTX tests (#1932)

* [CI] Updated daily workflow (#1904)

Updated daily workflow

- remove if statement to allow running on any branch by manually

* [FIX] re-bugfix: ATSS head loss (#1907)

re bugfix

* Added security.md

Added the security related notification.

* Update security.md

fix prettier issue

* Move classification unit tests

* Apply mocker in RandAugment TC

* Move otx.mpa.modules.ov -> otx.core.ov (#1929)

* First Refactoring

* Refactor mpa.modules.ov -> otx.core.ov

* Remove otx.mpa.modules.ov

* Fix docs & unit test paths

* Fix some import

* Add TODO comments

* Add github icon link in doc head (#1934)

* Fix invalid temp_dir inside unit tests (#1937)

* Move all model utils and dataloaders/samplers in mpa to otx adapter (#1930)

* Move stages to each algorithms (#1938)

* Move stages to each algorithms

* Change docs for action recognition (#1940)

* Change docs for action recognition

* Fix typo

* Update MoViNet related parts

* Add MoViNet performance

* Revert table include Complexity and Model size

* Fix tox to run tests on non-editable install

* Fix packaging errors including cython module build / import issues (#1936)

* Avoid cychon compile on Windows

* Fix packaging errors

* Fix pre-commit

* Remove use_develop option from tox tests

* Fix pre-commit

* Fix tox -e -> -re for clean build

* Fix import error

* Add missing __init__.py

* Fix relative -> absolute import

* Revert to editable package in tox tests

* Release 1.1.0 (#1933)

* Release OTX 1.1.0

* Update known issues in CHANGELOG.md

* Fix PR / issue # to links

* Fix pre-commit

* Bump-up version to 1.2

* Fix pre-commit

---------

Signed-off-by: Songki Choi <songki.choi@intel.com>
Co-authored-by: Yunchu Lee <yunchu.lee@intel.com>
Co-authored-by: Harim Kang <harim.kang@intel.com>
Co-authored-by: Eunwoo Shin <eunwoo.shin@intel.com>
Co-authored-by: Emily Chun <emily.chun@intel.com>
Co-authored-by: emily.chun <chuneuny@ikvensx012>
Co-authored-by: Sungman Cho <sungman.cho@intel.com>
Co-authored-by: Inhyuk Andy Cho <andy.inhyuk.jo@intel.com>
Co-authored-by: Jaeguk Hyun <jaeguk.hyun@intel.com>
Co-authored-by: Jihwan Eom <jihwan.eom@intel.com>
Co-authored-by: Soobee Lee <soobee.lee@intel.com>
Co-authored-by: Galina Zalesskaya <galina.zalesskaya@intel.com>
  • Loading branch information
12 people authored Mar 28, 2023
1 parent fd1e6c3 commit f8e31db
Show file tree
Hide file tree
Showing 663 changed files with 8,301 additions and 6,731 deletions.
20 changes: 10 additions & 10 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ not fully covered by unit tests or manual testing can be complicated. -->

<!-- Put an 'x' in all the boxes that apply -->

- [ ] I submit my changes into the `develop` branch
- [ ] I have added description of my changes into [CHANGELOG](https://github.com/openvinotoolkit/training_extensions/blob/develop/CHANGELOG.md)
- [ ] I have updated the [documentation](https://github.com/openvinotoolkit/training_extensions/tree/develop/docs) accordingly
- [ ] I have added tests to cover my changes
- [ ] I have [linked related issues](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)
- [ ] I have added unit tests to cover my changes.​
- [ ] I have added integration tests to cover my changes.​
- [ ] I have added e2e tests for validation.
- [ ] I have added the description of my changes into CHANGELOG in my target branch (e.g., [CHANGELOG](https://github.com/openvinotoolkit/training_extensions/blob/develop/CHANGELOG.md) in develop).​
- [ ] I have updated the documentation in my target branch accordingly (e.g., [documentation](https://github.com/openvinotoolkit/training_extensions/tree/develop/docs) in develop).
- [ ] I have [linked related issues](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).

### License

- [ ] I submit _my code changes_ under the same [MIT License](https://github.com/openvinotoolkit/training_extensions/blob/develop/LICENSE) that covers the project.
- [ ] I submit _my code changes_ under the same [Apache License](https://github.com/openvinotoolkit/training_extensions/blob/develop/LICENSE) that covers the project.
Feel free to contact the maintainers if that's a concern.
- [ ] I have updated the license header for each file (see an example below)
- [ ] I have updated the license header for each file (see an example below).

```python
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
```
14 changes: 7 additions & 7 deletions .github/workflows/pre_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Unit-testing
run: tox -re pre-merge -- tests/unit
run: tox -e pre-merge -- tests/unit
- name: Upload coverage reports to Codecov
run: |
# If the workflow is triggered from PR then it gets the commit id from the PR.
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Integration-testing
run: tox -re pre-merge -- tests/integration/cli/test_cli.py
run: tox -e pre-merge -- tests/integration/cli/test_cli.py
Pre-Merge-Integration-Cls-Test:
runs-on: [self-hosted, linux, x64, dev]
needs: Pre-Merge-Unit-Test
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Integration-testing
run: tox -re pre-merge-cls
run: tox -e pre-merge-cls
Pre-Merge-Integration-Det-Test:
runs-on: [self-hosted, linux, x64, dev]
needs: Pre-Merge-Unit-Test
Expand All @@ -94,7 +94,7 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Integration-testing
run: tox -re pre-merge-det
run: tox -e pre-merge-det
Pre-Merge-Integration-Seg-Test:
runs-on: [self-hosted, linux, x64, dev]
needs: Pre-Merge-Unit-Test
Expand All @@ -105,7 +105,7 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Integration-testing
run: tox -re pre-merge-seg
run: tox -e pre-merge-seg
Pre-Merge-Integration-Action-Test:
runs-on: [self-hosted, linux, x64, dev]
needs: Pre-Merge-Unit-Test
Expand All @@ -116,7 +116,7 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Integration-testing
run: tox -re pre-merge-action
run: tox -e pre-merge-action
Pre-Merge-Integration-Anomaly-Test:
runs-on: [self-hosted, linux, x64, dev]
needs: Pre-Merge-Unit-Test
Expand All @@ -127,4 +127,4 @@ jobs:
- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
- name: Integration-testing
run: tox -re pre-merge-anomaly
run: tox -e pre-merge-anomaly
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,60 @@

All notable changes to this project will be documented in this file.

## \[v1.2.0\]

### New features

-

### Enhancements

-

### Bug fixes

-

### Known issues

- 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.0\]

### New features

- Add FP16 IR export support (<https://github.com/openvinotoolkit/training_extensions/pull/1683>)
- Add in-memory caching in dataloader (<https://github.com/openvinotoolkit/training_extensions/pull/1694>)
- Add MoViNet template for action classification (<https://github.com/openvinotoolkit/training_extensions/pull/1742>)
- Add Semi-SL multilabel classification algorithm (<https://github.com/openvinotoolkit/training_extensions/pull/1805>)
- Integrate multi-gpu training for semi-supervised learning and self-supervised learning (<https://github.com/openvinotoolkit/training_extensions/pull/1534>)
- Add train-type parameter to otx train (<https://github.com/openvinotoolkit/training_extensions/pull/1874>)
- Add embedding of inference configuration to IR for classification (<https://github.com/openvinotoolkit/training_extensions/pull/1842>)
- Enable VOC dataset in OTX (<https://github.com/openvinotoolkit/training_extensions/pull/1862>)
- Add mmcls.VisionTransformer backbone support (<https://github.com/openvinotoolkit/training_extensions/pull/1908>)

### Enhancements

- Parametrize saliency maps dumping in export (<https://github.com/openvinotoolkit/training_extensions/pull/1888>)
- Bring mmdeploy to action recognition model export & Test optimization of action tasks (<https://github.com/openvinotoolkit/training_extensions/pull/1848>)
- Update backbone lists (<https://github.com/openvinotoolkit/training_extensions/pull/1835>)
- Add explanation for XAI & minor doc fixes (<https://github.com/openvinotoolkit/training_extensions/pull/1923>)
- Refactor phase#1: MPA modules

### Bug fixes

- Handle unpickable update_progress_callback (<https://github.com/openvinotoolkit/training_extensions/pull/1892>)
- Dataset Adapter: Avoid duplicated annotation and permit empty image (<https://github.com/openvinotoolkit/training_extensions/pull/1873>)
- Arrange scale between bbox preds and bbox targets in ATSS (<https://github.com/openvinotoolkit/training_extensions/pull/1880>)
- Fix label mismatch of evaluation and validation with large dataset in semantic segmentation (<https://github.com/openvinotoolkit/training_extensions/pull/1851>)
- Fix packaging errors including cython module build / import issues (<https://github.com/openvinotoolkit/training_extensions/pull/1936>)

### Known issues

- 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.0.1\]

### Enhancements
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ recursive-include requirements *
recursive-include otx *.pyx
recursive-include otx *.yaml
recursive-include otx *.json
recursive-exclude otx *.c
graft tests
global-exclude *.py[cod]
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ You can find more details with examples in the [CLI command intro](https://openv

## Updates

### v1.0.0 (1Q23)

- Package Installation via PyPI
- OpenVINO™ Training Extensions installation will be supported via PyPI
- CLI update
- Update `find` command to find configurations of tasks/algorithms
- Introduce `build` command to customize task or model configurations
- Automatic algorihm selection for the `train` command using the given input dataset
- Adaptation of [Datumaro](https://github.com/openvinotoolkit/datumaro) component as a dataset interface
- Integrate hyper-parameter optimizations
- Support action recognition task

### v1.1+ (2Q23)
### v1.1.0 (1Q23)

- Add FP16 IR export support (<https://github.com/openvinotoolkit/training_extensions/pull/1683>)
- Add in-memory caching in dataloader (<https://github.com/openvinotoolkit/training_extensions/pull/1694>)
- Add MoViNet template for action classification (<https://github.com/openvinotoolkit/training_extensions/pull/1742>)
- Add Semi-SL multilabel classification algorithm (<https://github.com/openvinotoolkit/training_extensions/pull/1805>)
- Integrate multi-gpu training for semi-supervised learning and self-supervised learning (<https://github.com/openvinotoolkit/training_extensions/pull/1534>)
- Add train-type parameter to otx train (<https://github.com/openvinotoolkit/training_extensions/pull/1874>)
- Add embedding of inference configuration to IR for classification (<https://github.com/openvinotoolkit/training_extensions/pull/1842>)
- Enable VOC dataset in OTX (<https://github.com/openvinotoolkit/training_extensions/pull/1862>)
- Add mmcls.VisionTransformer backbone support (<https://github.com/openvinotoolkit/training_extensions/pull/1908>)

### v1.2+ (2Q23)

- In planning

Expand Down
Binary file added docs/source/_static/logos/github_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@
"logo": {
"image_light": 'logos/otx-logo.png',
"image_dark": 'logos/otx-logo.png',
}
},
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/openvinotoolkit/training_extensions",
"icon": "_static/logos/github_icon.png",
"type": "local",
},
],
}
html_css_files = [
'css/custom.css',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Additional Features
models_optimization
hpo
auto_configuration
xai
95 changes: 95 additions & 0 deletions docs/source/guide/explanation/additional_features/xai.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
Explainable AI (XAI)
====================

**Explainable AI (XAI)** is a field of research that aims to make machine learning models more transparent and interpretable to humans.
The goal is to help users understand how and why AI systems make decisions and provide insight into their inner workings. It allows us to detect, analyze, and prevent common mistakes, for example, when the model uses irrelevant features to make a prediction.
XAI can help to build trust in AI, make sure that the model is safe for development and increase its adoption in various domains.

Most XAI methods generate **saliency maps** as a result. Saliency map is a visual representation, suitable for human comprehension, that highlights the most important parts of the image from the model point of view.
It looks like a heatmap, where warm-colored areas represent the areas with main focus.


.. figure:: ../../../../utils/images/xai_example.jpg
:width: 600
:alt: this image shows the result of XAI algorithm

These images are taken from `D-RISE paper <https://arxiv.org/abs/2006.03204>`_.


We can generate saliency maps for a certain model that was trained in OpenVINO™ Training Extensions, using ``otx explain`` command line. Learn more about its usage in :doc:`../../tutorials/base/explain` tutorial.

*********************************
XAI algorithms for classification
*********************************

.. image:: ../../../../utils/images/xai_cls.jpg
:width: 600
:align: center
:alt: this image shows the comparison of XAI classification algorithms


For classification networks these algorithms are used to generate saliency maps:

- **Activation Map​** - this is the most basic and naive approach. It takes the outputs of the model's feature extractor (backbone) and averages it in channel dimension. The results highly rely on the backbone and ignore neck and head computations. Basically, it gives a relatively good and fast result.

- `Eigen-Cam <https://arxiv.org/abs/2008.00299​>`_ uses Principal Component Analysis (PCA). It returns the first principal component of the feature extractor output, which most of the time corresponds to the dominant object. The results highly rely on the backbone as well and ignore neck and head computations.

- `Recipro-CAM​ <https://arxiv.org/pdf/2209.14074>`_ uses Class Activation Mapping (CAM) to weigh the activation map for each class, so it can generate different saliency per class. Recipro-CAM is a fast gradient-free Reciprocal CAM method. The method involves spatially masking the extracted feature maps to exploit the correlation between activation maps and network predictions for target classes.


Below we show the comparison of described algorithms. ``Access to the model internal state`` means the necessity to modify the model's outputs and dump inner features.
``Per-class explanation support`` means generation different saliency maps for different classes.

+-------------------------------------------+----------------+----------------+-------------------------------------------------------------------------+
| Classification algorithm | Activation Map | Eigen-Cam | Recipro-CAM |
+===========================================+================+================+=========================================================================+
| Need access to model internal state | Yes | Yes | Yes |
+-------------------------------------------+----------------+----------------+-------------------------------------------------------------------------+
| Gradient-free | Yes | Yes | Yes |
+-------------------------------------------+----------------+----------------+-------------------------------------------------------------------------+
| Single-shot | Yes | Yes | No (re-infer neck + head H*W times, where HxW – feature map size) |
+-------------------------------------------+----------------+----------------+-------------------------------------------------------------------------+
| Per-class explanation support | No | No | Yes |
+-------------------------------------------+----------------+----------------+-------------------------------------------------------------------------+
| Execution speed | Fast | Fast | Medium |
+-------------------------------------------+----------------+----------------+-------------------------------------------------------------------------+


****************************
XAI algorithms for detection
****************************

For detection networks these algorithms are used to generate saliency maps:

- **Activation Map​** - the same approach as for classification networks, which uses the outputs from feature extractor. This is an algorithm is used to generate saliency maps for two-stage detectors.

- **DetClassProbabilityMap** - this approach takes the raw classification head output and uses class probability maps to calculate regions of interest for each class. So, it creates different salience maps for each class. This algorithm is implemented for single-stage detectors only.

.. image:: ../../../../utils/images/xai_det.jpg
:width: 600
:align: center
:alt: this image shows the detailed description of XAI detection algorithm


The main limitation of this method is that, due to training loss design of most single-stage detectors, activation values drift towards the center of the object while propagating through the network.
This prevents from getting clear explanation in the input image space using intermediate activations.

Below we show the comparison of described algorithms. ``Access to the model internal state`` means the necessity to modify the model's outputs and dump inner features.
``Per-class explanation support`` means generation different saliency maps for different classes. ``Per-box explanation support`` means generation standalone saliency maps for each detected prediction.


+-------------------------------------------+----------------------------+--------------------------------------------+
| Detection algorithm | Activation Map | DetClassProbabilityMap |
+===========================================+============================+============================================+
| Need access to model internal state | Yes | Yes |
+-------------------------------------------+----------------------------+--------------------------------------------+
| Gradient-free | Yes | Yes |
+-------------------------------------------+----------------------------+--------------------------------------------+
| Single-shot | Yes | Yes |
+-------------------------------------------+----------------------------+--------------------------------------------+
| Per-class explanation support | No | Yes |
+-------------------------------------------+----------------------------+--------------------------------------------+
| Per-box explanation support | No | No |
+-------------------------------------------+----------------------------+--------------------------------------------+
| Execution speed | Fast | Fast |
+-------------------------------------------+----------------------------+--------------------------------------------+
Loading

0 comments on commit f8e31db

Please sign in to comment.