From 2558665c490e5338bcb8ba4eb4e2bca1fd08e28e Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Tue, 21 Nov 2023 06:11:50 +0900 Subject: [PATCH 01/19] Upgrade OV MAPI and NNCF version --- requirements/openvino.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/openvino.txt b/requirements/openvino.txt index 90ee6025685..c77e9981128 100644 --- a/requirements/openvino.txt +++ b/requirements/openvino.txt @@ -1,8 +1,8 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # OpenVINO Requirements. # -nncf==2.6.0 +nncf==2.7.0 onnx==1.13.0 -openvino-model-api==0.1.6 -openvino==2023.1.0 -openvino-dev==2023.1.0 +openvino-model-api==0.1.7 +openvino==2023.2.0 +openvino-dev==2023.2.0 openvino-telemetry==2023.2.* From 166f6b4de4b73cd18f52f9c31c42142934030937 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Tue, 21 Nov 2023 06:14:58 +0900 Subject: [PATCH 02/19] Update demo requirements --- src/otx/api/usecases/exportable_code/demo/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/otx/api/usecases/exportable_code/demo/requirements.txt b/src/otx/api/usecases/exportable_code/demo/requirements.txt index 95593e05160..0d011ecd407 100644 --- a/src/otx/api/usecases/exportable_code/demo/requirements.txt +++ b/src/otx/api/usecases/exportable_code/demo/requirements.txt @@ -1,4 +1,4 @@ -openvino==2023.0 -openvino-model-api==0.1.6 -otx @ git+https://github.com/openvinotoolkit/training_extensions/@0e1200f4cc5343dcac597674fc97a898fc9829c2#egg=otx +openvino==2023.2.0 +openvino-model-api==0.1.7 +otx @ git+https://github.com/openvinotoolkit/training_extensions/@2558665c490e5338bcb8ba4eb4e2bca1fd08e28e#egg=otx numpy>=1.21.0,<=1.23.5 # np.bool was removed in 1.24.0 which was used in openvino runtime From 61c61fcd4cdca3001688117639c3047e9124718e Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Tue, 21 Nov 2023 06:26:58 +0900 Subject: [PATCH 03/19] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9953ee7d95b..67b1f45ab49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## \[unreleased\] +### Enhancements + +- Upgrade NNCF to 2.7 and OpenVINO to 2023.2 () + ## \[v1.5.0\] ### New features From 75d17754ce1eeaea62d25bfc9f3f27f5cd674669 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Tue, 21 Nov 2023 06:55:13 +0900 Subject: [PATCH 04/19] Update datumaro --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index 538912b36cc..ab8a87e48dc 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -4,7 +4,7 @@ natsort==8.1.* prettytable==3.9.* protobuf==3.20.* pyyaml -datumaro~=1.6.0rc0 +datumaro @ git+https://github.com/sovrasov/datumaro/@acc79a32e82c335af01a0b733c06e824b423771c#egg=datumaro psutil==5.9.* scipy==1.10.* bayesian-optimization==1.4.* From d5bec65b3de60c6334bb90bf4f47e44d876fc0f1 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Tue, 21 Nov 2023 07:55:46 +0900 Subject: [PATCH 05/19] Add rust installation --- .github/workflows/pre_merge.yml | 4 ++++ .github/workflows/run_tests_in_tox.yml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/pre_merge.yml b/.github/workflows/pre_merge.yml index 142b3b38781..5a7014a5c61 100644 --- a/.github/workflows/pre_merge.yml +++ b/.github/workflows/pre_merge.yml @@ -22,6 +22,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Installing Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Set up Python uses: actions/setup-python@v4 with: @@ -52,6 +54,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Installing Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Install Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/run_tests_in_tox.yml b/.github/workflows/run_tests_in_tox.yml index aaa00970b74..cae970b35fb 100644 --- a/.github/workflows/run_tests_in_tox.yml +++ b/.github/workflows/run_tests_in_tox.yml @@ -42,6 +42,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Installing Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Set up Python uses: actions/setup-python@v4 with: From 7c8db8cc0b5e5183b621b82c2bd4225de694558b Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Thu, 23 Nov 2023 04:23:11 +0900 Subject: [PATCH 06/19] Update NNCF configs for IS models --- .../convnext_maskrcnn/compression_config.json | 5 +++++ .../efficientnetb2b_maskrcnn/compression_config.json | 5 +++++ .../maskrcnn_swin_t/compression_config.json | 5 +++++ .../resnet50_maskrcnn/compression_config.json | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json index 7e0cba46aa9..c88a5c2744e 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json index 7e0cba46aa9..c88a5c2744e 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json index 29ac4407c10..c8b0d164aa9 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json index ab687b9c6a2..af3c5ef8937 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { From 5b91c329666632645606d5c42cf41cf268e4063a Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Sat, 25 Nov 2023 10:06:36 +0900 Subject: [PATCH 07/19] Update more fqs --- .../compressed_model.yml | 6 +++--- .../compressed_model.yml | 6 +++--- .../compressed_model.yml | 2 +- .../compressed_model.yml | 8 ++++---- .../compressed_model.yml | 8 ++++---- .../compressed_model.yml | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml index ee44bed9abb..4412b7bee5c 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml @@ -2,14 +2,14 @@ TestToolsHierarchicalClassification: nncf: number_of_fakequantizers: 267 ptq: - number_of_fakequantizers: 177 + number_of_fakequantizers: 207 TestToolsMultiClassClassification: nncf: number_of_fakequantizers: 267 ptq: - number_of_fakequantizers: 177 + number_of_fakequantizers: 207 TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 269 ptq: - number_of_fakequantizers: 179 + number_of_fakequantizers: 212 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml index 27616d54b5a..c86a2d8de29 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml @@ -2,14 +2,14 @@ TestToolsHierarchicalClassification: nncf: number_of_fakequantizers: 124 ptq: - number_of_fakequantizers: 76 + number_of_fakequantizers: 92 TestToolsMultiClassClassification: nncf: number_of_fakequantizers: 124 ptq: - number_of_fakequantizers: 76 + number_of_fakequantizers: 92 TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 126 ptq: - number_of_fakequantizers: 78 + number_of_fakequantizers: 97 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml index fdcec70cf55..13c4551a3fc 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml @@ -12,4 +12,4 @@ TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 93 ptq: - number_of_fakequantizers: 135 + number_of_fakequantizers: 138 diff --git a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml index c0f1a662f43..ed9ad16aa47 100644 --- a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml +++ b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml @@ -1,14 +1,14 @@ TestToolsOTXInstanceSegmentation: nncf: number_of_fakequantizers: 204 - ptq: - number_of_fakequantizers: 137 pot: number_of_fakequantizers: 137 + ptq: + number_of_fakequantizers: 160 TestToolsTilingInstanceSegmentation: nncf: number_of_fakequantizers: 204 - ptq: - number_of_fakequantizers: 137 pot: number_of_fakequantizers: 137 + ptq: + number_of_fakequantizers: 160 diff --git a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml index b33253d9b42..5e78888bffc 100644 --- a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml +++ b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml @@ -1,14 +1,14 @@ TestToolsOTXInstanceSegmentation: nncf: number_of_fakequantizers: 97 - ptq: - number_of_fakequantizers: 99 pot: number_of_fakequantizers: 99 + ptq: + number_of_fakequantizers: 99 TestToolsTilingInstanceSegmentation: nncf: number_of_fakequantizers: 97 - ptq: - number_of_fakequantizers: 99 pot: number_of_fakequantizers: 99 + ptq: + number_of_fakequantizers: 99 diff --git a/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml b/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml index c7b1157342a..ccc409483e6 100644 --- a/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml +++ b/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsOTXSegmentation: nncf: number_of_fakequantizers: 1138 ptq: - number_of_fakequantizers: 942 + number_of_fakequantizers: 1026 From 8926c51990efa81b40b8d0226348c12600da3cdc Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Wed, 29 Nov 2023 04:57:42 +0900 Subject: [PATCH 08/19] Exclude nncf from upgrade --- requirements/openvino.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/openvino.txt b/requirements/openvino.txt index c77e9981128..1496805fc8d 100644 --- a/requirements/openvino.txt +++ b/requirements/openvino.txt @@ -1,6 +1,6 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # OpenVINO Requirements. # -nncf==2.7.0 +nncf==2.6.0 onnx==1.13.0 openvino-model-api==0.1.7 openvino==2023.2.0 From f904c0cbe144a2792e51eae67e4d49ca4dec6eb4 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Wed, 29 Nov 2023 04:58:38 +0900 Subject: [PATCH 09/19] Revert "Update NNCF configs for IS models" This reverts commit 7c8db8cc0b5e5183b621b82c2bd4225de694558b. --- .../convnext_maskrcnn/compression_config.json | 5 ----- .../efficientnetb2b_maskrcnn/compression_config.json | 5 ----- .../maskrcnn_swin_t/compression_config.json | 5 ----- .../resnet50_maskrcnn/compression_config.json | 5 ----- 4 files changed, 20 deletions(-) diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json index c88a5c2744e..7e0cba46aa9 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json @@ -20,11 +20,6 @@ "algorithm": "quantization", "initializer": { "range": { - "type": "percentile", - "params": { - "min_percentile": 0, - "max_percentile": 100 - }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json index c88a5c2744e..7e0cba46aa9 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json @@ -20,11 +20,6 @@ "algorithm": "quantization", "initializer": { "range": { - "type": "percentile", - "params": { - "min_percentile": 0, - "max_percentile": 100 - }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json index c8b0d164aa9..29ac4407c10 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json @@ -20,11 +20,6 @@ "algorithm": "quantization", "initializer": { "range": { - "type": "percentile", - "params": { - "min_percentile": 0, - "max_percentile": 100 - }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json index af3c5ef8937..ab687b9c6a2 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json @@ -20,11 +20,6 @@ "algorithm": "quantization", "initializer": { "range": { - "type": "percentile", - "params": { - "min_percentile": 0, - "max_percentile": 100 - }, "num_init_samples": 1000 }, "batchnorm_adaptation": { From 005c1daa4f3c27ce09838a463c246d90ce163126 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Wed, 29 Nov 2023 04:58:45 +0900 Subject: [PATCH 10/19] Revert "Update more fqs" This reverts commit 5b91c329666632645606d5c42cf41cf268e4063a. --- .../compressed_model.yml | 6 +++--- .../compressed_model.yml | 6 +++--- .../compressed_model.yml | 2 +- .../compressed_model.yml | 8 ++++---- .../compressed_model.yml | 8 ++++---- .../compressed_model.yml | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml index 4412b7bee5c..ee44bed9abb 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml @@ -2,14 +2,14 @@ TestToolsHierarchicalClassification: nncf: number_of_fakequantizers: 267 ptq: - number_of_fakequantizers: 207 + number_of_fakequantizers: 177 TestToolsMultiClassClassification: nncf: number_of_fakequantizers: 267 ptq: - number_of_fakequantizers: 207 + number_of_fakequantizers: 177 TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 269 ptq: - number_of_fakequantizers: 212 + number_of_fakequantizers: 179 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml index c86a2d8de29..27616d54b5a 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml @@ -2,14 +2,14 @@ TestToolsHierarchicalClassification: nncf: number_of_fakequantizers: 124 ptq: - number_of_fakequantizers: 92 + number_of_fakequantizers: 76 TestToolsMultiClassClassification: nncf: number_of_fakequantizers: 124 ptq: - number_of_fakequantizers: 92 + number_of_fakequantizers: 76 TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 126 ptq: - number_of_fakequantizers: 97 + number_of_fakequantizers: 78 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml index 13c4551a3fc..fdcec70cf55 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml @@ -12,4 +12,4 @@ TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 93 ptq: - number_of_fakequantizers: 138 + number_of_fakequantizers: 135 diff --git a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml index ed9ad16aa47..c0f1a662f43 100644 --- a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml +++ b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml @@ -1,14 +1,14 @@ TestToolsOTXInstanceSegmentation: nncf: number_of_fakequantizers: 204 + ptq: + number_of_fakequantizers: 137 pot: number_of_fakequantizers: 137 - ptq: - number_of_fakequantizers: 160 TestToolsTilingInstanceSegmentation: nncf: number_of_fakequantizers: 204 + ptq: + number_of_fakequantizers: 137 pot: number_of_fakequantizers: 137 - ptq: - number_of_fakequantizers: 160 diff --git a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml index 5e78888bffc..b33253d9b42 100644 --- a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml +++ b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml @@ -1,14 +1,14 @@ TestToolsOTXInstanceSegmentation: nncf: number_of_fakequantizers: 97 - pot: - number_of_fakequantizers: 99 ptq: number_of_fakequantizers: 99 + pot: + number_of_fakequantizers: 99 TestToolsTilingInstanceSegmentation: nncf: number_of_fakequantizers: 97 - pot: - number_of_fakequantizers: 99 ptq: number_of_fakequantizers: 99 + pot: + number_of_fakequantizers: 99 diff --git a/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml b/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml index ccc409483e6..c7b1157342a 100644 --- a/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml +++ b/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsOTXSegmentation: nncf: number_of_fakequantizers: 1138 ptq: - number_of_fakequantizers: 1026 + number_of_fakequantizers: 942 From d23f33dc9fa4f4689fa93afa9a86805417101ea0 Mon Sep 17 00:00:00 2001 From: Vladisalv Sovrasov Date: Tue, 28 Nov 2023 20:19:33 +0900 Subject: [PATCH 11/19] Revert "Exclude nncf from upgrade" This reverts commit 8926c51990efa81b40b8d0226348c12600da3cdc. --- requirements/openvino.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/openvino.txt b/requirements/openvino.txt index 1496805fc8d..c77e9981128 100644 --- a/requirements/openvino.txt +++ b/requirements/openvino.txt @@ -1,6 +1,6 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # OpenVINO Requirements. # -nncf==2.6.0 +nncf==2.7.0 onnx==1.13.0 openvino-model-api==0.1.7 openvino==2023.2.0 From b784955e794b8ad1fbccaf123ca392074208d37d Mon Sep 17 00:00:00 2001 From: Vladisalv Sovrasov Date: Thu, 30 Nov 2023 01:58:42 +0900 Subject: [PATCH 12/19] Update FQs --- .../ote_anomaly_classification_stfpm/compressed_model.yml | 2 +- .../ote_anomaly_detection_stfpm/compressed_model.yml | 2 +- .../ote_anomaly_segmentation_stfpm/compressed_model.yml | 2 +- .../compressed_model.yml | 6 +++--- .../compressed_model.yml | 6 +++--- .../compressed_model.yml | 2 +- .../compressed_model.yml | 8 ++++---- .../compressed_model.yml | 8 ++++---- .../compressed_model.yml | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml b/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml index 6ec6d39b3a0..310552cc96a 100644 --- a/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml +++ b/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsAnomalyClassification: nncf: number_of_fakequantizers: 55 ptq: - number_of_fakequantizers: 71 + number_of_fakequantizers: 103 diff --git a/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml b/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml index 820c728804c..146ff5c3bd1 100644 --- a/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml +++ b/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsAnomalyDetection: nncf: number_of_fakequantizers: 55 ptq: - number_of_fakequantizers: 71 + number_of_fakequantizers: 103 diff --git a/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml b/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml index 866780cae46..0070cc0c1f3 100644 --- a/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml +++ b/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsAnomalySegmentation: nncf: number_of_fakequantizers: 55 ptq: - number_of_fakequantizers: 71 + number_of_fakequantizers: 103 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml index ee44bed9abb..4412b7bee5c 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml @@ -2,14 +2,14 @@ TestToolsHierarchicalClassification: nncf: number_of_fakequantizers: 267 ptq: - number_of_fakequantizers: 177 + number_of_fakequantizers: 207 TestToolsMultiClassClassification: nncf: number_of_fakequantizers: 267 ptq: - number_of_fakequantizers: 177 + number_of_fakequantizers: 207 TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 269 ptq: - number_of_fakequantizers: 179 + number_of_fakequantizers: 212 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml index 27616d54b5a..c86a2d8de29 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml @@ -2,14 +2,14 @@ TestToolsHierarchicalClassification: nncf: number_of_fakequantizers: 124 ptq: - number_of_fakequantizers: 76 + number_of_fakequantizers: 92 TestToolsMultiClassClassification: nncf: number_of_fakequantizers: 124 ptq: - number_of_fakequantizers: 76 + number_of_fakequantizers: 92 TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 126 ptq: - number_of_fakequantizers: 78 + number_of_fakequantizers: 97 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml index fdcec70cf55..13c4551a3fc 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml @@ -12,4 +12,4 @@ TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 93 ptq: - number_of_fakequantizers: 135 + number_of_fakequantizers: 138 diff --git a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml index c0f1a662f43..ed9ad16aa47 100644 --- a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml +++ b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B/compressed_model.yml @@ -1,14 +1,14 @@ TestToolsOTXInstanceSegmentation: nncf: number_of_fakequantizers: 204 - ptq: - number_of_fakequantizers: 137 pot: number_of_fakequantizers: 137 + ptq: + number_of_fakequantizers: 160 TestToolsTilingInstanceSegmentation: nncf: number_of_fakequantizers: 204 - ptq: - number_of_fakequantizers: 137 pot: number_of_fakequantizers: 137 + ptq: + number_of_fakequantizers: 160 diff --git a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml index b33253d9b42..5e78888bffc 100644 --- a/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml +++ b/tests/e2e/cli/instance_segmentation/reference/Custom_Counting_Instance_Segmentation_MaskRCNN_ResNet50/compressed_model.yml @@ -1,14 +1,14 @@ TestToolsOTXInstanceSegmentation: nncf: number_of_fakequantizers: 97 - ptq: - number_of_fakequantizers: 99 pot: number_of_fakequantizers: 99 + ptq: + number_of_fakequantizers: 99 TestToolsTilingInstanceSegmentation: nncf: number_of_fakequantizers: 97 - ptq: - number_of_fakequantizers: 99 pot: number_of_fakequantizers: 99 + ptq: + number_of_fakequantizers: 99 diff --git a/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml b/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml index c7b1157342a..ccc409483e6 100644 --- a/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml +++ b/tests/e2e/cli/semantic_segmentation/reference/Custom_Semantic_Segmentation_Lite-HRNet-x-mod3_OCR/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsOTXSegmentation: nncf: number_of_fakequantizers: 1138 ptq: - number_of_fakequantizers: 942 + number_of_fakequantizers: 1026 From 4767217e5c34e265b6928820315f92eff0033ecf Mon Sep 17 00:00:00 2001 From: Vladisalv Sovrasov Date: Thu, 30 Nov 2023 02:58:21 +0900 Subject: [PATCH 13/19] Revert "Revert "Update NNCF configs for IS models"" This reverts commit f904c0cbe144a2792e51eae67e4d49ca4dec6eb4. --- .../convnext_maskrcnn/compression_config.json | 5 +++++ .../efficientnetb2b_maskrcnn/compression_config.json | 5 +++++ .../maskrcnn_swin_t/compression_config.json | 5 +++++ .../resnet50_maskrcnn/compression_config.json | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json index 7e0cba46aa9..c88a5c2744e 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/convnext_maskrcnn/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json index 7e0cba46aa9..c88a5c2744e 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json index 29ac4407c10..c8b0d164aa9 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/maskrcnn_swin_t/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { diff --git a/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json b/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json index ab687b9c6a2..af3c5ef8937 100644 --- a/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json +++ b/src/otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/compression_config.json @@ -20,6 +20,11 @@ "algorithm": "quantization", "initializer": { "range": { + "type": "percentile", + "params": { + "min_percentile": 0, + "max_percentile": 100 + }, "num_init_samples": 1000 }, "batchnorm_adaptation": { From 7b33fd47a02fded0d869757f42f582b241d39ada Mon Sep 17 00:00:00 2001 From: Vladisalv Sovrasov Date: Mon, 4 Dec 2023 22:34:42 +0900 Subject: [PATCH 14/19] Disable explain for NNCF detection task --- src/otx/algorithms/detection/adapters/mmdet/task.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/otx/algorithms/detection/adapters/mmdet/task.py b/src/otx/algorithms/detection/adapters/mmdet/task.py index e5afcbb864e..0c8de8ce47a 100644 --- a/src/otx/algorithms/detection/adapters/mmdet/task.py +++ b/src/otx/algorithms/detection/adapters/mmdet/task.py @@ -309,6 +309,8 @@ def _infer_model( dump_features = True dump_saliency_map = not inference_parameters.is_evaluation if inference_parameters else True + if isinstance(self, NNCFBaseTask): + dump_saliency_map = False self._init_task() From 00374c3cfd0b575a854a0c6ded12dd9109112111 Mon Sep 17 00:00:00 2001 From: Vladisalv Sovrasov Date: Wed, 6 Dec 2023 02:17:43 +0900 Subject: [PATCH 15/19] Update FQs for anomaly --- .../ote_anomaly_classification_stfpm/compressed_model.yml | 2 +- .../reference/ote_anomaly_detection_stfpm/compressed_model.yml | 2 +- .../ote_anomaly_segmentation_stfpm/compressed_model.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml b/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml index 310552cc96a..6ec6d39b3a0 100644 --- a/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml +++ b/tests/e2e/cli/anomaly/reference/ote_anomaly_classification_stfpm/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsAnomalyClassification: nncf: number_of_fakequantizers: 55 ptq: - number_of_fakequantizers: 103 + number_of_fakequantizers: 71 diff --git a/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml b/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml index 146ff5c3bd1..820c728804c 100644 --- a/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml +++ b/tests/e2e/cli/anomaly/reference/ote_anomaly_detection_stfpm/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsAnomalyDetection: nncf: number_of_fakequantizers: 55 ptq: - number_of_fakequantizers: 103 + number_of_fakequantizers: 71 diff --git a/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml b/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml index 0070cc0c1f3..866780cae46 100644 --- a/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml +++ b/tests/e2e/cli/anomaly/reference/ote_anomaly_segmentation_stfpm/compressed_model.yml @@ -2,4 +2,4 @@ TestToolsAnomalySegmentation: nncf: number_of_fakequantizers: 55 ptq: - number_of_fakequantizers: 103 + number_of_fakequantizers: 71 From 22b0ee0d5297ce23287b989025c8fc4162d72f10 Mon Sep 17 00:00:00 2001 From: Vladisalv Sovrasov Date: Wed, 6 Dec 2023 02:28:57 +0900 Subject: [PATCH 16/19] Update cls FQs --- .../compressed_model.yml | 2 +- .../compressed_model.yml | 2 +- .../compressed_model.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml index 4412b7bee5c..d234c15bd70 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficientNet-V2-S/compressed_model.yml @@ -12,4 +12,4 @@ TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 269 ptq: - number_of_fakequantizers: 212 + number_of_fakequantizers: 209 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml index c86a2d8de29..ebea5aac8b2 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_EfficinetNet-B0/compressed_model.yml @@ -12,4 +12,4 @@ TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 126 ptq: - number_of_fakequantizers: 97 + number_of_fakequantizers: 94 diff --git a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml index 13c4551a3fc..fdcec70cf55 100644 --- a/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml +++ b/tests/e2e/cli/classification/reference/Custom_Image_Classification_MobileNet-V3-large-1x/compressed_model.yml @@ -12,4 +12,4 @@ TestToolsMultilabelClassification: nncf: number_of_fakequantizers: 93 ptq: - number_of_fakequantizers: 138 + number_of_fakequantizers: 135 From 2988fdc51ef7e4a136a9d4e09602b3844d7bafec Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Sat, 9 Dec 2023 03:28:01 +0900 Subject: [PATCH 17/19] Update datumaro --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index ab8a87e48dc..1d0547987d4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -4,7 +4,7 @@ natsort==8.1.* prettytable==3.9.* protobuf==3.20.* pyyaml -datumaro @ git+https://github.com/sovrasov/datumaro/@acc79a32e82c335af01a0b733c06e824b423771c#egg=datumaro +datumaro @ git+https://github.com/openvinotoolkit/datumaro/@3782380de8788dabd32eb18e872d4d075f934e8e#egg=datumaro psutil==5.9.* scipy==1.10.* bayesian-optimization==1.4.* From 045840fc812c0a1b8be350dac01f34f45127369d Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Sat, 9 Dec 2023 03:29:55 +0900 Subject: [PATCH 18/19] Update exportable code requirements --- src/otx/api/usecases/exportable_code/demo/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/otx/api/usecases/exportable_code/demo/requirements.txt b/src/otx/api/usecases/exportable_code/demo/requirements.txt index 0d011ecd407..bf94f349fda 100644 --- a/src/otx/api/usecases/exportable_code/demo/requirements.txt +++ b/src/otx/api/usecases/exportable_code/demo/requirements.txt @@ -1,4 +1,4 @@ openvino==2023.2.0 openvino-model-api==0.1.7 -otx @ git+https://github.com/openvinotoolkit/training_extensions/@2558665c490e5338bcb8ba4eb4e2bca1fd08e28e#egg=otx +otx @ git+https://github.com/openvinotoolkit/training_extensions/@2988fdc51ef7e4a136a9d4e09602b3844d7bafec#egg=otx numpy>=1.21.0,<=1.23.5 # np.bool was removed in 1.24.0 which was used in openvino runtime From cd16f52d69d9521dad8d99c042c8e34ee54df761 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Fri, 15 Dec 2023 12:01:37 +0900 Subject: [PATCH 19/19] Add unit test to cover the changes --- .../adapters/mmdet/nncf/test_task.py | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/unit/algorithms/detection/adapters/mmdet/nncf/test_task.py b/tests/unit/algorithms/detection/adapters/mmdet/nncf/test_task.py index 5a543d59d0b..b000a0f7eca 100644 --- a/tests/unit/algorithms/detection/adapters/mmdet/nncf/test_task.py +++ b/tests/unit/algorithms/detection/adapters/mmdet/nncf/test_task.py @@ -2,7 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 # +from contextlib import nullcontext import os +from unittest.mock import MagicMock import numpy as np import pytest @@ -11,11 +13,13 @@ from otx.algorithms.common.adapters.mmcv.hooks import OTXLoggerHook from otx.algorithms.detection.adapters.mmdet.nncf.task import DetectionNNCFTask from otx.api.configuration.helper import create +from otx.api.entities.inference_parameters import InferenceParameters from otx.api.entities.metrics import NullPerformance, Performance, ScoreMetric from otx.api.entities.model_template import TaskType, parse_model_template from otx.api.usecases.evaluation.metrics_helper import MetricsHelper from otx.api.usecases.tasks.interfaces.optimization_interface import OptimizationType from tests.test_suite.e2e_test_system import e2e_pytest_unit +from tests.unit.algorithms.detection.adapters.mmdet.test_task import MockDataLoader, MockDataset from tests.unit.algorithms.detection.test_helpers import ( DEFAULT_DET_TEMPLATE_DIR, generate_det_dataset, @@ -31,6 +35,7 @@ def setup(self, otx_model, tmp_dir_path) -> None: task_env = init_environment(hyper_parameters, model_template) self.model = otx_model self.det_nncf_task = DetectionNNCFTask(task_env, output_path=str(tmp_dir_path)) + self.dataset, _ = generate_det_dataset(task_type=TaskType.DETECTION) @e2e_pytest_unit def test_save_model(self, mocker): @@ -58,7 +63,6 @@ def test_save_model(self, mocker): @e2e_pytest_unit def test_optimize(self, mocker): """Test optimize method in OTXDetTaskNNCF.""" - self.dataset, _ = generate_det_dataset(task_type=TaskType.DETECTION) mock_lcurve_val = OTXLoggerHook.Curve() mock_lcurve_val.x = [0, 1] mock_lcurve_val.y = [0.1, 0.2] @@ -88,6 +92,38 @@ def test_optimize(self, mocker): assert self.model.performance != NullPerformance() assert self.model.performance.score.value == 0.1 + @e2e_pytest_unit + def test_infer(self, mocker) -> None: + """Test infer function.""" + + mocker.patch( + "otx.algorithms.detection.adapters.mmdet.nncf.task.build_nncf_detector", + return_value=(None, MagicMock()), + ) + mocker.patch( + "otx.algorithms.common.adapters.mmcv.utils.builder.build_dataset", + return_value=MockDataset(self.dataset, "det"), + ) + mocker.patch( + "otx.algorithms.common.adapters.mmcv.utils.builder.build_dataloader", + return_value=MockDataLoader(self.dataset), + ) + mocker.patch( + "otx.algorithms.detection.adapters.mmdet.task.single_gpu_test", + return_value=[ + np.array([np.array([[0, 0, 1, 1, 0.1]]), np.array([[0, 0, 1, 1, 0.2]]), np.array([[0, 0, 1, 1, 0.7]])]) + ], + ) + mocker.patch( + "otx.algorithms.detection.adapters.mmdet.task.FeatureVectorHook", + return_value=nullcontext(), + ) + + inference_parameters = InferenceParameters(is_evaluation=True) + outputs = self.det_nncf_task.infer(self.dataset, inference_parameters) + for output in outputs: + assert output.get_annotations()[-1].get_labels()[0].probability == 0.7 + @e2e_pytest_unit def test_initialize(self, mocker): """Test initialize method in OTXDetTaskNNCF."""