From 815025a61bfe726d084a1f42f06487ebbf39b428 Mon Sep 17 00:00:00 2001 From: Ashwin Vaidya Date: Fri, 26 Aug 2022 09:56:52 +0200 Subject: [PATCH 1/6] Move configuration.yaml and associated files to tempates folder. --- .../draem/compression_config.json | 36 ++ .../classification/draem/configuration.yaml | 241 ++++++++++++++ .../draem/template_experimental.yaml | 2 +- .../draem/transform_config.yaml | 26 ++ .../padim/compression_config.json | 0 .../classification}/padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../stfpm/compression_config.json | 0 .../classification}/stfpm/configuration.yaml | 0 .../classification}/stfpm/hpo_config.yaml | 0 .../classification/stfpm/template.yaml | 2 +- .../detection/draem/compression_config.json | 36 ++ .../detection/draem/configuration.yaml | 241 ++++++++++++++ .../draem/template_experimental.yaml | 2 +- .../detection/draem/transform_config.yaml | 26 ++ .../detection/padim/compression_config.json | 40 +++ .../detection/padim/configuration.yaml | 183 ++++++++++ .../padim/pot_optimization_config.json | 18 + .../templates/detection/padim/template.yaml | 2 +- .../detection/stfpm/compression_config.json | 36 ++ .../detection/stfpm/configuration.yaml | 312 ++++++++++++++++++ .../templates/detection/stfpm/hpo_config.yaml | 18 + .../templates/detection/stfpm/template.yaml | 2 +- .../draem/compression_config.json | 36 ++ .../segmentation/draem/configuration.yaml | 241 ++++++++++++++ .../draem/template_experimental.yaml | 2 +- .../segmentation/draem/transform_config.yaml | 26 ++ .../padim/compression_config.json | 40 +++ .../segmentation/padim/configuration.yaml | 183 ++++++++++ .../padim/pot_optimization_config.json | 18 + .../segmentation/padim/template.yaml | 2 +- .../stfpm/compression_config.json | 36 ++ .../segmentation/stfpm/configuration.yaml | 312 ++++++++++++++++++ .../segmentation/stfpm/hpo_config.yaml | 18 + .../segmentation/stfpm/template.yaml | 2 +- 35 files changed, 2131 insertions(+), 8 deletions(-) create mode 100644 external/anomaly/templates/classification/draem/compression_config.json create mode 100644 external/anomaly/templates/classification/draem/configuration.yaml create mode 100644 external/anomaly/templates/classification/draem/transform_config.yaml rename external/anomaly/{configs => templates/classification}/padim/compression_config.json (100%) rename external/anomaly/{configs => templates/classification}/padim/configuration.yaml (100%) rename external/anomaly/{configs => templates/classification}/padim/pot_optimization_config.json (100%) rename external/anomaly/{configs => templates/classification}/stfpm/compression_config.json (100%) rename external/anomaly/{configs => templates/classification}/stfpm/configuration.yaml (100%) rename external/anomaly/{configs => templates/classification}/stfpm/hpo_config.yaml (100%) create mode 100644 external/anomaly/templates/detection/draem/compression_config.json create mode 100644 external/anomaly/templates/detection/draem/configuration.yaml create mode 100644 external/anomaly/templates/detection/draem/transform_config.yaml create mode 100644 external/anomaly/templates/detection/padim/compression_config.json create mode 100644 external/anomaly/templates/detection/padim/configuration.yaml create mode 100644 external/anomaly/templates/detection/padim/pot_optimization_config.json create mode 100644 external/anomaly/templates/detection/stfpm/compression_config.json create mode 100644 external/anomaly/templates/detection/stfpm/configuration.yaml create mode 100644 external/anomaly/templates/detection/stfpm/hpo_config.yaml create mode 100644 external/anomaly/templates/segmentation/draem/compression_config.json create mode 100644 external/anomaly/templates/segmentation/draem/configuration.yaml create mode 100644 external/anomaly/templates/segmentation/draem/transform_config.yaml create mode 100644 external/anomaly/templates/segmentation/padim/compression_config.json create mode 100644 external/anomaly/templates/segmentation/padim/configuration.yaml create mode 100644 external/anomaly/templates/segmentation/padim/pot_optimization_config.json create mode 100644 external/anomaly/templates/segmentation/stfpm/compression_config.json create mode 100644 external/anomaly/templates/segmentation/stfpm/configuration.yaml create mode 100644 external/anomaly/templates/segmentation/stfpm/hpo_config.yaml diff --git a/external/anomaly/templates/classification/draem/compression_config.json b/external/anomaly/templates/classification/draem/compression_config.json new file mode 100644 index 00000000000..0b7922f5a23 --- /dev/null +++ b/external/anomaly/templates/classification/draem/compression_config.json @@ -0,0 +1,36 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "model": { + "lr": 0.004 + }, + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": [] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/classification/draem/configuration.yaml b/external/anomaly/templates/classification/draem/configuration.yaml new file mode 100644 index 00000000000..b951d93c574 --- /dev/null +++ b/external/anomaly/templates/classification/draem/configuration.yaml @@ -0,0 +1,241 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for Draem +header: Configuration for Draem +learning_parameters: + description: Learning Parameters + early_stopping: + description: Early Stopping Parameters + header: Early Stopping Parameters + metric: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: image_AUROC + description: The metric used to determine if the model should stop training + editable: true + enum_name: EarlyStoppingMetrics + header: Early Stopping Metric + options: + IMAGE_F1: image_F1Score + IMAGE_ROC_AUC: image_AUROC + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + patience: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 20 + description: + Number of epochs to wait for an improvement in the monitored metric. + If the metric has not improved for this many epochs, the training will stop + and the best model will be returned. + editable: true + header: Early Stopping Patience + max_value: 100 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Setting this value too low might lead to underfitting. Setting the + value too high will increase the training time and might lead to overfitting. + type: PARAMETER_GROUP + visible_in_ui: true + header: Learning Parameters + lr: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.0001 + description: Learning rate used for optimizing the network. + editable: true + header: Learning Rate + max_value: 1 + min_value: 0.0001 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + max_epochs: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 700 + description: Maximum number of epochs to train the model for. + editable: true + header: Max Epochs + max_value: 700 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Training for very few epochs might lead to poor performance. If Early + Stopping is enabled then increasing the value of max epochs might not lead to + desired result. + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/classification/draem/template_experimental.yaml b/external/anomaly/templates/classification/draem/template_experimental.yaml index e84027c23f2..dc18d079d59 100644 --- a/external/anomaly/templates/classification/draem/template_experimental.yaml +++ b/external/anomaly/templates/classification/draem/template_experimental.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/draem/configuration.yaml + base_path: ./configuration.yaml # Training resources. max_nodes: 1 diff --git a/external/anomaly/templates/classification/draem/transform_config.yaml b/external/anomaly/templates/classification/draem/transform_config.yaml new file mode 100644 index 00000000000..5a379ef7628 --- /dev/null +++ b/external/anomaly/templates/classification/draem/transform_config.yaml @@ -0,0 +1,26 @@ +{ + "__version__": "1.1.0", + "transform": + { + "__class_fullname__": "Compose", + "p": 1.0, + "transforms": + [ + { + "__class_fullname__": "ToFloat", + "always_apply": false, + "p": 1.0, + "max_value": null, + }, + { + "__class_fullname__": "ToTensorV2", + "always_apply": true, + "p": 1.0, + "transpose_mask": false, + }, + ], + "bbox_params": null, + "keypoint_params": null, + "additional_targets": {}, + }, +} diff --git a/external/anomaly/configs/padim/compression_config.json b/external/anomaly/templates/classification/padim/compression_config.json similarity index 100% rename from external/anomaly/configs/padim/compression_config.json rename to external/anomaly/templates/classification/padim/compression_config.json diff --git a/external/anomaly/configs/padim/configuration.yaml b/external/anomaly/templates/classification/padim/configuration.yaml similarity index 100% rename from external/anomaly/configs/padim/configuration.yaml rename to external/anomaly/templates/classification/padim/configuration.yaml diff --git a/external/anomaly/configs/padim/pot_optimization_config.json b/external/anomaly/templates/classification/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/configs/padim/pot_optimization_config.json rename to external/anomaly/templates/classification/padim/pot_optimization_config.json diff --git a/external/anomaly/configs/stfpm/compression_config.json b/external/anomaly/templates/classification/stfpm/compression_config.json similarity index 100% rename from external/anomaly/configs/stfpm/compression_config.json rename to external/anomaly/templates/classification/stfpm/compression_config.json diff --git a/external/anomaly/configs/stfpm/configuration.yaml b/external/anomaly/templates/classification/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/configs/stfpm/configuration.yaml rename to external/anomaly/templates/classification/stfpm/configuration.yaml diff --git a/external/anomaly/configs/stfpm/hpo_config.yaml b/external/anomaly/templates/classification/stfpm/hpo_config.yaml similarity index 100% rename from external/anomaly/configs/stfpm/hpo_config.yaml rename to external/anomaly/templates/classification/stfpm/hpo_config.yaml diff --git a/external/anomaly/templates/classification/stfpm/template.yaml b/external/anomaly/templates/classification/stfpm/template.yaml index 1c446639856..5886379fa7e 100644 --- a/external/anomaly/templates/classification/stfpm/template.yaml +++ b/external/anomaly/templates/classification/stfpm/template.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/stfpm/configuration.yaml + base_path: ./configuration.yaml parameter_overrides: learning_parameters: train_batch_size: diff --git a/external/anomaly/templates/detection/draem/compression_config.json b/external/anomaly/templates/detection/draem/compression_config.json new file mode 100644 index 00000000000..0b7922f5a23 --- /dev/null +++ b/external/anomaly/templates/detection/draem/compression_config.json @@ -0,0 +1,36 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "model": { + "lr": 0.004 + }, + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": [] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/detection/draem/configuration.yaml b/external/anomaly/templates/detection/draem/configuration.yaml new file mode 100644 index 00000000000..b951d93c574 --- /dev/null +++ b/external/anomaly/templates/detection/draem/configuration.yaml @@ -0,0 +1,241 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for Draem +header: Configuration for Draem +learning_parameters: + description: Learning Parameters + early_stopping: + description: Early Stopping Parameters + header: Early Stopping Parameters + metric: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: image_AUROC + description: The metric used to determine if the model should stop training + editable: true + enum_name: EarlyStoppingMetrics + header: Early Stopping Metric + options: + IMAGE_F1: image_F1Score + IMAGE_ROC_AUC: image_AUROC + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + patience: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 20 + description: + Number of epochs to wait for an improvement in the monitored metric. + If the metric has not improved for this many epochs, the training will stop + and the best model will be returned. + editable: true + header: Early Stopping Patience + max_value: 100 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Setting this value too low might lead to underfitting. Setting the + value too high will increase the training time and might lead to overfitting. + type: PARAMETER_GROUP + visible_in_ui: true + header: Learning Parameters + lr: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.0001 + description: Learning rate used for optimizing the network. + editable: true + header: Learning Rate + max_value: 1 + min_value: 0.0001 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + max_epochs: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 700 + description: Maximum number of epochs to train the model for. + editable: true + header: Max Epochs + max_value: 700 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Training for very few epochs might lead to poor performance. If Early + Stopping is enabled then increasing the value of max epochs might not lead to + desired result. + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/detection/draem/template_experimental.yaml b/external/anomaly/templates/detection/draem/template_experimental.yaml index a7e062ca9cd..805b0bcca47 100644 --- a/external/anomaly/templates/detection/draem/template_experimental.yaml +++ b/external/anomaly/templates/detection/draem/template_experimental.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/draem/configuration.yaml + base_path: ./configuration.yaml # Training resources. max_nodes: 1 diff --git a/external/anomaly/templates/detection/draem/transform_config.yaml b/external/anomaly/templates/detection/draem/transform_config.yaml new file mode 100644 index 00000000000..5a379ef7628 --- /dev/null +++ b/external/anomaly/templates/detection/draem/transform_config.yaml @@ -0,0 +1,26 @@ +{ + "__version__": "1.1.0", + "transform": + { + "__class_fullname__": "Compose", + "p": 1.0, + "transforms": + [ + { + "__class_fullname__": "ToFloat", + "always_apply": false, + "p": 1.0, + "max_value": null, + }, + { + "__class_fullname__": "ToTensorV2", + "always_apply": true, + "p": 1.0, + "transpose_mask": false, + }, + ], + "bbox_params": null, + "keypoint_params": null, + "additional_targets": {}, + }, +} diff --git a/external/anomaly/templates/detection/padim/compression_config.json b/external/anomaly/templates/detection/padim/compression_config.json new file mode 100644 index 00000000000..789f8d131f6 --- /dev/null +++ b/external/anomaly/templates/detection/padim/compression_config.json @@ -0,0 +1,40 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": [ + "PadimModel/sqrt_0", + "PadimModel/interpolate_2", + "PadimModel/__truediv___0", + "PadimModel/__truediv___1", + "PadimModel/matmul_1", + "PadimModel/conv2d_0" + ] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/detection/padim/configuration.yaml b/external/anomaly/templates/detection/padim/configuration.yaml new file mode 100644 index 00000000000..ff0cc759b8e --- /dev/null +++ b/external/anomaly/templates/detection/padim/configuration.yaml @@ -0,0 +1,183 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 8 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for Padim +header: Configuration for Padim +id: "" +learning_parameters: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction + editable: true + enum_name: ModelBackbone + header: Model Backbone + options: + RESNET18: resnet18 + WIDE_RESNET_50: wide_resnet50_2 + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: resnet18 + visible_in_ui: true + warning: null + description: Learning Parameters + header: Learning Parameters + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 32 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 32 + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: true + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: Performance + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 300 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/detection/padim/pot_optimization_config.json b/external/anomaly/templates/detection/padim/pot_optimization_config.json new file mode 100644 index 00000000000..4e5b25aef51 --- /dev/null +++ b/external/anomaly/templates/detection/padim/pot_optimization_config.json @@ -0,0 +1,18 @@ +{ + "algorithms": [ + { + "name": "DefaultQuantization", + "params": { + "preset": "performance", + "target_device": "ANY", + "range_estimator": { + "preset": "quantile" + }, + "ignored": { + "scope": ["Sqrt_105/pow_", "Mul_97"] + }, + "shuffle_data": true + } + } + ] +} diff --git a/external/anomaly/templates/detection/padim/template.yaml b/external/anomaly/templates/detection/padim/template.yaml index ddce1a6999e..d708821ee01 100644 --- a/external/anomaly/templates/detection/padim/template.yaml +++ b/external/anomaly/templates/detection/padim/template.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/padim/configuration.yaml + base_path: ./configuration.yaml # Training resources. max_nodes: 1 diff --git a/external/anomaly/templates/detection/stfpm/compression_config.json b/external/anomaly/templates/detection/stfpm/compression_config.json new file mode 100644 index 00000000000..caee63d064b --- /dev/null +++ b/external/anomaly/templates/detection/stfpm/compression_config.json @@ -0,0 +1,36 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "model": { + "lr": 0.004 + }, + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": ["{re}.*__pow__.*"] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/detection/stfpm/configuration.yaml b/external/anomaly/templates/detection/stfpm/configuration.yaml new file mode 100644 index 00000000000..904ef24e36e --- /dev/null +++ b/external/anomaly/templates/detection/stfpm/configuration.yaml @@ -0,0 +1,312 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 8 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for STFPM +header: Configuration for STFPM +id: "" +learning_parameters: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction + editable: true + enum_name: ModelBackbone + header: Model Backbone + options: + RESNET18: resnet18 + WIDE_RESNET_50: wide_resnet50_2 + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: resnet18 + visible_in_ui: true + warning: null + description: Learning Parameters + early_stopping: + description: Early Stopping Parameters + header: Early Stopping Parameters + metric: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: image_F1Score + description: The metric used to determine if the model should stop training + editable: true + enum_name: EarlyStoppingMetrics + header: Early Stopping Metric + options: + IMAGE_F1: image_F1Score + IMAGE_ROC_AUC: image_AUROC + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: image_F1Score + visible_in_ui: true + warning: null + patience: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 10 + description: + Number of epochs to wait for an improvement in the monitored metric. + If the metric has not improved for this many epochs, the training will stop + and the best model will be returned. + editable: true + header: Early Stopping Patience + max_value: 100 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 10 + visible_in_ui: true + warning: + Setting this value too low might lead to underfitting. Setting the + value too high will increase the training time and might lead to overfitting. + type: PARAMETER_GROUP + visible_in_ui: true + header: Learning Parameters + lr: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.4 + description: Learning rate used for optimizing the Student network. + editable: true + header: Learning Rate + max_value: 1 + min_value: 0.001 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 0.4 + visible_in_ui: true + warning: null + max_epochs: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 100 + description: Maximum number of epochs to train the model for. + editable: true + header: Max Epochs + max_value: 500 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 100 + visible_in_ui: true + warning: + Training for very few epochs might lead to poor performance. If Early + Stopping is enabled then increasing the value of max epochs might not lead to + desired result. + momentum: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.9 + description: Momentum used for SGD optimizer + editable: true + header: Momentum + max_value: 1.0 + min_value: 0.1 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 0.9 + visible_in_ui: true + warning: null + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 32 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 32 + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true + weight_decay: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.0001 + description: Decay for SGD optimizer + editable: true + header: Weight Decay + max_value: 1 + min_value: 1.0e-05 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 0.0001 + visible_in_ui: true + warning: null +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: true + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: Performance + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 300 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/detection/stfpm/hpo_config.yaml b/external/anomaly/templates/detection/stfpm/hpo_config.yaml new file mode 100644 index 00000000000..ad9db985679 --- /dev/null +++ b/external/anomaly/templates/detection/stfpm/hpo_config.yaml @@ -0,0 +1,18 @@ +# default model.lr: 0.4, dataset.train_batch_size: 32 +metric: image_F1Score +mode: max +search_algorithm: asha +early_stop: None +hp_space: + learning_parameters.lr: + param_type: qloguniform + range: + - 0.04 + - 0.8 + - 0.01 + learning_parameters.train_batch_size: + param_type: qloguniform + range: + - 16 + - 64 + - 2 diff --git a/external/anomaly/templates/detection/stfpm/template.yaml b/external/anomaly/templates/detection/stfpm/template.yaml index 96db11eb6ac..28745446865 100644 --- a/external/anomaly/templates/detection/stfpm/template.yaml +++ b/external/anomaly/templates/detection/stfpm/template.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/stfpm/configuration.yaml + base_path: ./configuration.yaml parameter_overrides: learning_parameters: train_batch_size: diff --git a/external/anomaly/templates/segmentation/draem/compression_config.json b/external/anomaly/templates/segmentation/draem/compression_config.json new file mode 100644 index 00000000000..0b7922f5a23 --- /dev/null +++ b/external/anomaly/templates/segmentation/draem/compression_config.json @@ -0,0 +1,36 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "model": { + "lr": 0.004 + }, + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": [] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/segmentation/draem/configuration.yaml b/external/anomaly/templates/segmentation/draem/configuration.yaml new file mode 100644 index 00000000000..b951d93c574 --- /dev/null +++ b/external/anomaly/templates/segmentation/draem/configuration.yaml @@ -0,0 +1,241 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for Draem +header: Configuration for Draem +learning_parameters: + description: Learning Parameters + early_stopping: + description: Early Stopping Parameters + header: Early Stopping Parameters + metric: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: image_AUROC + description: The metric used to determine if the model should stop training + editable: true + enum_name: EarlyStoppingMetrics + header: Early Stopping Metric + options: + IMAGE_F1: image_F1Score + IMAGE_ROC_AUC: image_AUROC + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + patience: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 20 + description: + Number of epochs to wait for an improvement in the monitored metric. + If the metric has not improved for this many epochs, the training will stop + and the best model will be returned. + editable: true + header: Early Stopping Patience + max_value: 100 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Setting this value too low might lead to underfitting. Setting the + value too high will increase the training time and might lead to overfitting. + type: PARAMETER_GROUP + visible_in_ui: true + header: Learning Parameters + lr: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.0001 + description: Learning rate used for optimizing the network. + editable: true + header: Learning Rate + max_value: 1 + min_value: 0.0001 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + max_epochs: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 700 + description: Maximum number of epochs to train the model for. + editable: true + header: Max Epochs + max_value: 700 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Training for very few epochs might lead to poor performance. If Early + Stopping is enabled then increasing the value of max epochs might not lead to + desired result. + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/segmentation/draem/template_experimental.yaml b/external/anomaly/templates/segmentation/draem/template_experimental.yaml index 978af8863d4..cabd48a31ad 100644 --- a/external/anomaly/templates/segmentation/draem/template_experimental.yaml +++ b/external/anomaly/templates/segmentation/draem/template_experimental.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/draem/configuration.yaml + base_path: ./configuration.yaml # Training resources. max_nodes: 1 diff --git a/external/anomaly/templates/segmentation/draem/transform_config.yaml b/external/anomaly/templates/segmentation/draem/transform_config.yaml new file mode 100644 index 00000000000..5a379ef7628 --- /dev/null +++ b/external/anomaly/templates/segmentation/draem/transform_config.yaml @@ -0,0 +1,26 @@ +{ + "__version__": "1.1.0", + "transform": + { + "__class_fullname__": "Compose", + "p": 1.0, + "transforms": + [ + { + "__class_fullname__": "ToFloat", + "always_apply": false, + "p": 1.0, + "max_value": null, + }, + { + "__class_fullname__": "ToTensorV2", + "always_apply": true, + "p": 1.0, + "transpose_mask": false, + }, + ], + "bbox_params": null, + "keypoint_params": null, + "additional_targets": {}, + }, +} diff --git a/external/anomaly/templates/segmentation/padim/compression_config.json b/external/anomaly/templates/segmentation/padim/compression_config.json new file mode 100644 index 00000000000..789f8d131f6 --- /dev/null +++ b/external/anomaly/templates/segmentation/padim/compression_config.json @@ -0,0 +1,40 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": [ + "PadimModel/sqrt_0", + "PadimModel/interpolate_2", + "PadimModel/__truediv___0", + "PadimModel/__truediv___1", + "PadimModel/matmul_1", + "PadimModel/conv2d_0" + ] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/segmentation/padim/configuration.yaml b/external/anomaly/templates/segmentation/padim/configuration.yaml new file mode 100644 index 00000000000..ff0cc759b8e --- /dev/null +++ b/external/anomaly/templates/segmentation/padim/configuration.yaml @@ -0,0 +1,183 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 8 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for Padim +header: Configuration for Padim +id: "" +learning_parameters: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction + editable: true + enum_name: ModelBackbone + header: Model Backbone + options: + RESNET18: resnet18 + WIDE_RESNET_50: wide_resnet50_2 + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: resnet18 + visible_in_ui: true + warning: null + description: Learning Parameters + header: Learning Parameters + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 32 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 32 + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: true + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: Performance + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 300 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/segmentation/padim/pot_optimization_config.json b/external/anomaly/templates/segmentation/padim/pot_optimization_config.json new file mode 100644 index 00000000000..4e5b25aef51 --- /dev/null +++ b/external/anomaly/templates/segmentation/padim/pot_optimization_config.json @@ -0,0 +1,18 @@ +{ + "algorithms": [ + { + "name": "DefaultQuantization", + "params": { + "preset": "performance", + "target_device": "ANY", + "range_estimator": { + "preset": "quantile" + }, + "ignored": { + "scope": ["Sqrt_105/pow_", "Mul_97"] + }, + "shuffle_data": true + } + } + ] +} diff --git a/external/anomaly/templates/segmentation/padim/template.yaml b/external/anomaly/templates/segmentation/padim/template.yaml index 366a5cacd6e..3feced9fa1f 100644 --- a/external/anomaly/templates/segmentation/padim/template.yaml +++ b/external/anomaly/templates/segmentation/padim/template.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/padim/configuration.yaml + base_path: ./configuration.yaml # Training resources. max_nodes: 1 diff --git a/external/anomaly/templates/segmentation/stfpm/compression_config.json b/external/anomaly/templates/segmentation/stfpm/compression_config.json new file mode 100644 index 00000000000..caee63d064b --- /dev/null +++ b/external/anomaly/templates/segmentation/stfpm/compression_config.json @@ -0,0 +1,36 @@ +{ + "base": { + "find_unused_parameters": true, + "target_metric_name": "image_F1Score", + "nncf_config": { + "input_info": { + "sample_size": [1, 3, 256, 256] + }, + "compression": [], + "log_dir": "/tmp" + } + }, + "nncf_quantization": { + "model": { + "lr": 0.004 + }, + "nncf_config": { + "compression": [ + { + "algorithm": "quantization", + "preset": "mixed", + "initializer": { + "range": { + "num_init_samples": 250 + }, + "batchnorm_adaptation": { + "num_bn_adaptation_samples": 250 + } + }, + "ignored_scopes": ["{re}.*__pow__.*"] + } + ] + } + }, + "order_of_parts": ["nncf_quantization"] +} diff --git a/external/anomaly/templates/segmentation/stfpm/configuration.yaml b/external/anomaly/templates/segmentation/stfpm/configuration.yaml new file mode 100644 index 00000000000..904ef24e36e --- /dev/null +++ b/external/anomaly/templates/segmentation/stfpm/configuration.yaml @@ -0,0 +1,312 @@ +dataset: + description: Dataset Parameters + header: Dataset Parameters + num_workers: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 8 + description: + Increasing this value might improve training speed however it might + cause out of memory errors. If the number of workers is set to zero, data loading + will happen in the main training thread. + editable: true + header: Number of workers + max_value: 36 + min_value: 0 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 8 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +description: Configuration for STFPM +header: Configuration for STFPM +id: "" +learning_parameters: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction + editable: true + enum_name: ModelBackbone + header: Model Backbone + options: + RESNET18: resnet18 + WIDE_RESNET_50: wide_resnet50_2 + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: resnet18 + visible_in_ui: true + warning: null + description: Learning Parameters + early_stopping: + description: Early Stopping Parameters + header: Early Stopping Parameters + metric: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: image_F1Score + description: The metric used to determine if the model should stop training + editable: true + enum_name: EarlyStoppingMetrics + header: Early Stopping Metric + options: + IMAGE_F1: image_F1Score + IMAGE_ROC_AUC: image_AUROC + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: image_F1Score + visible_in_ui: true + warning: null + patience: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 10 + description: + Number of epochs to wait for an improvement in the monitored metric. + If the metric has not improved for this many epochs, the training will stop + and the best model will be returned. + editable: true + header: Early Stopping Patience + max_value: 100 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 10 + visible_in_ui: true + warning: + Setting this value too low might lead to underfitting. Setting the + value too high will increase the training time and might lead to overfitting. + type: PARAMETER_GROUP + visible_in_ui: true + header: Learning Parameters + lr: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.4 + description: Learning rate used for optimizing the Student network. + editable: true + header: Learning Rate + max_value: 1 + min_value: 0.001 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 0.4 + visible_in_ui: true + warning: null + max_epochs: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 100 + description: Maximum number of epochs to train the model for. + editable: true + header: Max Epochs + max_value: 500 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 100 + visible_in_ui: true + warning: + Training for very few epochs might lead to poor performance. If Early + Stopping is enabled then increasing the value of max epochs might not lead to + desired result. + momentum: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.9 + description: Momentum used for SGD optimizer + editable: true + header: Momentum + max_value: 1.0 + min_value: 0.1 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 0.9 + visible_in_ui: true + warning: null + train_batch_size: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 32 + description: + The number of training samples seen in each iteration of training. + Increasing this value improves training time and may make the training more + stable. A larger batch size has higher memory requirements. + editable: true + header: Batch size + max_value: 512 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 32 + visible_in_ui: true + warning: + Increasing this value may cause the system to use more memory than available, + potentially causing out of memory errors, please update with caution. + type: PARAMETER_GROUP + visible_in_ui: true + weight_decay: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.0001 + description: Decay for SGD optimizer + editable: true + header: Weight Decay + max_value: 1 + min_value: 1.0e-05 + type: FLOAT + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 0.0001 + visible_in_ui: true + warning: null +nncf_optimization: + description: Optimization by NNCF + enable_pruning: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm + editable: true + header: Enable filter pruning algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + enable_quantization: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: true + description: Enable quantization algorithm + editable: true + header: Enable quantization algorithm + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: true + visible_in_ui: true + warning: null + header: Optimization by NNCF + pruning_supported: + affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Whether filter pruning is supported + editable: true + header: Whether filter pruning is supported + type: BOOLEAN + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: false + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: true +pot_parameters: + description: POT Parameters + header: POT Parameters + preset: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: Performance + description: Quantization preset that defines quantization scheme + editable: true + enum_name: POTQuantizationPreset + header: Preset + options: + MIXED: Mixed + PERFORMANCE: Performance + type: SELECTABLE + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: Performance + visible_in_ui: true + warning: null + stat_subset_size: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 300 + description: Number of data samples used for post-training optimization + editable: true + header: Number of data samples + max_value: 9223372036854775807 + min_value: 1 + type: INTEGER + ui_rules: + action: DISABLE_EDITING + operator: AND + rules: [] + type: UI_RULES + value: 300 + visible_in_ui: true + warning: null + type: PARAMETER_GROUP + visible_in_ui: false +type: CONFIGURABLE_PARAMETERS +visible_in_ui: true diff --git a/external/anomaly/templates/segmentation/stfpm/hpo_config.yaml b/external/anomaly/templates/segmentation/stfpm/hpo_config.yaml new file mode 100644 index 00000000000..ad9db985679 --- /dev/null +++ b/external/anomaly/templates/segmentation/stfpm/hpo_config.yaml @@ -0,0 +1,18 @@ +# default model.lr: 0.4, dataset.train_batch_size: 32 +metric: image_F1Score +mode: max +search_algorithm: asha +early_stop: None +hp_space: + learning_parameters.lr: + param_type: qloguniform + range: + - 0.04 + - 0.8 + - 0.01 + learning_parameters.train_batch_size: + param_type: qloguniform + range: + - 16 + - 64 + - 2 diff --git a/external/anomaly/templates/segmentation/stfpm/template.yaml b/external/anomaly/templates/segmentation/stfpm/template.yaml index 5f446ce8ef1..723a7e05696 100644 --- a/external/anomaly/templates/segmentation/stfpm/template.yaml +++ b/external/anomaly/templates/segmentation/stfpm/template.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/stfpm/configuration.yaml + base_path: ./configuration.yaml parameter_overrides: learning_parameters: train_batch_size: From 7e5e11e549737afee207b4f2d402031c29550ad8 Mon Sep 17 00:00:00 2001 From: Ashwin Vaidya Date: Fri, 26 Aug 2022 13:11:57 +0200 Subject: [PATCH 2/6] Revert to old configuration format + fix save model issue --- .../configs/classification/__init__.py | 15 ++ .../configs/classification/draem/__init__.py | 19 ++ .../draem/compression_config copy.json} | 0 .../draem/compression_config.json | 0 .../classification/draem/configuration.py | 23 ++ .../draem/configuration.yaml | 0 .../draem/template_experimental.yaml | 0 .../draem/transform_config.yaml | 0 .../configs/classification/padim/__init__.py | 19 ++ .../padim/compression_config.json | 0 .../classification/padim/configuration.py | 23 ++ .../classification/padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../classification/padim/template.yaml | 2 +- .../configs/classification/stfpm/__init__.py | 19 ++ .../stfpm/compression_config.json | 0 .../classification/stfpm/configuration.py | 23 ++ .../classification/stfpm/configuration.yaml | 0 .../classification/stfpm/hpo_config.yaml | 0 .../classification/stfpm/template.yaml | 0 .../anomaly/configs/detection/__init__.py | 15 ++ .../configs/detection/draem/__init__.py | 19 ++ .../detection}/draem/compression_config.json | 0 .../configs/detection/draem/configuration.py | 23 ++ .../detection}/draem/configuration.yaml | 0 .../draem/template_experimental.yaml | 0 .../detection}/draem/transform_config.yaml | 0 .../configs/detection/padim/__init__.py | 19 ++ .../detection}/padim/compression_config.json | 0 .../configs/detection/padim/configuration.py | 23 ++ .../detection/padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../detection/padim/template.yaml | 0 .../configs/detection/stfpm/__init__.py | 19 ++ .../detection/stfpm/compression_config.json | 0 .../configs/detection/stfpm/configuration.py | 23 ++ .../detection/stfpm/configuration.yaml | 0 .../detection/stfpm/hpo_config.yaml | 0 .../detection/stfpm/template.yaml | 0 external/anomaly/configs/draem/__init__.py | 4 +- .../anomaly/configs/draem/configuration.py | 12 +- .../anomaly/configs/segmentation/__init__.py | 15 ++ .../configs/segmentation/draem/__init__.py | 19 ++ .../draem/compression_config.json | 0 .../segmentation/draem/configuration.py | 23 ++ .../segmentation}/draem/configuration.yaml | 0 .../draem/template_experimental.yaml | 0 .../segmentation}/draem/transform_config.yaml | 0 .../configs/segmentation/padim/__init__.py | 19 ++ .../padim}/compression_config.json | 12 +- .../segmentation/padim/configuration.py | 23 ++ .../segmentation/padim/configuration.yaml | 0 .../padim/pot_optimization_config.json | 0 .../segmentation/padim/template.yaml | 0 .../configs/segmentation/stfpm/__init__.py | 19 ++ .../stfpm/compression_config.json | 0 .../segmentation/stfpm/configuration.py | 23 ++ .../segmentation/stfpm/configuration.yaml | 0 .../segmentation/stfpm/hpo_config.yaml | 0 .../segmentation/stfpm/template.yaml | 0 external/anomaly/tasks/inference.py | 9 +- .../segmentation/draem/configuration.yaml | 241 ------------------ .../segmentation/draem/transform_config.yaml | 26 -- 63 files changed, 442 insertions(+), 287 deletions(-) create mode 100644 external/anomaly/configs/classification/__init__.py create mode 100644 external/anomaly/configs/classification/draem/__init__.py rename external/anomaly/{templates/classification/padim/compression_config.json => configs/classification/draem/compression_config copy.json} (100%) rename external/anomaly/configs/{ => classification}/draem/compression_config.json (100%) create mode 100644 external/anomaly/configs/classification/draem/configuration.py rename external/anomaly/configs/{ => classification}/draem/configuration.yaml (100%) rename external/anomaly/{templates => configs}/classification/draem/template_experimental.yaml (100%) rename external/anomaly/configs/{ => classification}/draem/transform_config.yaml (100%) create mode 100644 external/anomaly/configs/classification/padim/__init__.py rename external/anomaly/{templates/detection => configs/classification}/padim/compression_config.json (100%) create mode 100644 external/anomaly/configs/classification/padim/configuration.py rename external/anomaly/{templates => configs}/classification/padim/configuration.yaml (100%) rename external/anomaly/{templates => configs}/classification/padim/pot_optimization_config.json (100%) rename external/anomaly/{templates => configs}/classification/padim/template.yaml (92%) create mode 100644 external/anomaly/configs/classification/stfpm/__init__.py rename external/anomaly/{templates => configs}/classification/stfpm/compression_config.json (100%) create mode 100644 external/anomaly/configs/classification/stfpm/configuration.py rename external/anomaly/{templates => configs}/classification/stfpm/configuration.yaml (100%) rename external/anomaly/{templates => configs}/classification/stfpm/hpo_config.yaml (100%) rename external/anomaly/{templates => configs}/classification/stfpm/template.yaml (100%) create mode 100644 external/anomaly/configs/detection/__init__.py create mode 100644 external/anomaly/configs/detection/draem/__init__.py rename external/anomaly/{templates/classification => configs/detection}/draem/compression_config.json (100%) create mode 100644 external/anomaly/configs/detection/draem/configuration.py rename external/anomaly/{templates/classification => configs/detection}/draem/configuration.yaml (100%) rename external/anomaly/{templates => configs}/detection/draem/template_experimental.yaml (100%) rename external/anomaly/{templates/classification => configs/detection}/draem/transform_config.yaml (100%) create mode 100644 external/anomaly/configs/detection/padim/__init__.py rename external/anomaly/{templates/segmentation => configs/detection}/padim/compression_config.json (100%) create mode 100644 external/anomaly/configs/detection/padim/configuration.py rename external/anomaly/{templates => configs}/detection/padim/configuration.yaml (100%) rename external/anomaly/{templates => configs}/detection/padim/pot_optimization_config.json (100%) rename external/anomaly/{templates => configs}/detection/padim/template.yaml (100%) create mode 100644 external/anomaly/configs/detection/stfpm/__init__.py rename external/anomaly/{templates => configs}/detection/stfpm/compression_config.json (100%) create mode 100644 external/anomaly/configs/detection/stfpm/configuration.py rename external/anomaly/{templates => configs}/detection/stfpm/configuration.yaml (100%) rename external/anomaly/{templates => configs}/detection/stfpm/hpo_config.yaml (100%) rename external/anomaly/{templates => configs}/detection/stfpm/template.yaml (100%) create mode 100644 external/anomaly/configs/segmentation/__init__.py create mode 100644 external/anomaly/configs/segmentation/draem/__init__.py rename external/anomaly/{templates/detection => configs/segmentation}/draem/compression_config.json (100%) create mode 100644 external/anomaly/configs/segmentation/draem/configuration.py rename external/anomaly/{templates/detection => configs/segmentation}/draem/configuration.yaml (100%) rename external/anomaly/{templates => configs}/segmentation/draem/template_experimental.yaml (100%) rename external/anomaly/{templates/detection => configs/segmentation}/draem/transform_config.yaml (100%) create mode 100644 external/anomaly/configs/segmentation/padim/__init__.py rename external/anomaly/{templates/segmentation/draem => configs/segmentation/padim}/compression_config.json (72%) create mode 100644 external/anomaly/configs/segmentation/padim/configuration.py rename external/anomaly/{templates => configs}/segmentation/padim/configuration.yaml (100%) rename external/anomaly/{templates => configs}/segmentation/padim/pot_optimization_config.json (100%) rename external/anomaly/{templates => configs}/segmentation/padim/template.yaml (100%) create mode 100644 external/anomaly/configs/segmentation/stfpm/__init__.py rename external/anomaly/{templates => configs}/segmentation/stfpm/compression_config.json (100%) create mode 100644 external/anomaly/configs/segmentation/stfpm/configuration.py rename external/anomaly/{templates => configs}/segmentation/stfpm/configuration.yaml (100%) rename external/anomaly/{templates => configs}/segmentation/stfpm/hpo_config.yaml (100%) rename external/anomaly/{templates => configs}/segmentation/stfpm/template.yaml (100%) delete mode 100644 external/anomaly/templates/segmentation/draem/configuration.yaml delete mode 100644 external/anomaly/templates/segmentation/draem/transform_config.yaml diff --git a/external/anomaly/configs/classification/__init__.py b/external/anomaly/configs/classification/__init__.py new file mode 100644 index 00000000000..b24bd9d1806 --- /dev/null +++ b/external/anomaly/configs/classification/__init__.py @@ -0,0 +1,15 @@ +"""Configuration for classification tasks.""" + +# Copyright (C) 2022 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/configs/classification/draem/__init__.py b/external/anomaly/configs/classification/draem/__init__.py new file mode 100644 index 00000000000..c76cd3508ff --- /dev/null +++ b/external/anomaly/configs/classification/draem/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for DRAEM Anomaly Classification Task.""" + +# Copyright (C) 2022 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. + +from .configuration import DraemAnomalyClassificationConfig + +__all__ = ["DraemAnomalyClassificationConfig"] diff --git a/external/anomaly/templates/classification/padim/compression_config.json b/external/anomaly/configs/classification/draem/compression_config copy.json similarity index 100% rename from external/anomaly/templates/classification/padim/compression_config.json rename to external/anomaly/configs/classification/draem/compression_config copy.json diff --git a/external/anomaly/configs/draem/compression_config.json b/external/anomaly/configs/classification/draem/compression_config.json similarity index 100% rename from external/anomaly/configs/draem/compression_config.json rename to external/anomaly/configs/classification/draem/compression_config.json diff --git a/external/anomaly/configs/classification/draem/configuration.py b/external/anomaly/configs/classification/draem/configuration.py new file mode 100644 index 00000000000..0a9ae79d9df --- /dev/null +++ b/external/anomaly/configs/classification/draem/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for DRAEM anomaly classification task.""" + +# 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. + +from attr import attrs +from configs.draem import DraemAnomalyBaseConfig + + +@attrs +class DraemAnomalyClassificationConfig(DraemAnomalyBaseConfig): + """Configurable parameters for DRAEM anomaly classification task.""" diff --git a/external/anomaly/configs/draem/configuration.yaml b/external/anomaly/configs/classification/draem/configuration.yaml similarity index 100% rename from external/anomaly/configs/draem/configuration.yaml rename to external/anomaly/configs/classification/draem/configuration.yaml diff --git a/external/anomaly/templates/classification/draem/template_experimental.yaml b/external/anomaly/configs/classification/draem/template_experimental.yaml similarity index 100% rename from external/anomaly/templates/classification/draem/template_experimental.yaml rename to external/anomaly/configs/classification/draem/template_experimental.yaml diff --git a/external/anomaly/configs/draem/transform_config.yaml b/external/anomaly/configs/classification/draem/transform_config.yaml similarity index 100% rename from external/anomaly/configs/draem/transform_config.yaml rename to external/anomaly/configs/classification/draem/transform_config.yaml diff --git a/external/anomaly/configs/classification/padim/__init__.py b/external/anomaly/configs/classification/padim/__init__.py new file mode 100644 index 00000000000..c0fb0ddce1d --- /dev/null +++ b/external/anomaly/configs/classification/padim/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for PADIM Anomaly Classification Task.""" + +# Copyright (C) 2022 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. + +from .configuration import PadimAnomalyClassificationConfig + +__all__ = ["PadimAnomalyClassificationConfig"] diff --git a/external/anomaly/templates/detection/padim/compression_config.json b/external/anomaly/configs/classification/padim/compression_config.json similarity index 100% rename from external/anomaly/templates/detection/padim/compression_config.json rename to external/anomaly/configs/classification/padim/compression_config.json diff --git a/external/anomaly/configs/classification/padim/configuration.py b/external/anomaly/configs/classification/padim/configuration.py new file mode 100644 index 00000000000..b01b8067a82 --- /dev/null +++ b/external/anomaly/configs/classification/padim/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for Padim anomaly classification task.""" + +# 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. + +from attr import attrs +from configs.padim import PadimAnomalyBaseConfig + + +@attrs +class PadimAnomalyClassificationConfig(PadimAnomalyBaseConfig): + """Configurable parameters for PADIM anomaly classification task.""" diff --git a/external/anomaly/templates/classification/padim/configuration.yaml b/external/anomaly/configs/classification/padim/configuration.yaml similarity index 100% rename from external/anomaly/templates/classification/padim/configuration.yaml rename to external/anomaly/configs/classification/padim/configuration.yaml diff --git a/external/anomaly/templates/classification/padim/pot_optimization_config.json b/external/anomaly/configs/classification/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/templates/classification/padim/pot_optimization_config.json rename to external/anomaly/configs/classification/padim/pot_optimization_config.json diff --git a/external/anomaly/templates/classification/padim/template.yaml b/external/anomaly/configs/classification/padim/template.yaml similarity index 92% rename from external/anomaly/templates/classification/padim/template.yaml rename to external/anomaly/configs/classification/padim/template.yaml index a25bf57c3e3..b7d45a49ed2 100644 --- a/external/anomaly/templates/classification/padim/template.yaml +++ b/external/anomaly/configs/classification/padim/template.yaml @@ -18,7 +18,7 @@ entrypoints: # Hyper Parameters hyper_parameters: - base_path: ../../../configs/padim/configuration.yaml + base_path: ./configuration.yaml # Training resources. max_nodes: 1 diff --git a/external/anomaly/configs/classification/stfpm/__init__.py b/external/anomaly/configs/classification/stfpm/__init__.py new file mode 100644 index 00000000000..adb65f754a6 --- /dev/null +++ b/external/anomaly/configs/classification/stfpm/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for STFPM Anomaly Classification Task.""" + +# Copyright (C) 2022 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. + +from .configuration import STFPMAnomalyClassificationConfig + +__all__ = ["STFPMAnomalyClassificationConfig"] diff --git a/external/anomaly/templates/classification/stfpm/compression_config.json b/external/anomaly/configs/classification/stfpm/compression_config.json similarity index 100% rename from external/anomaly/templates/classification/stfpm/compression_config.json rename to external/anomaly/configs/classification/stfpm/compression_config.json diff --git a/external/anomaly/configs/classification/stfpm/configuration.py b/external/anomaly/configs/classification/stfpm/configuration.py new file mode 100644 index 00000000000..e228b21b360 --- /dev/null +++ b/external/anomaly/configs/classification/stfpm/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for STFPM anomaly classification task.""" + +# Copyright (C) 2022 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. + +from attr import attrs +from configs.stfpm import STFPMAnomalyBaseConfig + + +@attrs +class STFPMAnomalyClassificationConfig(STFPMAnomalyBaseConfig): + """Configurable parameters for STFPM anomaly classification task.""" diff --git a/external/anomaly/templates/classification/stfpm/configuration.yaml b/external/anomaly/configs/classification/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/templates/classification/stfpm/configuration.yaml rename to external/anomaly/configs/classification/stfpm/configuration.yaml diff --git a/external/anomaly/templates/classification/stfpm/hpo_config.yaml b/external/anomaly/configs/classification/stfpm/hpo_config.yaml similarity index 100% rename from external/anomaly/templates/classification/stfpm/hpo_config.yaml rename to external/anomaly/configs/classification/stfpm/hpo_config.yaml diff --git a/external/anomaly/templates/classification/stfpm/template.yaml b/external/anomaly/configs/classification/stfpm/template.yaml similarity index 100% rename from external/anomaly/templates/classification/stfpm/template.yaml rename to external/anomaly/configs/classification/stfpm/template.yaml diff --git a/external/anomaly/configs/detection/__init__.py b/external/anomaly/configs/detection/__init__.py new file mode 100644 index 00000000000..7740bb752e6 --- /dev/null +++ b/external/anomaly/configs/detection/__init__.py @@ -0,0 +1,15 @@ +"""Configuration for detection tasks.""" + +# Copyright (C) 2022 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/configs/detection/draem/__init__.py b/external/anomaly/configs/detection/draem/__init__.py new file mode 100644 index 00000000000..75b203b8de6 --- /dev/null +++ b/external/anomaly/configs/detection/draem/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for DRAEM Anomaly Detection Task.""" + +# Copyright (C) 2022 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. + +from .configuration import DraemAnomalyDetectionConfig + +__all__ = ["DraemAnomalyDetectionConfig"] diff --git a/external/anomaly/templates/classification/draem/compression_config.json b/external/anomaly/configs/detection/draem/compression_config.json similarity index 100% rename from external/anomaly/templates/classification/draem/compression_config.json rename to external/anomaly/configs/detection/draem/compression_config.json diff --git a/external/anomaly/configs/detection/draem/configuration.py b/external/anomaly/configs/detection/draem/configuration.py new file mode 100644 index 00000000000..ca60fb6a70c --- /dev/null +++ b/external/anomaly/configs/detection/draem/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for DRAEM anomaly Detection task.""" + +# 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. + +from attr import attrs +from configs.draem import DraemAnomalyBaseConfig + + +@attrs +class DraemAnomalyDetectionConfig(DraemAnomalyBaseConfig): + """Configurable parameters for DRAEM anomaly Detection task.""" diff --git a/external/anomaly/templates/classification/draem/configuration.yaml b/external/anomaly/configs/detection/draem/configuration.yaml similarity index 100% rename from external/anomaly/templates/classification/draem/configuration.yaml rename to external/anomaly/configs/detection/draem/configuration.yaml diff --git a/external/anomaly/templates/detection/draem/template_experimental.yaml b/external/anomaly/configs/detection/draem/template_experimental.yaml similarity index 100% rename from external/anomaly/templates/detection/draem/template_experimental.yaml rename to external/anomaly/configs/detection/draem/template_experimental.yaml diff --git a/external/anomaly/templates/classification/draem/transform_config.yaml b/external/anomaly/configs/detection/draem/transform_config.yaml similarity index 100% rename from external/anomaly/templates/classification/draem/transform_config.yaml rename to external/anomaly/configs/detection/draem/transform_config.yaml diff --git a/external/anomaly/configs/detection/padim/__init__.py b/external/anomaly/configs/detection/padim/__init__.py new file mode 100644 index 00000000000..33b34eab8bf --- /dev/null +++ b/external/anomaly/configs/detection/padim/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for PADIM Anomaly Detection Task.""" + +# Copyright (C) 2022 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. + +from .configuration import PadimAnomalyDetectionConfig + +__all__ = ["PadimAnomalyDetectionConfig"] diff --git a/external/anomaly/templates/segmentation/padim/compression_config.json b/external/anomaly/configs/detection/padim/compression_config.json similarity index 100% rename from external/anomaly/templates/segmentation/padim/compression_config.json rename to external/anomaly/configs/detection/padim/compression_config.json diff --git a/external/anomaly/configs/detection/padim/configuration.py b/external/anomaly/configs/detection/padim/configuration.py new file mode 100644 index 00000000000..40176be20d8 --- /dev/null +++ b/external/anomaly/configs/detection/padim/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for Padim anomaly Detection task.""" + +# 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. + +from attr import attrs +from configs.padim import PadimAnomalyBaseConfig + + +@attrs +class PadimAnomalyDetectionConfig(PadimAnomalyBaseConfig): + """Configurable parameters for PADIM anomaly Detection task.""" diff --git a/external/anomaly/templates/detection/padim/configuration.yaml b/external/anomaly/configs/detection/padim/configuration.yaml similarity index 100% rename from external/anomaly/templates/detection/padim/configuration.yaml rename to external/anomaly/configs/detection/padim/configuration.yaml diff --git a/external/anomaly/templates/detection/padim/pot_optimization_config.json b/external/anomaly/configs/detection/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/templates/detection/padim/pot_optimization_config.json rename to external/anomaly/configs/detection/padim/pot_optimization_config.json diff --git a/external/anomaly/templates/detection/padim/template.yaml b/external/anomaly/configs/detection/padim/template.yaml similarity index 100% rename from external/anomaly/templates/detection/padim/template.yaml rename to external/anomaly/configs/detection/padim/template.yaml diff --git a/external/anomaly/configs/detection/stfpm/__init__.py b/external/anomaly/configs/detection/stfpm/__init__.py new file mode 100644 index 00000000000..7eee52f0ed0 --- /dev/null +++ b/external/anomaly/configs/detection/stfpm/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for STFPM Anomaly Detection Task.""" + +# Copyright (C) 2022 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. + +from .configuration import STFPMAnomalyDetectionConfig + +__all__ = ["STFPMAnomalyDetectionConfig"] diff --git a/external/anomaly/templates/detection/stfpm/compression_config.json b/external/anomaly/configs/detection/stfpm/compression_config.json similarity index 100% rename from external/anomaly/templates/detection/stfpm/compression_config.json rename to external/anomaly/configs/detection/stfpm/compression_config.json diff --git a/external/anomaly/configs/detection/stfpm/configuration.py b/external/anomaly/configs/detection/stfpm/configuration.py new file mode 100644 index 00000000000..e8d4f8debc8 --- /dev/null +++ b/external/anomaly/configs/detection/stfpm/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for STFPM anomaly Detection task.""" + +# Copyright (C) 2022 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. + +from attr import attrs +from configs.stfpm import STFPMAnomalyBaseConfig + + +@attrs +class STFPMAnomalyDetectionConfig(STFPMAnomalyBaseConfig): + """Configurable parameters for STFPM anomaly Detection task.""" diff --git a/external/anomaly/templates/detection/stfpm/configuration.yaml b/external/anomaly/configs/detection/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/templates/detection/stfpm/configuration.yaml rename to external/anomaly/configs/detection/stfpm/configuration.yaml diff --git a/external/anomaly/templates/detection/stfpm/hpo_config.yaml b/external/anomaly/configs/detection/stfpm/hpo_config.yaml similarity index 100% rename from external/anomaly/templates/detection/stfpm/hpo_config.yaml rename to external/anomaly/configs/detection/stfpm/hpo_config.yaml diff --git a/external/anomaly/templates/detection/stfpm/template.yaml b/external/anomaly/configs/detection/stfpm/template.yaml similarity index 100% rename from external/anomaly/templates/detection/stfpm/template.yaml rename to external/anomaly/configs/detection/stfpm/template.yaml diff --git a/external/anomaly/configs/draem/__init__.py b/external/anomaly/configs/draem/__init__.py index 163ebc50f36..e53ec419601 100644 --- a/external/anomaly/configs/draem/__init__.py +++ b/external/anomaly/configs/draem/__init__.py @@ -1,6 +1,4 @@ -""" -Base configuration parameters for Draem -""" +"""Base configuration parameters for Draem.""" # Copyright (C) 2021-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 diff --git a/external/anomaly/configs/draem/configuration.py b/external/anomaly/configs/draem/configuration.py index 0362f21db8d..fd816c8f188 100644 --- a/external/anomaly/configs/draem/configuration.py +++ b/external/anomaly/configs/draem/configuration.py @@ -1,6 +1,4 @@ -""" -Configurable parameters for Draem anomaly task -""" +"""Configurable parameters for Draem anomaly task.""" # Copyright (C) 2021-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 @@ -22,9 +20,7 @@ @attrs class DraemAnomalyBaseConfig(BaseAnomalyConfig): - """ - Configurable parameters for DRAEM anomaly classification task. - """ + """Configurable parameters for DRAEM anomaly classification task.""" header = string_attribute("Configuration for Draem") description = header @@ -59,9 +55,7 @@ class LearningParameters(BaseAnomalyConfig.LearningParameters): @attrs class EarlyStoppingParameters(ParameterGroup): - """ - Early stopping parameters - """ + """Early stopping parameters.""" header = string_attribute("Early Stopping Parameters") description = header diff --git a/external/anomaly/configs/segmentation/__init__.py b/external/anomaly/configs/segmentation/__init__.py new file mode 100644 index 00000000000..540ccf6ad4f --- /dev/null +++ b/external/anomaly/configs/segmentation/__init__.py @@ -0,0 +1,15 @@ +"""Configuration for segmentation tasks.""" + +# Copyright (C) 2022 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/configs/segmentation/draem/__init__.py b/external/anomaly/configs/segmentation/draem/__init__.py new file mode 100644 index 00000000000..fba1af72c8c --- /dev/null +++ b/external/anomaly/configs/segmentation/draem/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for DRAEM Anomaly Segmentation Task.""" + +# Copyright (C) 2022 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. + +from .configuration import DraemAnomalySegmentationConfig + +__all__ = ["DraemAnomalySegmentationConfig"] diff --git a/external/anomaly/templates/detection/draem/compression_config.json b/external/anomaly/configs/segmentation/draem/compression_config.json similarity index 100% rename from external/anomaly/templates/detection/draem/compression_config.json rename to external/anomaly/configs/segmentation/draem/compression_config.json diff --git a/external/anomaly/configs/segmentation/draem/configuration.py b/external/anomaly/configs/segmentation/draem/configuration.py new file mode 100644 index 00000000000..13f0077c8f1 --- /dev/null +++ b/external/anomaly/configs/segmentation/draem/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for DRAEM anomaly Segmentation task.""" + +# 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. + +from attr import attrs +from configs.draem import DraemAnomalyBaseConfig + + +@attrs +class DraemAnomalySegmentationConfig(DraemAnomalyBaseConfig): + """Configurable parameters for DRAEM anomaly Segmentation task.""" diff --git a/external/anomaly/templates/detection/draem/configuration.yaml b/external/anomaly/configs/segmentation/draem/configuration.yaml similarity index 100% rename from external/anomaly/templates/detection/draem/configuration.yaml rename to external/anomaly/configs/segmentation/draem/configuration.yaml diff --git a/external/anomaly/templates/segmentation/draem/template_experimental.yaml b/external/anomaly/configs/segmentation/draem/template_experimental.yaml similarity index 100% rename from external/anomaly/templates/segmentation/draem/template_experimental.yaml rename to external/anomaly/configs/segmentation/draem/template_experimental.yaml diff --git a/external/anomaly/templates/detection/draem/transform_config.yaml b/external/anomaly/configs/segmentation/draem/transform_config.yaml similarity index 100% rename from external/anomaly/templates/detection/draem/transform_config.yaml rename to external/anomaly/configs/segmentation/draem/transform_config.yaml diff --git a/external/anomaly/configs/segmentation/padim/__init__.py b/external/anomaly/configs/segmentation/padim/__init__.py new file mode 100644 index 00000000000..797a8187404 --- /dev/null +++ b/external/anomaly/configs/segmentation/padim/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for PADIM Anomaly Segmentation Task.""" + +# Copyright (C) 2022 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. + +from .configuration import PadimAnomalySegmentationConfig + +__all__ = ["PadimAnomalySegmentationConfig"] diff --git a/external/anomaly/templates/segmentation/draem/compression_config.json b/external/anomaly/configs/segmentation/padim/compression_config.json similarity index 72% rename from external/anomaly/templates/segmentation/draem/compression_config.json rename to external/anomaly/configs/segmentation/padim/compression_config.json index 0b7922f5a23..789f8d131f6 100644 --- a/external/anomaly/templates/segmentation/draem/compression_config.json +++ b/external/anomaly/configs/segmentation/padim/compression_config.json @@ -11,9 +11,6 @@ } }, "nncf_quantization": { - "model": { - "lr": 0.004 - }, "nncf_config": { "compression": [ { @@ -27,7 +24,14 @@ "num_bn_adaptation_samples": 250 } }, - "ignored_scopes": [] + "ignored_scopes": [ + "PadimModel/sqrt_0", + "PadimModel/interpolate_2", + "PadimModel/__truediv___0", + "PadimModel/__truediv___1", + "PadimModel/matmul_1", + "PadimModel/conv2d_0" + ] } ] } diff --git a/external/anomaly/configs/segmentation/padim/configuration.py b/external/anomaly/configs/segmentation/padim/configuration.py new file mode 100644 index 00000000000..0547f13af3e --- /dev/null +++ b/external/anomaly/configs/segmentation/padim/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for Padim anomaly Segmentation task.""" + +# 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. + +from attr import attrs +from configs.padim import PadimAnomalyBaseConfig + + +@attrs +class PadimAnomalySegmentationConfig(PadimAnomalyBaseConfig): + """Configurable parameters for PADIM anomaly Segmentation task.""" diff --git a/external/anomaly/templates/segmentation/padim/configuration.yaml b/external/anomaly/configs/segmentation/padim/configuration.yaml similarity index 100% rename from external/anomaly/templates/segmentation/padim/configuration.yaml rename to external/anomaly/configs/segmentation/padim/configuration.yaml diff --git a/external/anomaly/templates/segmentation/padim/pot_optimization_config.json b/external/anomaly/configs/segmentation/padim/pot_optimization_config.json similarity index 100% rename from external/anomaly/templates/segmentation/padim/pot_optimization_config.json rename to external/anomaly/configs/segmentation/padim/pot_optimization_config.json diff --git a/external/anomaly/templates/segmentation/padim/template.yaml b/external/anomaly/configs/segmentation/padim/template.yaml similarity index 100% rename from external/anomaly/templates/segmentation/padim/template.yaml rename to external/anomaly/configs/segmentation/padim/template.yaml diff --git a/external/anomaly/configs/segmentation/stfpm/__init__.py b/external/anomaly/configs/segmentation/stfpm/__init__.py new file mode 100644 index 00000000000..179c13a396a --- /dev/null +++ b/external/anomaly/configs/segmentation/stfpm/__init__.py @@ -0,0 +1,19 @@ +"""Initialization of Configurable Parameters for STFPM Anomaly Segmentation Task.""" + +# Copyright (C) 2022 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. + +from .configuration import STFPMAnomalySegmentationConfig + +__all__ = ["STFPMAnomalySegmentationConfig"] diff --git a/external/anomaly/templates/segmentation/stfpm/compression_config.json b/external/anomaly/configs/segmentation/stfpm/compression_config.json similarity index 100% rename from external/anomaly/templates/segmentation/stfpm/compression_config.json rename to external/anomaly/configs/segmentation/stfpm/compression_config.json diff --git a/external/anomaly/configs/segmentation/stfpm/configuration.py b/external/anomaly/configs/segmentation/stfpm/configuration.py new file mode 100644 index 00000000000..5f743687e6c --- /dev/null +++ b/external/anomaly/configs/segmentation/stfpm/configuration.py @@ -0,0 +1,23 @@ +"""Configurable parameters for STFPM anomaly Segmentation task.""" + +# Copyright (C) 2022 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. + +from attr import attrs +from configs.stfpm import STFPMAnomalyBaseConfig + + +@attrs +class STFPMAnomalySegmentationConfig(STFPMAnomalyBaseConfig): + """Configurable parameters for STFPM anomaly Segmentation task.""" diff --git a/external/anomaly/templates/segmentation/stfpm/configuration.yaml b/external/anomaly/configs/segmentation/stfpm/configuration.yaml similarity index 100% rename from external/anomaly/templates/segmentation/stfpm/configuration.yaml rename to external/anomaly/configs/segmentation/stfpm/configuration.yaml diff --git a/external/anomaly/templates/segmentation/stfpm/hpo_config.yaml b/external/anomaly/configs/segmentation/stfpm/hpo_config.yaml similarity index 100% rename from external/anomaly/templates/segmentation/stfpm/hpo_config.yaml rename to external/anomaly/configs/segmentation/stfpm/hpo_config.yaml diff --git a/external/anomaly/templates/segmentation/stfpm/template.yaml b/external/anomaly/configs/segmentation/stfpm/template.yaml similarity index 100% rename from external/anomaly/templates/segmentation/stfpm/template.yaml rename to external/anomaly/configs/segmentation/stfpm/template.yaml diff --git a/external/anomaly/tasks/inference.py b/external/anomaly/tasks/inference.py index 76b4ff730dc..1106dffb52a 100644 --- a/external/anomaly/tasks/inference.py +++ b/external/anomaly/tasks/inference.py @@ -36,7 +36,7 @@ from omegaconf import DictConfig, ListConfig from ote_sdk.entities.datasets import DatasetEntity from ote_sdk.entities.inference_parameters import InferenceParameters -from ote_sdk.entities.metrics import Performance, ScoreMetric +from ote_sdk.entities.metrics import NullPerformance, Performance, ScoreMetric from ote_sdk.entities.model import ( ModelEntity, ModelFormat, @@ -283,8 +283,11 @@ def save_model(self, output_model: ModelEntity) -> None: output_model.set_data("label_schema.json", label_schema_to_bytes(self.task_environment.label_schema)) self._set_metadata(output_model) - f1_score = self.model.image_metrics.F1Score.compute().item() - output_model.performance = Performance(score=ScoreMetric(name="F1 Score", value=f1_score)) + if hasattr(self.model, "image_metrics"): + f1_score = self.model.image_metrics.F1Score.compute().item() + output_model.performance = Performance(score=ScoreMetric(name="F1 Score", value=f1_score)) + else: + output_model.performance = NullPerformance() output_model.precision = self.precision output_model.optimization_methods = self.optimization_methods diff --git a/external/anomaly/templates/segmentation/draem/configuration.yaml b/external/anomaly/templates/segmentation/draem/configuration.yaml deleted file mode 100644 index b951d93c574..00000000000 --- a/external/anomaly/templates/segmentation/draem/configuration.yaml +++ /dev/null @@ -1,241 +0,0 @@ -dataset: - description: Dataset Parameters - header: Dataset Parameters - num_workers: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: 8 - description: - Increasing this value might improve training speed however it might - cause out of memory errors. If the number of workers is set to zero, data loading - will happen in the main training thread. - editable: true - header: Number of workers - max_value: 36 - min_value: 0 - type: INTEGER - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - type: PARAMETER_GROUP - visible_in_ui: true -description: Configuration for Draem -header: Configuration for Draem -learning_parameters: - description: Learning Parameters - early_stopping: - description: Early Stopping Parameters - header: Early Stopping Parameters - metric: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: image_AUROC - description: The metric used to determine if the model should stop training - editable: true - enum_name: EarlyStoppingMetrics - header: Early Stopping Metric - options: - IMAGE_F1: image_F1Score - IMAGE_ROC_AUC: image_AUROC - type: SELECTABLE - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - patience: - affects_outcome_of: TRAINING - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: 20 - description: - Number of epochs to wait for an improvement in the monitored metric. - If the metric has not improved for this many epochs, the training will stop - and the best model will be returned. - editable: true - header: Early Stopping Patience - max_value: 100 - min_value: 1 - type: INTEGER - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: - Setting this value too low might lead to underfitting. Setting the - value too high will increase the training time and might lead to overfitting. - type: PARAMETER_GROUP - visible_in_ui: true - header: Learning Parameters - lr: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: 0.0001 - description: Learning rate used for optimizing the network. - editable: true - header: Learning Rate - max_value: 1 - min_value: 0.0001 - type: FLOAT - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - max_epochs: - affects_outcome_of: TRAINING - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: 700 - description: Maximum number of epochs to train the model for. - editable: true - header: Max Epochs - max_value: 700 - min_value: 1 - type: INTEGER - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: - Training for very few epochs might lead to poor performance. If Early - Stopping is enabled then increasing the value of max epochs might not lead to - desired result. - train_batch_size: - affects_outcome_of: TRAINING - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: 8 - description: - The number of training samples seen in each iteration of training. - Increasing this value improves training time and may make the training more - stable. A larger batch size has higher memory requirements. - editable: true - header: Batch size - max_value: 512 - min_value: 1 - type: INTEGER - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: - Increasing this value may cause the system to use more memory than available, - potentially causing out of memory errors, please update with caution. - type: PARAMETER_GROUP - visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - enable_pruning: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: false - description: Enable filter pruning algorithm - editable: true - header: Enable filter pruning algorithm - type: BOOLEAN - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - enable_quantization: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: true - description: Enable quantization algorithm - editable: true - header: Enable quantization algorithm - type: BOOLEAN - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - header: Optimization by NNCF - pruning_supported: - affects_outcome_of: TRAINING - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: false - description: Whether filter pruning is supported - editable: true - header: Whether filter pruning is supported - type: BOOLEAN - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - type: PARAMETER_GROUP - visible_in_ui: true -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: Performance - description: Quantization preset that defines quantization scheme - editable: true - enum_name: POTQuantizationPreset - header: Preset - options: - MIXED: Mixed - PERFORMANCE: Performance - type: SELECTABLE - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - stat_subset_size: - affects_outcome_of: NONE - auto_hpo_state: not_possible - auto_hpo_value: null - default_value: 300 - description: Number of data samples used for post-training optimization - editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER - ui_rules: - action: DISABLE_EDITING - operator: AND - rules: [] - type: UI_RULES - visible_in_ui: true - warning: null - type: PARAMETER_GROUP - visible_in_ui: false -type: CONFIGURABLE_PARAMETERS -visible_in_ui: true diff --git a/external/anomaly/templates/segmentation/draem/transform_config.yaml b/external/anomaly/templates/segmentation/draem/transform_config.yaml deleted file mode 100644 index 5a379ef7628..00000000000 --- a/external/anomaly/templates/segmentation/draem/transform_config.yaml +++ /dev/null @@ -1,26 +0,0 @@ -{ - "__version__": "1.1.0", - "transform": - { - "__class_fullname__": "Compose", - "p": 1.0, - "transforms": - [ - { - "__class_fullname__": "ToFloat", - "always_apply": false, - "p": 1.0, - "max_value": null, - }, - { - "__class_fullname__": "ToTensorV2", - "always_apply": true, - "p": 1.0, - "transpose_mask": false, - }, - ], - "bbox_params": null, - "keypoint_params": null, - "additional_targets": {}, - }, -} From 08cdf117b6b8f40f783af23b9e6a01ed61271608 Mon Sep 17 00:00:00 2001 From: Ashwin Vaidya Date: Tue, 30 Aug 2022 09:24:35 +0200 Subject: [PATCH 3/6] Update nncf compression_config.json path --- external/anomaly/tasks/nncf.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/external/anomaly/tasks/nncf.py b/external/anomaly/tasks/nncf.py index 2c84f299f7a..a5258da4b5f 100644 --- a/external/anomaly/tasks/nncf.py +++ b/external/anomaly/tasks/nncf.py @@ -108,11 +108,7 @@ def load_model(self, ote_model: Optional[ModelEntity]) -> AnomalyModule: AnomalyModule: Anomalib classification or segmentation model with/without weights. """ - # replaces the templates dir with configs and removes task type - anomaly_dir = self.base_dir.partition("/templates/")[0] - nncf_config_path = os.path.join( - anomaly_dir, "configs", self.base_dir.split("/")[-1], "compression_config.json" - ) + nncf_config_path = os.path.join(self.base_dir, "compression_config.json") with open(nncf_config_path, encoding="utf8") as nncf_config_file: common_nncf_config = json.load(nncf_config_file) From b88e150da03741cd3434d5be4cfdc4e3adbe6fc2 Mon Sep 17 00:00:00 2001 From: Ashwin Vaidya Date: Tue, 30 Aug 2022 09:43:15 +0200 Subject: [PATCH 4/6] Disable editable in pruning_supported --- .../anomaly/configs/classification/draem/configuration.yaml | 2 +- .../anomaly/configs/classification/padim/configuration.yaml | 2 +- .../anomaly/configs/classification/stfpm/configuration.yaml | 2 +- external/anomaly/configs/detection/draem/configuration.yaml | 2 +- external/anomaly/configs/detection/padim/configuration.yaml | 2 +- external/anomaly/configs/detection/stfpm/configuration.yaml | 2 +- external/anomaly/configs/segmentation/draem/configuration.yaml | 2 +- external/anomaly/configs/segmentation/padim/configuration.yaml | 2 +- external/anomaly/configs/segmentation/stfpm/configuration.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/external/anomaly/configs/classification/draem/configuration.yaml b/external/anomaly/configs/classification/draem/configuration.yaml index b951d93c574..bdd44dfe21c 100644 --- a/external/anomaly/configs/classification/draem/configuration.yaml +++ b/external/anomaly/configs/classification/draem/configuration.yaml @@ -182,7 +182,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/classification/padim/configuration.yaml b/external/anomaly/configs/classification/padim/configuration.yaml index ff0cc759b8e..1b945ac79a6 100644 --- a/external/anomaly/configs/classification/padim/configuration.yaml +++ b/external/anomaly/configs/classification/padim/configuration.yaml @@ -121,7 +121,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/classification/stfpm/configuration.yaml b/external/anomaly/configs/classification/stfpm/configuration.yaml index 904ef24e36e..2c522c31ce7 100644 --- a/external/anomaly/configs/classification/stfpm/configuration.yaml +++ b/external/anomaly/configs/classification/stfpm/configuration.yaml @@ -250,7 +250,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/detection/draem/configuration.yaml b/external/anomaly/configs/detection/draem/configuration.yaml index b951d93c574..bdd44dfe21c 100644 --- a/external/anomaly/configs/detection/draem/configuration.yaml +++ b/external/anomaly/configs/detection/draem/configuration.yaml @@ -182,7 +182,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/detection/padim/configuration.yaml b/external/anomaly/configs/detection/padim/configuration.yaml index ff0cc759b8e..1b945ac79a6 100644 --- a/external/anomaly/configs/detection/padim/configuration.yaml +++ b/external/anomaly/configs/detection/padim/configuration.yaml @@ -121,7 +121,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/detection/stfpm/configuration.yaml b/external/anomaly/configs/detection/stfpm/configuration.yaml index 904ef24e36e..2c522c31ce7 100644 --- a/external/anomaly/configs/detection/stfpm/configuration.yaml +++ b/external/anomaly/configs/detection/stfpm/configuration.yaml @@ -250,7 +250,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/segmentation/draem/configuration.yaml b/external/anomaly/configs/segmentation/draem/configuration.yaml index b951d93c574..bdd44dfe21c 100644 --- a/external/anomaly/configs/segmentation/draem/configuration.yaml +++ b/external/anomaly/configs/segmentation/draem/configuration.yaml @@ -182,7 +182,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/segmentation/padim/configuration.yaml b/external/anomaly/configs/segmentation/padim/configuration.yaml index ff0cc759b8e..1b945ac79a6 100644 --- a/external/anomaly/configs/segmentation/padim/configuration.yaml +++ b/external/anomaly/configs/segmentation/padim/configuration.yaml @@ -121,7 +121,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: diff --git a/external/anomaly/configs/segmentation/stfpm/configuration.yaml b/external/anomaly/configs/segmentation/stfpm/configuration.yaml index 904ef24e36e..2c522c31ce7 100644 --- a/external/anomaly/configs/segmentation/stfpm/configuration.yaml +++ b/external/anomaly/configs/segmentation/stfpm/configuration.yaml @@ -250,7 +250,7 @@ nncf_optimization: auto_hpo_value: null default_value: false description: Whether filter pruning is supported - editable: true + editable: false header: Whether filter pruning is supported type: BOOLEAN ui_rules: From a80bf6cc56c48d5babb1b726a940e6b9860314e3 Mon Sep 17 00:00:00 2001 From: Ashwin Vaidya Date: Wed, 31 Aug 2022 13:53:02 +0200 Subject: [PATCH 5/6] Remove copy --- .../draem/compression_config copy.json | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 external/anomaly/configs/classification/draem/compression_config copy.json diff --git a/external/anomaly/configs/classification/draem/compression_config copy.json b/external/anomaly/configs/classification/draem/compression_config copy.json deleted file mode 100644 index 789f8d131f6..00000000000 --- a/external/anomaly/configs/classification/draem/compression_config copy.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "base": { - "find_unused_parameters": true, - "target_metric_name": "image_F1Score", - "nncf_config": { - "input_info": { - "sample_size": [1, 3, 256, 256] - }, - "compression": [], - "log_dir": "/tmp" - } - }, - "nncf_quantization": { - "nncf_config": { - "compression": [ - { - "algorithm": "quantization", - "preset": "mixed", - "initializer": { - "range": { - "num_init_samples": 250 - }, - "batchnorm_adaptation": { - "num_bn_adaptation_samples": 250 - } - }, - "ignored_scopes": [ - "PadimModel/sqrt_0", - "PadimModel/interpolate_2", - "PadimModel/__truediv___0", - "PadimModel/__truediv___1", - "PadimModel/matmul_1", - "PadimModel/conv2d_0" - ] - } - ] - } - }, - "order_of_parts": ["nncf_quantization"] -} From 31d21f9555e0b33de2bf0c2fce4e3c452f720ed5 Mon Sep 17 00:00:00 2001 From: Ashwin Vaidya Date: Wed, 31 Aug 2022 15:49:30 +0200 Subject: [PATCH 6/6] Move algorithm/configuration.py to base --- external/anomaly/configs/base/__init__.py | 6 ++++-- external/anomaly/configs/{ => base}/draem/__init__.py | 0 external/anomaly/configs/{ => base}/draem/configuration.py | 2 +- external/anomaly/configs/{ => base}/padim/__init__.py | 0 external/anomaly/configs/{ => base}/padim/configuration.py | 2 +- external/anomaly/configs/{ => base}/stfpm/__init__.py | 0 external/anomaly/configs/{ => base}/stfpm/configuration.py | 2 +- .../anomaly/configs/classification/draem/configuration.py | 2 +- .../anomaly/configs/classification/padim/configuration.py | 2 +- .../anomaly/configs/classification/stfpm/configuration.py | 2 +- external/anomaly/configs/detection/draem/configuration.py | 2 +- external/anomaly/configs/detection/padim/configuration.py | 2 +- external/anomaly/configs/detection/stfpm/configuration.py | 2 +- .../anomaly/configs/segmentation/draem/configuration.py | 2 +- .../anomaly/configs/segmentation/padim/configuration.py | 2 +- .../anomaly/configs/segmentation/stfpm/configuration.py | 2 +- external/anomaly/tools/sample.py | 4 ++-- 17 files changed, 18 insertions(+), 16 deletions(-) rename external/anomaly/configs/{ => base}/draem/__init__.py (100%) rename external/anomaly/configs/{ => base}/draem/configuration.py (98%) rename external/anomaly/configs/{ => base}/padim/__init__.py (100%) rename external/anomaly/configs/{ => base}/padim/configuration.py (96%) rename external/anomaly/configs/{ => base}/stfpm/__init__.py (100%) rename external/anomaly/configs/{ => base}/stfpm/configuration.py (98%) diff --git a/external/anomaly/configs/base/__init__.py b/external/anomaly/configs/base/__init__.py index 6d3bacfd0ee..3ff6c75946b 100644 --- a/external/anomaly/configs/base/__init__.py +++ b/external/anomaly/configs/base/__init__.py @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions # and limitations under the License. -from .configuration import BaseAnomalyConfig +from .draem import DraemAnomalyBaseConfig +from .padim import PadimAnomalyBaseConfig +from .stfpm import STFPMAnomalyBaseConfig -__all__ = ["BaseAnomalyConfig"] +__all__ = ["PadimAnomalyBaseConfig", "STFPMAnomalyBaseConfig", "DraemAnomalyBaseConfig"] diff --git a/external/anomaly/configs/draem/__init__.py b/external/anomaly/configs/base/draem/__init__.py similarity index 100% rename from external/anomaly/configs/draem/__init__.py rename to external/anomaly/configs/base/draem/__init__.py diff --git a/external/anomaly/configs/draem/configuration.py b/external/anomaly/configs/base/draem/configuration.py similarity index 98% rename from external/anomaly/configs/draem/configuration.py rename to external/anomaly/configs/base/draem/configuration.py index fd816c8f188..e3e1b96d7fd 100644 --- a/external/anomaly/configs/draem/configuration.py +++ b/external/anomaly/configs/base/draem/configuration.py @@ -5,7 +5,7 @@ from attr import attrs -from configs.base import BaseAnomalyConfig +from configs.base.configuration import BaseAnomalyConfig from configs.base.configuration_enums import EarlyStoppingMetrics from ote_sdk.configuration.elements import ( ParameterGroup, diff --git a/external/anomaly/configs/padim/__init__.py b/external/anomaly/configs/base/padim/__init__.py similarity index 100% rename from external/anomaly/configs/padim/__init__.py rename to external/anomaly/configs/base/padim/__init__.py diff --git a/external/anomaly/configs/padim/configuration.py b/external/anomaly/configs/base/padim/configuration.py similarity index 96% rename from external/anomaly/configs/padim/configuration.py rename to external/anomaly/configs/base/padim/configuration.py index e3b5e971d90..f1c1c85b5ea 100644 --- a/external/anomaly/configs/padim/configuration.py +++ b/external/anomaly/configs/base/padim/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.base import BaseAnomalyConfig +from configs.base.configuration import BaseAnomalyConfig from configs.base.configuration_enums import ModelBackbone from ote_sdk.configuration.elements import ( add_parameter_group, diff --git a/external/anomaly/configs/stfpm/__init__.py b/external/anomaly/configs/base/stfpm/__init__.py similarity index 100% rename from external/anomaly/configs/stfpm/__init__.py rename to external/anomaly/configs/base/stfpm/__init__.py diff --git a/external/anomaly/configs/stfpm/configuration.py b/external/anomaly/configs/base/stfpm/configuration.py similarity index 98% rename from external/anomaly/configs/stfpm/configuration.py rename to external/anomaly/configs/base/stfpm/configuration.py index d723f08b085..a6337d6f1d9 100644 --- a/external/anomaly/configs/stfpm/configuration.py +++ b/external/anomaly/configs/base/stfpm/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.base import BaseAnomalyConfig +from configs.base.configuration import BaseAnomalyConfig from configs.base.configuration_enums import EarlyStoppingMetrics, ModelBackbone from ote_sdk.configuration.elements import ( ParameterGroup, diff --git a/external/anomaly/configs/classification/draem/configuration.py b/external/anomaly/configs/classification/draem/configuration.py index 0a9ae79d9df..0a3d8d8f150 100644 --- a/external/anomaly/configs/classification/draem/configuration.py +++ b/external/anomaly/configs/classification/draem/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.draem import DraemAnomalyBaseConfig +from configs.base import DraemAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/classification/padim/configuration.py b/external/anomaly/configs/classification/padim/configuration.py index b01b8067a82..cd1e8735b90 100644 --- a/external/anomaly/configs/classification/padim/configuration.py +++ b/external/anomaly/configs/classification/padim/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.padim import PadimAnomalyBaseConfig +from configs.base import PadimAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/classification/stfpm/configuration.py b/external/anomaly/configs/classification/stfpm/configuration.py index e228b21b360..b953742b6c1 100644 --- a/external/anomaly/configs/classification/stfpm/configuration.py +++ b/external/anomaly/configs/classification/stfpm/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.stfpm import STFPMAnomalyBaseConfig +from configs.base import STFPMAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/detection/draem/configuration.py b/external/anomaly/configs/detection/draem/configuration.py index ca60fb6a70c..3e42bec0f7d 100644 --- a/external/anomaly/configs/detection/draem/configuration.py +++ b/external/anomaly/configs/detection/draem/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.draem import DraemAnomalyBaseConfig +from configs.base import DraemAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/detection/padim/configuration.py b/external/anomaly/configs/detection/padim/configuration.py index 40176be20d8..366334dbb2e 100644 --- a/external/anomaly/configs/detection/padim/configuration.py +++ b/external/anomaly/configs/detection/padim/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.padim import PadimAnomalyBaseConfig +from configs.base import PadimAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/detection/stfpm/configuration.py b/external/anomaly/configs/detection/stfpm/configuration.py index e8d4f8debc8..5ee4d510252 100644 --- a/external/anomaly/configs/detection/stfpm/configuration.py +++ b/external/anomaly/configs/detection/stfpm/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.stfpm import STFPMAnomalyBaseConfig +from configs.base import STFPMAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/segmentation/draem/configuration.py b/external/anomaly/configs/segmentation/draem/configuration.py index 13f0077c8f1..de3f6f786f4 100644 --- a/external/anomaly/configs/segmentation/draem/configuration.py +++ b/external/anomaly/configs/segmentation/draem/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.draem import DraemAnomalyBaseConfig +from configs.base import DraemAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/segmentation/padim/configuration.py b/external/anomaly/configs/segmentation/padim/configuration.py index 0547f13af3e..22099a1336d 100644 --- a/external/anomaly/configs/segmentation/padim/configuration.py +++ b/external/anomaly/configs/segmentation/padim/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.padim import PadimAnomalyBaseConfig +from configs.base import PadimAnomalyBaseConfig @attrs diff --git a/external/anomaly/configs/segmentation/stfpm/configuration.py b/external/anomaly/configs/segmentation/stfpm/configuration.py index 5f743687e6c..f3772ca276d 100644 --- a/external/anomaly/configs/segmentation/stfpm/configuration.py +++ b/external/anomaly/configs/segmentation/stfpm/configuration.py @@ -15,7 +15,7 @@ # and limitations under the License. from attr import attrs -from configs.stfpm import STFPMAnomalyBaseConfig +from configs.base import STFPMAnomalyBaseConfig @attrs diff --git a/external/anomaly/tools/sample.py b/external/anomaly/tools/sample.py index 4b381503986..1f5729f9f65 100644 --- a/external/anomaly/tools/sample.py +++ b/external/anomaly/tools/sample.py @@ -81,7 +81,7 @@ def __init__( If MVTec dataset is placed under the above directory, then we could run, - >>> model_template_path = "./configs/anomaly_classification/padim/template.yaml" + >>> model_template_path = "./configs/classification/padim/template.yaml" >>> dataset_path = "./datasets/MVTec" >>> task = OteAnomalyTask( ... dataset_path=dataset_path, @@ -343,7 +343,7 @@ def parse_args() -> Namespace: ) parser.add_argument( "--model_template_path", - default="./templates/classification/padim/template.yaml", + default="./configs/classification/padim/template.yaml", ) parser.add_argument("--dataset_path", default="./datasets/MVTec") parser.add_argument("--category", default="bottle")