diff --git a/external/anomaly/anomaly_classification/configs/padim/configuration.py b/external/anomaly/anomaly_classification/configs/padim/configuration.py index 69b1588ab30..d3b7495a96f 100644 --- a/external/anomaly/anomaly_classification/configs/padim/configuration.py +++ b/external/anomaly/anomaly_classification/configs/padim/configuration.py @@ -18,7 +18,13 @@ from attr import attrs from ote_anomalib.configs.configuration import BaseAnomalyConfig -from ote_sdk.configuration.elements import string_attribute +from ote_anomalib.configs.configuration_enums import ModelBackbone +from ote_sdk.configuration.elements import ( + ParameterGroup, + add_parameter_group, + selectable, + string_attribute, +) @attrs @@ -29,3 +35,20 @@ class PadimAnomalyClassificationConfig(BaseAnomalyConfig): header = string_attribute("Configuration for Padim") description = header + + @attrs + class ModelParameters(ParameterGroup): + """ + Parameter Group for tuning the model + """ + + header = string_attribute("Model Parameters") + description = header + + backbone = selectable( + default_value=ModelBackbone.RESNET18, + header="Model Backbone", + description="Pre-trained backbone used for feature extraction", + ) + + model = add_parameter_group(ModelParameters) diff --git a/external/anomaly/anomaly_classification/configs/padim/configuration.yaml b/external/anomaly/anomaly_classification/configs/padim/configuration.yaml index cff368c59e8..690e2560d2f 100644 --- a/external/anomaly/anomaly_classification/configs/padim/configuration.yaml +++ b/external/anomaly/anomaly_classification/configs/padim/configuration.yaml @@ -3,6 +3,8 @@ dataset: 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 @@ -18,10 +20,13 @@ dataset: operator: AND rules: [] type: UI_RULES + value: 8 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. @@ -37,6 +42,7 @@ dataset: 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, @@ -45,50 +51,56 @@ dataset: visible_in_ui: true description: Configuration for Padim header: Configuration for Padim -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: +id: "" +model: + backbone: affects_outcome_of: NONE - default_value: Performance - description: Quantization preset that defines quantization scheme + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction editable: true - enum_name: POTQuantizationPreset - header: Preset + enum_name: ModelBackbone + header: Model Backbone options: - MIXED: Mixed - PERFORMANCE: Performance + 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 - stat_subset_size: + description: Model Parameters + header: Model Parameters + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: affects_outcome_of: NONE - default_value: 300 - description: Number of data samples used for post-training optimization + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER + 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 - type: PARAMETER_GROUP - visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - header: Optimization by NNCF enable_quantization: - affects_outcome_of: TRAINING + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null default_value: true description: Enable quantization algorithm editable: true @@ -102,12 +114,15 @@ nncf_optimization: value: true visible_in_ui: true warning: null - enable_pruning: + header: Optimization by NNCF + pruning_supported: affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null default_value: false - description: Enable filter pruning algorithm + description: Whether filter pruning is supported editable: true - header: Enable filter pruning algorithm + header: Whether filter pruning is supported type: BOOLEAN ui_rules: action: DISABLE_EDITING @@ -117,20 +132,50 @@ nncf_optimization: value: false visible_in_ui: true warning: null - pruning_supported: - affects_outcome_of: TRAINING - default_value: false - description: Whether filter pruning is supported - editable: false - header: Whether filter pruning is supported - type: BOOLEAN + 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: false - visible_in_ui: false + 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 diff --git a/external/anomaly/anomaly_classification/configs/stfpm/configuration.py b/external/anomaly/anomaly_classification/configs/stfpm/configuration.py index cc380f2c7f0..6281dbb8f91 100644 --- a/external/anomaly/anomaly_classification/configs/stfpm/configuration.py +++ b/external/anomaly/anomaly_classification/configs/stfpm/configuration.py @@ -18,10 +18,11 @@ from attr import attrs from ote_anomalib.configs.configuration import BaseAnomalyConfig -from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics +from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics, ModelBackbone from ote_sdk.configuration.elements import ( ParameterGroup, add_parameter_group, + configurable_float, configurable_integer, selectable, string_attribute, @@ -47,6 +48,36 @@ class ModelParameters(ParameterGroup): header = string_attribute("Model Parameters") description = header + backbone = selectable( + default_value=ModelBackbone.RESNET18, + header="Model Backbone", + description="Pre-trained backbone used for teacher and student network", + ) + + lr = configurable_float( + default_value=0.4, + header="Learning Rate", + min_value=1e-3, + max_value=1, + description="Learning rate used for optimizing the Student network.", + ) + + momentum = configurable_float( + default_value=0.9, + header="Momentum", + min_value=0.1, + max_value=1.0, + description="Momentum used for SGD optimizer", + ) + + weight_decay = configurable_float( + default_value=0.0001, + header="Weight Decay", + min_value=1e-5, + max_value=1, + description="Decay for SGD optimizer", + ) + @attrs class EarlyStoppingParameters(ParameterGroup): """ diff --git a/external/anomaly/anomaly_classification/configs/stfpm/configuration.yaml b/external/anomaly/anomaly_classification/configs/stfpm/configuration.yaml index 9facd1e1d1c..6e689673432 100644 --- a/external/anomaly/anomaly_classification/configs/stfpm/configuration.yaml +++ b/external/anomaly/anomaly_classification/configs/stfpm/configuration.yaml @@ -3,6 +3,8 @@ dataset: 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 @@ -18,10 +20,13 @@ dataset: operator: AND rules: [] type: UI_RULES + value: 8 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. @@ -37,6 +42,7 @@ dataset: 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, @@ -45,13 +51,37 @@ dataset: visible_in_ui: true description: Configuration for STFPM header: Configuration for STFPM +id: "" model: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for teacher and student network + 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: Model 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_F1 description: The metric used to determine if the model should stop training editable: true @@ -66,10 +96,13 @@ model: operator: AND rules: [] type: UI_RULES + value: image_F1 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. @@ -85,6 +118,7 @@ model: operator: AND rules: [] type: UI_RULES + value: 10 visible_in_ui: true warning: Setting this value too low might lead to underfitting. Setting the @@ -92,67 +126,71 @@ model: type: PARAMETER_GROUP visible_in_ui: true header: Model Parameters - type: PARAMETER_GROUP - visible_in_ui: true -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: + lr: affects_outcome_of: NONE - default_value: Performance - description: Quantization preset that defines quantization scheme + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.4 + description: Learning rate used for optimizing the Student network. editable: true - enum_name: POTQuantizationPreset - header: Preset - options: - MIXED: Mixed - PERFORMANCE: Performance - type: SELECTABLE + 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 - stat_subset_size: + momentum: affects_outcome_of: NONE - default_value: 300 - description: Number of data samples used for post-training optimization + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.9 + description: Momentum used for SGD optimizer editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER + 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 type: PARAMETER_GROUP visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - header: Optimization by NNCF - enable_quantization: - affects_outcome_of: TRAINING - default_value: true - description: Enable quantization algorithm + 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: Enable quantization algorithm - type: BOOLEAN + 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: true + value: 0.0001 visible_in_ui: true warning: null +nncf_optimization: + description: Optimization by NNCF enable_pruning: - affects_outcome_of: TRAINING + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null default_value: false description: Enable filter pruning algorithm editable: true @@ -166,11 +204,31 @@ nncf_optimization: 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: false + editable: true header: Whether filter pruning is supported type: BOOLEAN ui_rules: @@ -179,7 +237,52 @@ nncf_optimization: rules: [] type: UI_RULES value: false - visible_in_ui: 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 diff --git a/external/anomaly/anomaly_detection/configs/padim/configuration.py b/external/anomaly/anomaly_detection/configs/padim/configuration.py index 141a128841b..f96b2b75741 100644 --- a/external/anomaly/anomaly_detection/configs/padim/configuration.py +++ b/external/anomaly/anomaly_detection/configs/padim/configuration.py @@ -18,7 +18,13 @@ from attr import attrs from ote_anomalib.configs.configuration import BaseAnomalyConfig -from ote_sdk.configuration.elements import string_attribute +from ote_anomalib.configs.configuration_enums import ModelBackbone +from ote_sdk.configuration.elements import ( + ParameterGroup, + add_parameter_group, + selectable, + string_attribute, +) @attrs @@ -29,3 +35,20 @@ class PadimAnomalyDetectionConfig(BaseAnomalyConfig): header = string_attribute("Configuration for Padim") description = header + + @attrs + class ModelParameters(ParameterGroup): + """ + Parameter Group for tuning the model + """ + + header = string_attribute("Model Parameters") + description = header + + backbone = selectable( + default_value=ModelBackbone.RESNET18, + header="Model Backbone", + description="Pre-trained backbone used for feature extraction", + ) + + model = add_parameter_group(ModelParameters) diff --git a/external/anomaly/anomaly_detection/configs/padim/configuration.yaml b/external/anomaly/anomaly_detection/configs/padim/configuration.yaml index cff368c59e8..690e2560d2f 100644 --- a/external/anomaly/anomaly_detection/configs/padim/configuration.yaml +++ b/external/anomaly/anomaly_detection/configs/padim/configuration.yaml @@ -3,6 +3,8 @@ dataset: 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 @@ -18,10 +20,13 @@ dataset: operator: AND rules: [] type: UI_RULES + value: 8 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. @@ -37,6 +42,7 @@ dataset: 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, @@ -45,50 +51,56 @@ dataset: visible_in_ui: true description: Configuration for Padim header: Configuration for Padim -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: +id: "" +model: + backbone: affects_outcome_of: NONE - default_value: Performance - description: Quantization preset that defines quantization scheme + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction editable: true - enum_name: POTQuantizationPreset - header: Preset + enum_name: ModelBackbone + header: Model Backbone options: - MIXED: Mixed - PERFORMANCE: Performance + 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 - stat_subset_size: + description: Model Parameters + header: Model Parameters + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: affects_outcome_of: NONE - default_value: 300 - description: Number of data samples used for post-training optimization + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER + 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 - type: PARAMETER_GROUP - visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - header: Optimization by NNCF enable_quantization: - affects_outcome_of: TRAINING + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null default_value: true description: Enable quantization algorithm editable: true @@ -102,12 +114,15 @@ nncf_optimization: value: true visible_in_ui: true warning: null - enable_pruning: + header: Optimization by NNCF + pruning_supported: affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null default_value: false - description: Enable filter pruning algorithm + description: Whether filter pruning is supported editable: true - header: Enable filter pruning algorithm + header: Whether filter pruning is supported type: BOOLEAN ui_rules: action: DISABLE_EDITING @@ -117,20 +132,50 @@ nncf_optimization: value: false visible_in_ui: true warning: null - pruning_supported: - affects_outcome_of: TRAINING - default_value: false - description: Whether filter pruning is supported - editable: false - header: Whether filter pruning is supported - type: BOOLEAN + 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: false - visible_in_ui: false + 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 diff --git a/external/anomaly/anomaly_detection/configs/stfpm/configuration.py b/external/anomaly/anomaly_detection/configs/stfpm/configuration.py index b8b885461e3..2b1ab7fd601 100644 --- a/external/anomaly/anomaly_detection/configs/stfpm/configuration.py +++ b/external/anomaly/anomaly_detection/configs/stfpm/configuration.py @@ -18,10 +18,11 @@ from attr import attrs from ote_anomalib.configs.configuration import BaseAnomalyConfig -from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics +from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics, ModelBackbone from ote_sdk.configuration.elements import ( ParameterGroup, add_parameter_group, + configurable_float, configurable_integer, selectable, string_attribute, @@ -47,6 +48,36 @@ class ModelParameters(ParameterGroup): header = string_attribute("Model Parameters") description = header + backbone = selectable( + default_value=ModelBackbone.RESNET18, + header="Model Backbone", + description="Pre-trained backbone used for teacher and student network", + ) + + lr = configurable_float( + default_value=0.4, + header="Learning Rate", + min_value=1e-3, + max_value=1, + description="Learning rate used for optimizing the Student network.", + ) + + momentum = configurable_float( + default_value=0.9, + header="Momentum", + min_value=0.1, + max_value=1.0, + description="Momentum used for SGD optimizer", + ) + + weight_decay = configurable_float( + default_value=0.0001, + header="Weight Decay", + min_value=1e-5, + max_value=1, + description="Decay for SGD optimizer", + ) + @attrs class EarlyStoppingParameters(ParameterGroup): """ diff --git a/external/anomaly/anomaly_detection/configs/stfpm/configuration.yaml b/external/anomaly/anomaly_detection/configs/stfpm/configuration.yaml index 9facd1e1d1c..6e689673432 100644 --- a/external/anomaly/anomaly_detection/configs/stfpm/configuration.yaml +++ b/external/anomaly/anomaly_detection/configs/stfpm/configuration.yaml @@ -3,6 +3,8 @@ dataset: 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 @@ -18,10 +20,13 @@ dataset: operator: AND rules: [] type: UI_RULES + value: 8 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. @@ -37,6 +42,7 @@ dataset: 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, @@ -45,13 +51,37 @@ dataset: visible_in_ui: true description: Configuration for STFPM header: Configuration for STFPM +id: "" model: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for teacher and student network + 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: Model 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_F1 description: The metric used to determine if the model should stop training editable: true @@ -66,10 +96,13 @@ model: operator: AND rules: [] type: UI_RULES + value: image_F1 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. @@ -85,6 +118,7 @@ model: operator: AND rules: [] type: UI_RULES + value: 10 visible_in_ui: true warning: Setting this value too low might lead to underfitting. Setting the @@ -92,67 +126,71 @@ model: type: PARAMETER_GROUP visible_in_ui: true header: Model Parameters - type: PARAMETER_GROUP - visible_in_ui: true -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: + lr: affects_outcome_of: NONE - default_value: Performance - description: Quantization preset that defines quantization scheme + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.4 + description: Learning rate used for optimizing the Student network. editable: true - enum_name: POTQuantizationPreset - header: Preset - options: - MIXED: Mixed - PERFORMANCE: Performance - type: SELECTABLE + 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 - stat_subset_size: + momentum: affects_outcome_of: NONE - default_value: 300 - description: Number of data samples used for post-training optimization + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.9 + description: Momentum used for SGD optimizer editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER + 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 type: PARAMETER_GROUP visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - header: Optimization by NNCF - enable_quantization: - affects_outcome_of: TRAINING - default_value: true - description: Enable quantization algorithm + 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: Enable quantization algorithm - type: BOOLEAN + 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: true + value: 0.0001 visible_in_ui: true warning: null +nncf_optimization: + description: Optimization by NNCF enable_pruning: - affects_outcome_of: TRAINING + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null default_value: false description: Enable filter pruning algorithm editable: true @@ -166,11 +204,31 @@ nncf_optimization: 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: false + editable: true header: Whether filter pruning is supported type: BOOLEAN ui_rules: @@ -179,7 +237,52 @@ nncf_optimization: rules: [] type: UI_RULES value: false - visible_in_ui: 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 diff --git a/external/anomaly/anomaly_segmentation/configs/padim/configuration.py b/external/anomaly/anomaly_segmentation/configs/padim/configuration.py index 7be758adb1b..90b25deeddf 100644 --- a/external/anomaly/anomaly_segmentation/configs/padim/configuration.py +++ b/external/anomaly/anomaly_segmentation/configs/padim/configuration.py @@ -18,7 +18,13 @@ from attr import attrs from ote_anomalib.configs.configuration import BaseAnomalyConfig -from ote_sdk.configuration.elements import string_attribute +from ote_anomalib.configs.configuration_enums import ModelBackbone +from ote_sdk.configuration.elements import ( + ParameterGroup, + add_parameter_group, + selectable, + string_attribute, +) @attrs @@ -29,3 +35,20 @@ class PadimAnomalySegmentationConfig(BaseAnomalyConfig): header = string_attribute("Configuration for Padim") description = header + + @attrs + class ModelParameters(ParameterGroup): + """ + Parameter Group for tuning the model + """ + + header = string_attribute("Model Parameters") + description = header + + backbone = selectable( + default_value=ModelBackbone.RESNET18, + header="Model Backbone", + description="Pre-trained backbone used for feature extraction", + ) + + model = add_parameter_group(ModelParameters) diff --git a/external/anomaly/anomaly_segmentation/configs/padim/configuration.yaml b/external/anomaly/anomaly_segmentation/configs/padim/configuration.yaml index cff368c59e8..690e2560d2f 100644 --- a/external/anomaly/anomaly_segmentation/configs/padim/configuration.yaml +++ b/external/anomaly/anomaly_segmentation/configs/padim/configuration.yaml @@ -3,6 +3,8 @@ dataset: 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 @@ -18,10 +20,13 @@ dataset: operator: AND rules: [] type: UI_RULES + value: 8 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. @@ -37,6 +42,7 @@ dataset: 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, @@ -45,50 +51,56 @@ dataset: visible_in_ui: true description: Configuration for Padim header: Configuration for Padim -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: +id: "" +model: + backbone: affects_outcome_of: NONE - default_value: Performance - description: Quantization preset that defines quantization scheme + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for feature extraction editable: true - enum_name: POTQuantizationPreset - header: Preset + enum_name: ModelBackbone + header: Model Backbone options: - MIXED: Mixed - PERFORMANCE: Performance + 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 - stat_subset_size: + description: Model Parameters + header: Model Parameters + type: PARAMETER_GROUP + visible_in_ui: true +nncf_optimization: + description: Optimization by NNCF + enable_pruning: affects_outcome_of: NONE - default_value: 300 - description: Number of data samples used for post-training optimization + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: false + description: Enable filter pruning algorithm editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER + 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 - type: PARAMETER_GROUP - visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - header: Optimization by NNCF enable_quantization: - affects_outcome_of: TRAINING + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null default_value: true description: Enable quantization algorithm editable: true @@ -102,12 +114,15 @@ nncf_optimization: value: true visible_in_ui: true warning: null - enable_pruning: + header: Optimization by NNCF + pruning_supported: affects_outcome_of: TRAINING + auto_hpo_state: not_possible + auto_hpo_value: null default_value: false - description: Enable filter pruning algorithm + description: Whether filter pruning is supported editable: true - header: Enable filter pruning algorithm + header: Whether filter pruning is supported type: BOOLEAN ui_rules: action: DISABLE_EDITING @@ -117,20 +132,50 @@ nncf_optimization: value: false visible_in_ui: true warning: null - pruning_supported: - affects_outcome_of: TRAINING - default_value: false - description: Whether filter pruning is supported - editable: false - header: Whether filter pruning is supported - type: BOOLEAN + 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: false - visible_in_ui: false + 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 diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.py b/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.py index df17aefc323..67d3bbc4e3c 100644 --- a/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.py +++ b/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.py @@ -18,10 +18,11 @@ from attr import attrs from ote_anomalib.configs.configuration import BaseAnomalyConfig -from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics +from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics, ModelBackbone from ote_sdk.configuration.elements import ( ParameterGroup, add_parameter_group, + configurable_float, configurable_integer, selectable, string_attribute, @@ -47,6 +48,36 @@ class ModelParameters(ParameterGroup): header = string_attribute("Model Parameters") description = header + backbone = selectable( + default_value=ModelBackbone.RESNET18, + header="Model Backbone", + description="Pre-trained backbone used for teacher and student network", + ) + + lr = configurable_float( + default_value=0.4, + header="Learning Rate", + min_value=1e-3, + max_value=1, + description="Learning rate used for optimizing the Student network.", + ) + + momentum = configurable_float( + default_value=0.9, + header="Momentum", + min_value=0.1, + max_value=1.0, + description="Momentum used for SGD optimizer", + ) + + weight_decay = configurable_float( + default_value=0.0001, + header="Weight Decay", + min_value=1e-5, + max_value=1, + description="Decay for SGD optimizer", + ) + @attrs class EarlyStoppingParameters(ParameterGroup): """ diff --git a/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.yaml b/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.yaml index 9facd1e1d1c..6e689673432 100644 --- a/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.yaml +++ b/external/anomaly/anomaly_segmentation/configs/stfpm/configuration.yaml @@ -3,6 +3,8 @@ dataset: 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 @@ -18,10 +20,13 @@ dataset: operator: AND rules: [] type: UI_RULES + value: 8 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. @@ -37,6 +42,7 @@ dataset: 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, @@ -45,13 +51,37 @@ dataset: visible_in_ui: true description: Configuration for STFPM header: Configuration for STFPM +id: "" model: + backbone: + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: resnet18 + description: Pre-trained backbone used for teacher and student network + 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: Model 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_F1 description: The metric used to determine if the model should stop training editable: true @@ -66,10 +96,13 @@ model: operator: AND rules: [] type: UI_RULES + value: image_F1 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. @@ -85,6 +118,7 @@ model: operator: AND rules: [] type: UI_RULES + value: 10 visible_in_ui: true warning: Setting this value too low might lead to underfitting. Setting the @@ -92,67 +126,71 @@ model: type: PARAMETER_GROUP visible_in_ui: true header: Model Parameters - type: PARAMETER_GROUP - visible_in_ui: true -pot_parameters: - description: POT Parameters - header: POT Parameters - preset: + lr: affects_outcome_of: NONE - default_value: Performance - description: Quantization preset that defines quantization scheme + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.4 + description: Learning rate used for optimizing the Student network. editable: true - enum_name: POTQuantizationPreset - header: Preset - options: - MIXED: Mixed - PERFORMANCE: Performance - type: SELECTABLE + 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 - stat_subset_size: + momentum: affects_outcome_of: NONE - default_value: 300 - description: Number of data samples used for post-training optimization + auto_hpo_state: not_possible + auto_hpo_value: null + default_value: 0.9 + description: Momentum used for SGD optimizer editable: true - header: Number of data samples - max_value: 9223372036854775807 - min_value: 1 - type: INTEGER + 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 type: PARAMETER_GROUP visible_in_ui: true -nncf_optimization: - description: Optimization by NNCF - header: Optimization by NNCF - enable_quantization: - affects_outcome_of: TRAINING - default_value: true - description: Enable quantization algorithm + 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: Enable quantization algorithm - type: BOOLEAN + 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: true + value: 0.0001 visible_in_ui: true warning: null +nncf_optimization: + description: Optimization by NNCF enable_pruning: - affects_outcome_of: TRAINING + affects_outcome_of: NONE + auto_hpo_state: not_possible + auto_hpo_value: null default_value: false description: Enable filter pruning algorithm editable: true @@ -166,11 +204,31 @@ nncf_optimization: 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: false + editable: true header: Whether filter pruning is supported type: BOOLEAN ui_rules: @@ -179,7 +237,52 @@ nncf_optimization: rules: [] type: UI_RULES value: false - visible_in_ui: 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 diff --git a/external/anomaly/ote_anomalib/configs/configuration_enums.py b/external/anomaly/ote_anomalib/configs/configuration_enums.py index b95bb34e479..62e98b67698 100644 --- a/external/anomaly/ote_anomalib/configs/configuration_enums.py +++ b/external/anomaly/ote_anomalib/configs/configuration_enums.py @@ -44,3 +44,12 @@ class ModelName(ConfigurableEnum): STFPM = "stfpm" PADIM = "padim" + + +class ModelBackbone(ConfigurableEnum): + """ + This enum represents the common backbones that can be used with Padim and STFPM + """ + + RESNET18 = "resnet18" + WIDE_RESNET_50 = "wide_resnet50_2"