Skip to content

Commit 3f9987a

Browse files
author
Songki Choi
authored
[HOTFIX][Release1.0] Patches for Geti integration (#1836)
* Fix doc link to stable * Apply FEATURE_FLAGS mechanism for action tasks * Fix pre-commit * Set num_workers=0 for detection --------- Signed-off-by: Songki Choi <[email protected]>
1 parent 614142f commit 3f9987a

File tree

8 files changed

+61
-32
lines changed

8 files changed

+61
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ All notable changes to this project will be documented in this file.
2222
- Enhance `find` command to find configurations of supported tasks / algorithms / models / backbones
2323
- Introduce `build` command to customize task or model configurations in isolated workspace
2424
- Auto-config feature to automatically select the right algorithm and default model for the `train` & `build` command by detecting the task type of given input dataset
25-
- Improve [documentation](https://openvinotoolkit.github.io/training_extensions/guide/get_started/introduction.html)
25+
- Improve [documentation](https://openvinotoolkit.github.io/training_extensions/stable/guide/get_started/introduction.html)
2626
- Improve training performance by introducing enhanced loss for the few-shot transfer
2727

2828
### Bug fixes

otx/algorithms/action/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
# Copyright (C) 2022 Intel Corporation
44
# SPDX-License-Identifier: Apache-2.0
5+
6+
import os
7+
8+
os.environ["FEATURE_FLAGS_OTX_ACTION_TASKS"] = "1"

otx/algorithms/detection/configs/detection/configuration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ learning_parameters:
101101
warning: null
102102
num_workers:
103103
affects_outcome_of: NONE
104-
default_value: 2
104+
default_value: 0
105105
description:
106106
Increasing this value might improve training speed however it might
107107
cause out of memory errors. If the number of workers is set to zero, data loading

otx/api/entities/label.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
import datetime
8+
import os
89
from enum import Enum, auto
910
from typing import Optional
1011

@@ -25,8 +26,9 @@ class Domain(Enum):
2526
ANOMALY_SEGMENTATION = auto()
2627
INSTANCE_SEGMENTATION = auto()
2728
ROTATED_DETECTION = auto()
28-
ACTION_CLASSIFICATION = auto()
29-
ACTION_DETECTION = auto()
29+
if os.getenv("FEATURE_FLAGS_OTX_ACTION_TASKS", "0") == "1":
30+
ACTION_CLASSIFICATION = auto()
31+
ACTION_DETECTION = auto()
3032

3133
def __str__(self):
3234
"""Returns Domain name."""

otx/api/entities/model_template.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,17 @@ def __new__(cls, *args):
205205
is_global=False,
206206
is_local=True,
207207
)
208-
ACTION_CLASSIFICATION = 14, TaskInfo(
209-
domain=Domain.ACTION_CLASSIFICATION,
210-
is_trainable=True,
211-
is_anomaly=False,
212-
is_global=False,
213-
is_local=True,
214-
)
215-
ACTION_DETECTION = 15, TaskInfo(
216-
domain=Domain.ACTION_DETECTION, is_trainable=True, is_anomaly=False, is_global=False, is_local=True
217-
)
208+
if os.getenv("FEATURE_FLAGS_OTX_ACTION_TASKS", "0") == "1":
209+
ACTION_CLASSIFICATION = 14, TaskInfo(
210+
domain=Domain.ACTION_CLASSIFICATION,
211+
is_trainable=True,
212+
is_anomaly=False,
213+
is_global=False,
214+
is_local=True,
215+
)
216+
ACTION_DETECTION = 15, TaskInfo(
217+
domain=Domain.ACTION_DETECTION, is_trainable=True, is_anomaly=False, is_global=False, is_local=True
218+
)
218219

219220
def __str__(self) -> str:
220221
"""Returns name."""
@@ -246,9 +247,13 @@ def task_type_to_label_domain(task_type: TaskType) -> Domain:
246247
TaskType.ANOMALY_DETECTION: Domain.ANOMALY_DETECTION,
247248
TaskType.ANOMALY_SEGMENTATION: Domain.ANOMALY_SEGMENTATION,
248249
TaskType.ROTATED_DETECTION: Domain.ROTATED_DETECTION,
249-
TaskType.ACTION_CLASSIFICATION: Domain.ACTION_CLASSIFICATION,
250-
TaskType.ACTION_DETECTION: Domain.ACTION_DETECTION,
251250
}
251+
if os.getenv("FEATURE_FLAGS_OTX_ACTION_TASKS", "0") == "1":
252+
mapping = {
253+
**mapping,
254+
TaskType.ACTION_CLASSIFICATION: Domain.ACTION_CLASSIFICATION,
255+
TaskType.ACTION_DETECTION: Domain.ACTION_DETECTION,
256+
}
252257

253258
try:
254259
return mapping[task_type]
@@ -581,9 +586,13 @@ def __init__(self) -> None:
581586
TaskType.ANOMALY_CLASSIFICATION,
582587
TaskType.ANOMALY_SEGMENTATION,
583588
TaskType.ROTATED_DETECTION,
584-
TaskType.ACTION_CLASSIFICATION,
585-
TaskType.ACTION_DETECTION,
586589
)
590+
if os.getenv("FEATURE_FLAGS_OTX_ACTION_TASKS", "0") == "1":
591+
TRAINABLE_TASK_TYPES = (
592+
*TRAINABLE_TASK_TYPES,
593+
TaskType.ACTION_CLASSIFICATION,
594+
TaskType.ACTION_DETECTION,
595+
)
587596

