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] Revert hpo template #1230

Merged
merged 7 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 15 additions & 0 deletions external/anomaly/configs/classification/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
19 changes: 19 additions & 0 deletions external/anomaly/configs/classification/draem/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
23 changes: 23 additions & 0 deletions external/anomaly/configs/classification/draem/configuration.py
Original file line number Diff line number Diff line change
@@ -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."""
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ entrypoints:

# Hyper Parameters
hyper_parameters:
base_path: ../../../configs/draem/configuration.yaml
base_path: ./configuration.yaml

# Training resources.
max_nodes: 1
Expand Down
19 changes: 19 additions & 0 deletions external/anomaly/configs/classification/padim/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
}
23 changes: 23 additions & 0 deletions external/anomaly/configs/classification/padim/configuration.py
Original file line number Diff line number Diff line change
@@ -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."""
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ entrypoints:

# Hyper Parameters
hyper_parameters:
base_path: ../../../configs/padim/configuration.yaml
base_path: ./configuration.yaml

# Training resources.
max_nodes: 1
Expand Down
19 changes: 19 additions & 0 deletions external/anomaly/configs/classification/stfpm/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
23 changes: 23 additions & 0 deletions external/anomaly/configs/classification/stfpm/configuration.py
Original file line number Diff line number Diff line change
@@ -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."""
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions external/anomaly/configs/detection/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
19 changes: 19 additions & 0 deletions external/anomaly/configs/detection/draem/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
36 changes: 36 additions & 0 deletions external/anomaly/configs/detection/draem/compression_config.json
Original file line number Diff line number Diff line change
@@ -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"]
}
23 changes: 23 additions & 0 deletions external/anomaly/configs/detection/draem/configuration.py
Original file line number Diff line number Diff line change
@@ -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."""
Loading