Skip to content

Commit

Permalink
Expose more parame to the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Vaidya committed May 2, 2022
1 parent 2cf0444 commit 14e35c0
Show file tree
Hide file tree
Showing 13 changed files with 828 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
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 @@ -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,
Expand All @@ -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):
"""
Expand Down
Loading

0 comments on commit 14e35c0

Please sign in to comment.