From 35ae08a2d113ff9ee0cbc45e920a938d1e53402f Mon Sep 17 00:00:00 2001 From: Slawomir Strehlke Date: Fri, 13 May 2022 15:20:48 +0200 Subject: [PATCH 1/4] Changed directories structure for anomaly templates. --- CONTRIBUTING.md | 2 +- external/README.md | 12 ++++++------ .../anomaly/anomaly_classification/__init__.py | 17 ----------------- external/anomaly/anomaly_detection/__init__.py | 17 ----------------- .../anomaly/anomaly_segmentation/__init__.py | 17 ----------------- .../anomaly_classification}/__init__.py | 0 .../anomaly_classification}/padim/__init__.py | 0 .../padim/compression_config.json | 0 .../padim/configuration.py | 0 .../padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../anomaly_classification}/padim/template.yaml | 0 .../anomaly_classification}/stfpm/__init__.py | 0 .../stfpm/compression_config.json | 0 .../stfpm/configuration.py | 0 .../stfpm/configuration.yaml | 0 .../anomaly_classification}/stfpm/template.yaml | 0 .../anomaly_detection}/__init__.py | 0 .../anomaly_detection}/padim/__init__.py | 0 .../padim/compression_config.json | 0 .../anomaly_detection}/padim/configuration.py | 0 .../anomaly_detection}/padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../anomaly_detection}/padim/template.yaml | 0 .../anomaly_detection}/stfpm/__init__.py | 0 .../stfpm/compression_config.json | 0 .../anomaly_detection}/stfpm/configuration.py | 0 .../anomaly_detection}/stfpm/configuration.yaml | 0 .../anomaly_detection}/stfpm/template.yaml | 0 .../anomaly_segmentation}/__init__.py | 0 .../anomaly_segmentation}/padim/__init__.py | 0 .../padim/compression_config.json | 0 .../padim/configuration.py | 0 .../padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../anomaly_segmentation}/padim/template.yaml | 0 .../anomaly_segmentation}/stfpm/__init__.py | 0 .../stfpm/compression_config.json | 0 .../stfpm/configuration.py | 0 .../stfpm/configuration.yaml | 0 .../anomaly_segmentation}/stfpm/template.yaml | 0 external/anomaly/tests/conftest.py | 2 +- external/anomaly/tools/sample.py | 4 ++-- 43 files changed, 10 insertions(+), 61 deletions(-) delete mode 100644 external/anomaly/anomaly_classification/__init__.py delete mode 100644 external/anomaly/anomaly_detection/__init__.py delete mode 100644 external/anomaly/anomaly_segmentation/__init__.py rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/__init__.py (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/padim/__init__.py (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/padim/compression_config.json (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/padim/configuration.py (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/padim/configuration.yaml (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/padim/pot_optimization_config.json (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/padim/template.yaml (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/stfpm/__init__.py (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/stfpm/compression_config.json (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/stfpm/configuration.py (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/stfpm/configuration.yaml (100%) rename external/anomaly/{anomaly_classification/configs => configs/anomaly_classification}/stfpm/template.yaml (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/__init__.py (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/padim/__init__.py (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/padim/compression_config.json (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/padim/configuration.py (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/padim/configuration.yaml (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/padim/pot_optimization_config.json (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/padim/template.yaml (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/stfpm/__init__.py (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/stfpm/compression_config.json (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/stfpm/configuration.py (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/stfpm/configuration.yaml (100%) rename external/anomaly/{anomaly_detection/configs => configs/anomaly_detection}/stfpm/template.yaml (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/__init__.py (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/padim/__init__.py (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/padim/compression_config.json (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/padim/configuration.py (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/padim/configuration.yaml (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/padim/pot_optimization_config.json (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/padim/template.yaml (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/stfpm/__init__.py (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/stfpm/compression_config.json (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/stfpm/configuration.py (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/stfpm/configuration.yaml (100%) rename external/anomaly/{anomaly_segmentation/configs => configs/anomaly_segmentation}/stfpm/template.yaml (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6e3707d66f..93b8fa96175 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ If you want to add training code of your model to this repository, make sure: 1. [IInferenceTask](https://github.com/openvinotoolkit/training_extensions/blob/develop/ote_sdk/ote_sdk/usecases/tasks/interfaces/inference_interface.py) - your model must be inferable on some datasets. 1. [IEvaluationTask](https://github.com/openvinotoolkit/training_extensions/blob/develop/ote_sdk/ote_sdk/usecases/tasks/interfaces/evaluate_interface.py) - it must be possible to evaluate some quality metric of you model. 1. [IExportTask](https://github.com/openvinotoolkit/training_extensions/blob/develop/ote_sdk/ote_sdk/usecases/tasks/interfaces/export_interface.py) - your model must be exportable to the OpenVINO format. -4. You provide a model `template.yaml` file, that describes your model and its configurable parameters. See an example [here](external/anomaly/anomaly_classification/configs/padim/template.yaml). +4. You provide a model `template.yaml` file, that describes your model and its configurable parameters. See an example [here](external/anomaly/configs/anomaly_classification/padim/template.yaml). 5. You create a PR to the `develop` branch. 6. You provide `requirements.txt` file and a bash `init_venv.sh` script for creating virtual environment. diff --git a/external/README.md b/external/README.md index 78174737e3d..b3ee13a3057 100644 --- a/external/README.md +++ b/external/README.md @@ -6,20 +6,20 @@ Every sub-project is fully indepedent from each other, and each of them has its ## Anomaly Classification ID | Name | Complexity (GFlops) | Model size (MB) | Path ------- | ------- | ------- | ------- | ------- -ote_anomaly_classification_padim | PADIM | 3.9 | 168.4 | anomaly/anomaly_classification/configs/padim/template.yaml -ote_anomaly_classification_stfpm | STFPM | 5.6 | 21.1 | anomaly/anomaly_classification/configs/stfpm/template.yaml +ote_anomaly_classification_padim | PADIM | 3.9 | 168.4 | anomaly/configs/anomaly_classification/padim/template.yaml +ote_anomaly_classification_stfpm | STFPM | 5.6 | 21.1 | anomaly/configs/anomaly_classification/stfpm/template.yaml ## Anomaly Detection ID | Name | Complexity (GFlops) | Model size (MB) | Path ------- | ------- | ------- | ------- | ------- -ote_anomaly_detection_padim | PADIM | 3.9 | 168.4 | anomaly/anomaly_detection/configs/padim/template.yaml -ote_anomaly_detection_stfpm | STFPM | 5.6 | 21.1 | anomaly/anomaly_detection/configs/stfpm/template.yaml +ote_anomaly_detection_padim | PADIM | 3.9 | 168.4 | anomaly/configs/anomaly_detection/padim/template.yaml +ote_anomaly_detection_stfpm | STFPM | 5.6 | 21.1 | anomaly/configs/anomaly_detection/stfpm/template.yaml ## Anomaly Segmentation ID | Name | Complexity (GFlops) | Model size (MB) | Path ------- | ------- | ------- | ------- | ------- -ote_anomaly_segmentation_padim | PADIM | 3.9 | 168.4 | anomaly/anomaly_segmentation/configs/padim/template.yaml -ote_anomaly_segmentation_stfpm | STFPM | 5.6 | 21.1 | anomaly/anomaly_segmentation/configs/stfpm/template.yaml +ote_anomaly_segmentation_padim | PADIM | 3.9 | 168.4 | anomaly/configs/anomaly_segmentation/padim/template.yaml +ote_anomaly_segmentation_stfpm | STFPM | 5.6 | 21.1 | anomaly/configs/anomaly_segmentation/stfpm/template.yaml ## Image Classification ID | Name | Complexity (GFlops) | Model size (MB) | Path diff --git a/external/anomaly/anomaly_classification/__init__.py b/external/anomaly/anomaly_classification/__init__.py deleted file mode 100644 index 9db5f0d8b62..00000000000 --- a/external/anomaly/anomaly_classification/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Initialization of Anomaly Classification Tasks -""" - -# Copyright (C) 2021 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions -# and limitations under the License. diff --git a/external/anomaly/anomaly_detection/__init__.py b/external/anomaly/anomaly_detection/__init__.py deleted file mode 100644 index 3e4ff64a92f..00000000000 --- a/external/anomaly/anomaly_detection/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Initialization of Anomaly Detection Tasks -""" - -# Copyright (C) 2021 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions -# and limitations under the License. diff --git a/external/anomaly/anomaly_segmentation/__init__.py b/external/anomaly/anomaly_segmentation/__init__.py deleted file mode 100644 index 3b0bced5886..00000000000 --- a/external/anomaly/anomaly_segmentation/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Initialization of Anomaly Segmentation Tasks -""" - -# Copyright (C) 2021 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions -# and limitations under the License. diff --git a/external/anomaly/anomaly_classification/configs/__init__.py b/external/anomaly/configs/anomaly_classification/__init__.py similarity index 100% rename from external/anomaly/anomaly_classification/configs/__init__.py rename to external/anomaly/configs/anomaly_classification/__init__.py diff --git a/external/anomaly/anomaly_classification/configs/padim/__init__.py b/external/anomaly/configs/anomaly_classification/padim/__init__.py similarity index 100% rename from external/anomaly/anomaly_classification/configs/padim/__init__.py rename to external/anomaly/configs/anomaly_classification/padim/__init__.py diff --git a/external/anomaly/anomaly_classification/configs/padim/compression_config.json b/external/anomaly/configs/anomaly_classification/padim/compression_config.json similarity index 100% rename from external/anomaly/anomaly_classification/configs/padim/compression_config.json rename to external/anomaly/configs/anomaly_classification/padim/compression_config.json diff --git a/external/anomaly/anomaly_classification/configs/padim/configuration.py b/external/anomaly/configs/anomaly_classification/padim/configuration.py similarity index 100% rename from external/anomaly/anomaly_classification/configs/padim/configuration.py rename to external/anomaly/configs/anomaly_classification/padim/configuration.py diff --git a/external/anomaly/anomaly_classification/configs/padim/configuration.yaml b/external/anomaly/configs/anomaly_classification/padim/configuration.yaml similarity index 100% rename from external/anomaly/anomaly_classification/configs/padim/configuration.yaml rename to external/anomaly/configs/anomaly_classification/padim/configuration.yaml diff --git a/external/anomaly/anomaly_classification/configs/padim/pot_optimization_config.json b/external/anomaly/configs/anomaly_classification/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/anomaly_classification/configs/padim/pot_optimization_config.json rename to external/anomaly/configs/anomaly_classification/padim/pot_optimization_config.json diff --git a/external/anomaly/anomaly_classification/configs/padim/template.yaml b/external/anomaly/configs/anomaly_classification/padim/template.yaml similarity index 100% rename from external/anomaly/anomaly_classification/configs/padim/template.yaml rename to external/anomaly/configs/anomaly_classification/padim/template.yaml diff --git a/external/anomaly/anomaly_classification/configs/stfpm/__init__.py b/external/anomaly/configs/anomaly_classification/stfpm/__init__.py similarity index 100% rename from external/anomaly/anomaly_classification/configs/stfpm/__init__.py rename to external/anomaly/configs/anomaly_classification/stfpm/__init__.py diff --git a/external/anomaly/anomaly_classification/configs/stfpm/compression_config.json b/external/anomaly/configs/anomaly_classification/stfpm/compression_config.json similarity index 100% rename from external/anomaly/anomaly_classification/configs/stfpm/compression_config.json rename to external/anomaly/configs/anomaly_classification/stfpm/compression_config.json diff --git a/external/anomaly/anomaly_classification/configs/stfpm/configuration.py b/external/anomaly/configs/anomaly_classification/stfpm/configuration.py similarity index 100% rename from external/anomaly/anomaly_classification/configs/stfpm/configuration.py rename to external/anomaly/configs/anomaly_classification/stfpm/configuration.py diff --git a/external/anomaly/anomaly_classification/configs/stfpm/configuration.yaml b/external/anomaly/configs/anomaly_classification/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/anomaly_classification/configs/stfpm/configuration.yaml rename to external/anomaly/configs/anomaly_classification/stfpm/configuration.yaml diff --git a/external/anomaly/anomaly_classification/configs/stfpm/template.yaml b/external/anomaly/configs/anomaly_classification/stfpm/template.yaml similarity index 100% rename from external/anomaly/anomaly_classification/configs/stfpm/template.yaml rename to external/anomaly/configs/anomaly_classification/stfpm/template.yaml diff --git a/external/anomaly/anomaly_detection/configs/__init__.py b/external/anomaly/configs/anomaly_detection/__init__.py similarity index 100% rename from external/anomaly/anomaly_detection/configs/__init__.py rename to external/anomaly/configs/anomaly_detection/__init__.py diff --git a/external/anomaly/anomaly_detection/configs/padim/__init__.py b/external/anomaly/configs/anomaly_detection/padim/__init__.py similarity index 100% rename from external/anomaly/anomaly_detection/configs/padim/__init__.py rename to external/anomaly/configs/anomaly_detection/padim/__init__.py diff --git a/external/anomaly/anomaly_detection/configs/padim/compression_config.json b/external/anomaly/configs/anomaly_detection/padim/compression_config.json similarity index 100% rename from external/anomaly/anomaly_detection/configs/padim/compression_config.json rename to external/anomaly/configs/anomaly_detection/padim/compression_config.json diff --git a/external/anomaly/anomaly_detection/configs/padim/configuration.py b/external/anomaly/configs/anomaly_detection/padim/configuration.py similarity index 100% rename from external/anomaly/anomaly_detection/configs/padim/configuration.py rename to external/anomaly/configs/anomaly_detection/padim/configuration.py diff --git a/external/anomaly/anomaly_detection/configs/padim/configuration.yaml b/external/anomaly/configs/anomaly_detection/padim/configuration.yaml similarity index 100% rename from external/anomaly/anomaly_detection/configs/padim/configuration.yaml rename to external/anomaly/configs/anomaly_detection/padim/configuration.yaml diff --git a/external/anomaly/anomaly_detection/configs/padim/pot_optimization_config.json b/external/anomaly/configs/anomaly_detection/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/anomaly_detection/configs/padim/pot_optimization_config.json rename to external/anomaly/configs/anomaly_detection/padim/pot_optimization_config.json diff --git a/external/anomaly/anomaly_detection/configs/padim/template.yaml b/external/anomaly/configs/anomaly_detection/padim/template.yaml similarity index 100% rename from external/anomaly/anomaly_detection/configs/padim/template.yaml rename to external/anomaly/configs/anomaly_detection/padim/template.yaml diff --git a/external/anomaly/anomaly_detection/configs/stfpm/__init__.py b/external/anomaly/configs/anomaly_detection/stfpm/__init__.py similarity index 100% rename from external/anomaly/anomaly_detection/configs/stfpm/__init__.py rename to external/anomaly/configs/anomaly_detection/stfpm/__init__.py diff --git a/external/anomaly/anomaly_detection/configs/stfpm/compression_config.json b/external/anomaly/configs/anomaly_detection/stfpm/compression_config.json similarity index 100% rename from external/anomaly/anomaly_detection/configs/stfpm/compression_config.json rename to external/anomaly/configs/anomaly_detection/stfpm/compression_config.json diff --git a/external/anomaly/anomaly_detection/configs/stfpm/configuration.py b/external/anomaly/configs/anomaly_detection/stfpm/configuration.py similarity index 100% rename from external/anomaly/anomaly_detection/configs/stfpm/configuration.py rename to external/anomaly/configs/anomaly_detection/stfpm/configuration.py diff --git a/external/anomaly/anomaly_detection/configs/stfpm/configuration.yaml b/external/anomaly/configs/anomaly_detection/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/anomaly_detection/configs/stfpm/configuration.yaml rename to external/anomaly/configs/anomaly_detection/stfpm/configuration.yaml diff --git a/external/anomaly/anomaly_detection/configs/stfpm/template.yaml b/external/anomaly/configs/anomaly_detection/stfpm/template.yaml similarity index 100% rename from external/anomaly/anomaly_detection/configs/stfpm/template.yaml rename to external/anomaly/configs/anomaly_detection/stfpm/template.yaml diff --git a/external/anomaly/anomaly_segmentation/configs/__init__.py b/external/anomaly/configs/anomaly_segmentation/__init__.py similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/__init__.py rename to external/anomaly/configs/anomaly_segmentation/__init__.py diff --git a/external/anomaly/anomaly_segmentation/configs/padim/__init__.py b/external/anomaly/configs/anomaly_segmentation/padim/__init__.py similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/padim/__init__.py rename to external/anomaly/configs/anomaly_segmentation/padim/__init__.py diff --git a/external/anomaly/anomaly_segmentation/configs/padim/compression_config.json b/external/anomaly/configs/anomaly_segmentation/padim/compression_config.json similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/padim/compression_config.json rename to external/anomaly/configs/anomaly_segmentation/padim/compression_config.json diff --git a/external/anomaly/anomaly_segmentation/configs/padim/configuration.py b/external/anomaly/configs/anomaly_segmentation/padim/configuration.py similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/padim/configuration.py rename to external/anomaly/configs/anomaly_segmentation/padim/configuration.py diff --git a/external/anomaly/anomaly_segmentation/configs/padim/configuration.yaml b/external/anomaly/configs/anomaly_segmentation/padim/configuration.yaml similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/padim/configuration.yaml rename to external/anomaly/configs/anomaly_segmentation/padim/configuration.yaml diff --git a/external/anomaly/anomaly_segmentation/configs/padim/pot_optimization_config.json b/external/anomaly/configs/anomaly_segmentation/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/padim/pot_optimization_config.json rename to external/anomaly/configs/anomaly_segmentation/padim/pot_optimization_config.json diff --git a/external/anomaly/anomaly_segmentation/configs/padim/template.yaml b/external/anomaly/configs/anomaly_segmentation/padim/template.yaml similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/padim/template.yaml rename to external/anomaly/configs/anomaly_segmentation/padim/template.yaml diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/__init__.py b/external/anomaly/configs/anomaly_segmentation/stfpm/__init__.py similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/stfpm/__init__.py rename to external/anomaly/configs/anomaly_segmentation/stfpm/__init__.py diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/compression_config.json b/external/anomaly/configs/anomaly_segmentation/stfpm/compression_config.json similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/stfpm/compression_config.json rename to external/anomaly/configs/anomaly_segmentation/stfpm/compression_config.json diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.py b/external/anomaly/configs/anomaly_segmentation/stfpm/configuration.py similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/stfpm/configuration.py rename to external/anomaly/configs/anomaly_segmentation/stfpm/configuration.py diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.yaml b/external/anomaly/configs/anomaly_segmentation/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/stfpm/configuration.yaml rename to external/anomaly/configs/anomaly_segmentation/stfpm/configuration.yaml diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/template.yaml b/external/anomaly/configs/anomaly_segmentation/stfpm/template.yaml similarity index 100% rename from external/anomaly/anomaly_segmentation/configs/stfpm/template.yaml rename to external/anomaly/configs/anomaly_segmentation/stfpm/template.yaml diff --git a/external/anomaly/tests/conftest.py b/external/anomaly/tests/conftest.py index 427a5f6ee92..905208526c2 100644 --- a/external/anomaly/tests/conftest.py +++ b/external/anomaly/tests/conftest.py @@ -58,7 +58,7 @@ def ote_templates_root_dir_fx(): logger = logging.getLogger(__name__) root = osp.dirname(osp.dirname(osp.realpath(__file__))) - root = f"{root}/anomaly_classification/" + root = f"{root}/configs/anomaly_classification/" logger.debug(f"overloaded ote_templates_root_dir_fx: return {root}") return root diff --git a/external/anomaly/tools/sample.py b/external/anomaly/tools/sample.py index b79b5cf7ce0..72b7ad76118 100644 --- a/external/anomaly/tools/sample.py +++ b/external/anomaly/tools/sample.py @@ -76,7 +76,7 @@ def __init__( If MVTec dataset is placed under the above directory, then we could run, - >>> model_template_path = "./anomaly_classification/configs/padim/template.yaml" + >>> model_template_path = "./configs/anomaly_classification/padim/template.yaml" >>> dataset_path = "./datasets/MVTec" >>> seed = 0 >>> task = OteAnomalyTask( @@ -337,7 +337,7 @@ def parse_args() -> Namespace: ) parser.add_argument( "--model_template_path", - default="./anomaly_classification/configs/padim/template.yaml", + default="./configs/anomaly_classification/padim/template.yaml", ) parser.add_argument("--dataset_path", default="./datasets/MVTec") parser.add_argument("--category", default="bottle") From 0992ec1f1682a060ba7148c29693a9fe0adeea71 Mon Sep 17 00:00:00 2001 From: Slawomir Strehlke Date: Fri, 13 May 2022 15:30:27 +0200 Subject: [PATCH 2/4] Corrected path in ote_reference_root_dir_fx fixture for anomaly backend. --- external/anomaly/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/anomaly/tests/conftest.py b/external/anomaly/tests/conftest.py index 905208526c2..88dcec18cf3 100644 --- a/external/anomaly/tests/conftest.py +++ b/external/anomaly/tests/conftest.py @@ -58,7 +58,7 @@ def ote_templates_root_dir_fx(): logger = logging.getLogger(__name__) root = osp.dirname(osp.dirname(osp.realpath(__file__))) - root = f"{root}/configs/anomaly_classification/" + root = f"{root}/configs/" logger.debug(f"overloaded ote_templates_root_dir_fx: return {root}") return root From fa6af32a639300e01f3243003689ab35585760fa Mon Sep 17 00:00:00 2001 From: Slawomir Strehlke Date: Mon, 16 May 2022 14:16:06 +0200 Subject: [PATCH 3/4] Updated condition for models without "early_stopping" parameter. --- external/anomaly/tests/test_ote_training.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/anomaly/tests/test_ote_training.py b/external/anomaly/tests/test_ote_training.py index f868eb812e5..7db6b88ed1e 100644 --- a/external/anomaly/tests/test_ote_training.py +++ b/external/anomaly/tests/test_ote_training.py @@ -214,7 +214,7 @@ def _run_ote_training(self, data_collector): logger.debug("Set hyperparameters") params = ote_sdk_configuration_helper_create(self.model_template.hyper_parameters.data) - if hasattr(params, "model"): + if hasattr(params, "model") and hasattr(params.model, "early_stopping"): if self.num_training_iters != KEEP_CONFIG_FIELD_VALUE: params.model.early_stopping.patience = int(self.num_training_iters) logger.debug(f"Set params.model.early_stopping.patience=" f"{params.model.early_stopping.patience}") From 7b567b357dcc8284335448954312923515eeb96d Mon Sep 17 00:00:00 2001 From: Slawomir Strehlke Date: Tue, 17 May 2022 09:00:11 +0200 Subject: [PATCH 4/4] fixes related to modified paths. --- external/anomaly/tests/test_configurable_parameters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/external/anomaly/tests/test_configurable_parameters.py b/external/anomaly/tests/test_configurable_parameters.py index 281f2fb8815..f41a38afc87 100644 --- a/external/anomaly/tests/test_configurable_parameters.py +++ b/external/anomaly/tests/test_configurable_parameters.py @@ -20,8 +20,8 @@ import os import pytest -from anomaly_classification.configs.padim import PadimAnomalyClassificationConfig -from anomaly_classification.configs.stfpm import STFPMAnomalyClassificationConfig +from configs.anomaly_classification.padim import PadimAnomalyClassificationConfig +from configs.anomaly_classification.stfpm import STFPMAnomalyClassificationConfig from ote_anomalib.configs import get_anomalib_config from ote_sdk.configuration.helper import convert, create from tests.helpers.config import get_config_and_task_name @@ -35,7 +35,7 @@ ) def test_configuration_yaml(configurable_parameters, model_name): # assert that we can parse the template.yaml - template_file_path = os.path.join("anomaly_classification", "configs", model_name, "template.yaml") + template_file_path = os.path.join("configs", "anomaly_classification", model_name, "template.yaml") configuration_yaml_loaded, task_name = get_config_and_task_name(template_file_path) configuration = configurable_parameters()