588597

589598
def _parse_model_template_from_omegaconf(config: Union[DictConfig, ListConfig]) -> ModelTemplate:

otx/cli/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
"""OTX CLI."""
22

3-
# Copyright (C) 2021-2022 Intel Corporation
3+
# Copyright (C) 2021-2023 Intel Corporation
44
# SPDX-License-Identifier: Apache-2.0
5+
6+
import os
7+
8+
os.environ["FEATURE_FLAGS_OTX_ACTION_TASKS"] = "1"

otx/core/data/adapter/__init__.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# pylint: disable=too-many-return-statements
1818
import importlib
19+
import os
1920

2021
from otx.algorithms.common.configs.training_base import TrainType
2122
from otx.api.entities.model_template import TaskType
@@ -55,18 +56,6 @@
5556
"class": "SelfSLSegmentationDatasetAdapter",
5657
},
5758
},
58-
TaskType.ACTION_CLASSIFICATION: {
59-
"INCREMENTAL": {
60-
"module_name": "action_dataset_adapter",
61-
"class": "ActionClassificationDatasetAdapter",
62-
}
63-
},
64-
TaskType.ACTION_DETECTION: {
65-
"INCREMENTAL": {
66-
"module_name": "action_dataset_adapter",
67-
"class": "ActionDetectionDatasetAdapter",
68-
}
69-
},
7059
TaskType.ANOMALY_CLASSIFICATION: {
7160
"INCREMENTAL": {
7261
"module_name": "anomaly_dataset_adapter",
@@ -86,6 +75,23 @@
8675
}
8776
},
8877
}
78+
if os.getenv("FEATURE_FLAGS_OTX_ACTION_TASKS", "0") == "1":
79+
ADAPTERS.update(
80+
{
81+
TaskType.ACTION_CLASSIFICATION: {
82+
"INCREMENTAL": {
83+
"module_name": "action_dataset_adapter",
84+
"class": "ActionClassificationDatasetAdapter",
85+
}
86+
},
87+
TaskType.ACTION_DETECTION: {
88+
"INCREMENTAL": {
89+
"module_name": "action_dataset_adapter",
90+
"class": "ActionDetectionDatasetAdapter",
91+
}
92+
},
93+
}
94+
)
8995

9096

9197
def get_dataset_adapter(

tests/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 Intel Corporation
1+
# Copyright (C) 2022-2023 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -11,3 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions
1313
# and limitations under the License.
14+
15+
import os
16+
17+
os.environ["FEATURE_FLAGS_OTX_ACTION_TASKS"] = "1"

0 commit comments

Comments
 (0)