Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Anomaly Task] Expose more params to the UI #1085

Merged
merged 4 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@
# and limitations under the License.

from attr import attrs
from ote_anomalib.configs.configuration import BaseAnomalyConfig
from ote_sdk.configuration.elements import string_attribute
from ote_anomalib.configs.padim import PadimAnomalyBaseConfig


@attrs
class PadimAnomalyClassificationConfig(BaseAnomalyConfig):
class PadimAnomalyClassificationConfig(PadimAnomalyBaseConfig):
"""
Configurable parameters for PADIM anomaly classification task.
"""

header = string_attribute("Configuration for Padim")
description = header
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,64 +17,11 @@
# and limitations under the License.

from attr import attrs
from ote_anomalib.configs.configuration import BaseAnomalyConfig
from ote_anomalib.configs.configuration_enums import EarlyStoppingMetrics
from ote_sdk.configuration.elements import (
ParameterGroup,
add_parameter_group,
configurable_integer,
selectable,
string_attribute,
)
from ote_sdk.configuration.model_lifecycle import ModelLifecycle
from ote_anomalib.configs.stfpm import STFPMAnomalyBaseConfig


@attrs
class STFPMAnomalyClassificationConfig(BaseAnomalyConfig):
class STFPMAnomalyClassificationConfig(STFPMAnomalyBaseConfig):
"""
Configurable parameters for STFPM anomaly classification task.
"""

header = string_attribute("Configuration for STFPM")
description = header

@attrs
class ModelParameters(ParameterGroup):
"""
Parameter Group for training model
"""

header = string_attribute("Model Parameters")
description = header

@attrs
class EarlyStoppingParameters(ParameterGroup):
"""
Early stopping parameters
"""

header = string_attribute("Early Stopping Parameters")
description = header

metric = selectable(
default_value=EarlyStoppingMetrics.IMAGE_F1,
header="Early Stopping Metric",
description="The metric used to determine if the model should stop training",
)

patience = configurable_integer(
default_value=10,
min_value=1,
max_value=100,
header="Early Stopping Patience",
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.",
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.",
affects_outcome_of=ModelLifecycle.TRAINING,
)

early_stopping = add_parameter_group(EarlyStoppingParameters)

model = add_parameter_group(ModelParameters)
Loading