Skip to content

Commit

Permalink
Merge pull request #1105 from openvinotoolkit/sstrehlk/anomaly_templa…
Browse files Browse the repository at this point in the history
…tes_directories_structure_changed

sstrehlk/Changed directories structure for anomaly templates.
  • Loading branch information
sstrehlk authored May 17, 2022
2 parents db05702 + 7b567b3 commit c49a6fd
Show file tree
Hide file tree
Showing 44 changed files with 13 additions and 64 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 6 additions & 6 deletions external/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions external/anomaly/anomaly_classification/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions external/anomaly/anomaly_detection/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions external/anomaly/anomaly_segmentation/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion external/anomaly/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
logger.debug(f"overloaded ote_templates_root_dir_fx: return {root}")
return root

Expand Down
6 changes: 3 additions & 3 deletions external/anomaly/tests/test_configurable_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions external/anomaly/tools/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit c49a6fd

Please sign in to comment.