Skip to content

Commit 3825b1b

Browse files
Songki Choicih9088nikita-savelyevvjaegukhyun
authored
[FIX][REL1.0] Fix Geti integration issues (#1885)
* Fix ote_config -> otx_config * [FIX] hang issue when tracing a stack in certain scenario (#1868) fix: use primitive library * [FIX][POT] Set stat_requests_number parameter to 1 (#1870) Set POT stat_requests_number parameter to 1 in order to lower RAM footprint * [FIX] Training error when batch size is 1 (#1872) fix: drop last batch * Recover detection num_workers=2 * Remove nbmake from base requirements * Add py.typed in package * [FIX] Arrange scale between bbox preds and bbox targets in ATSS (#1880) Arrange scale between bbox preds and bbox targets --------- Co-authored-by: Inhyuk Cho <[email protected]> Co-authored-by: Nikita Savelyev <[email protected]> Co-authored-by: Jaeguk Hyun <[email protected]>
1 parent a5781b4 commit 3825b1b

File tree

11 files changed

+33
-23
lines changed

11 files changed

+33
-23
lines changed

otx/algorithms/detection/adapters/mmdet/nncf/patches.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,18 @@ def _wrap_is_in_onnx_export(ctx, fn):
129129
# possible alternatives
130130
# - take the onnx branch in all cases
131131

132-
import inspect
132+
import sys
133133

134-
stack = inspect.stack()
135-
frame_info = stack[2]
134+
frame = sys._getframe()
135+
ctr = 2
136+
while frame is not None and ctr:
137+
frame = frame.f_back
138+
ctr -= 1
136139
if (
137-
frame_info.function == "forward"
138-
and "self" in frame_info.frame.f_locals.keys()
139-
and frame_info.frame.f_locals["self"].__class__.__name__ == "SingleRoIExtractor"
140+
frame is not None
141+
and frame.f_code.co_name == "forward"
142+
and "self" in frame.f_locals.keys()
143+
and frame.f_locals["self"].__class__.__name__ == "SingleRoIExtractor"
140144
):
141145
return fn() or is_in_nncf_tracing()
142146
return fn()

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: 0
104+
default_value: 2
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/algorithms/detection/configs/instance_segmentation/efficientnetb2b_maskrcnn/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ hyper_parameters:
3737
default_value: 100
3838
pot_parameters:
3939
stat_requests_number:
40-
default_value: 2
40+
default_value: 1
4141
nncf_optimization:
4242
enable_quantization:
4343
default_value: true

otx/algorithms/detection/configs/instance_segmentation/resnet50_maskrcnn/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ hyper_parameters:
3737
default_value: 100
3838
pot_parameters:
3939
stat_requests_number:
40-
default_value: 2
40+
default_value: 1
4141
nncf_optimization:
4242
enable_quantization:
4343
default_value: true

otx/algorithms/detection/configs/rotated_detection/efficientnetb2b_maskrcnn/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ hyper_parameters:
3737
default_value: 100
3838
pot_parameters:
3939
stat_requests_number:
40-
default_value: 2
40+
default_value: 1
4141
nncf_optimization:
4242
enable_quantization:
4343
default_value: true

otx/algorithms/detection/configs/rotated_detection/resnet50_maskrcnn/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ hyper_parameters:
3737
default_value: 100
3838
pot_parameters:
3939
stat_requests_number:
40-
default_value: 2
40+
default_value: 1
4141
nncf_optimization:
4242
enable_quantization:
4343
default_value: true

otx/api/configuration/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515

1616

17-
import otx.api.configuration.helper as ote_config_helper # for 'ote' backward compatibility
17+
import otx.api.configuration.helper as otx_config_helper # for backward compatibility
1818
import otx.api.configuration.helper as cfg_helper # pylint: disable=reimported
1919
from otx.api.configuration.elements import metadata_keys
2020
from otx.api.configuration.elements.configurable_enum import ConfigurableEnum
@@ -27,7 +27,7 @@
2727
__all__ = [
2828
"metadata_keys",
2929
"cfg_helper",
30-
"ote_config_helper",
30+
"otx_config_helper",
3131
"ConfigurableEnum",
3232
"ModelLifecycle",
3333
"Action",

otx/mpa/modules/models/heads/custom_atss_head.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,16 @@ def loss_single(
168168
pos_centerness = centerness[pos_inds]
169169

170170
centerness_targets = self.centerness_target(pos_anchors, pos_bbox_targets)
171-
pos_decode_bbox_pred = self.bbox_coder.decode(pos_anchors, pos_bbox_pred)
172-
pos_decode_bbox_targets = self.bbox_coder.decode(pos_anchors, pos_bbox_targets)
171+
if self.reg_decoded_bbox:
172+
pos_bbox_pred = self.bbox_coder.decode(pos_anchors, pos_bbox_pred)
173173

174174
if self.use_qfl:
175-
quality[pos_inds] = bbox_overlaps(
176-
pos_decode_bbox_pred.detach(), pos_decode_bbox_targets, is_aligned=True
177-
).clamp(min=1e-6)
175+
quality[pos_inds] = bbox_overlaps(pos_bbox_pred.detach(), pos_bbox_targets, is_aligned=True).clamp(
176+
min=1e-6
177+
)
178178

179179
# regression loss
180-
loss_bbox = self.loss_bbox(
181-
pos_decode_bbox_pred, pos_decode_bbox_targets, weight=centerness_targets, avg_factor=1.0
182-
)
180+
loss_bbox = self.loss_bbox(pos_bbox_pred, pos_bbox_targets, weight=centerness_targets, avg_factor=1.0)
183181

184182
# centerness loss
185183
loss_centerness = self.loss_centerness(pos_centerness, centerness_targets, avg_factor=num_total_samples)

otx/mpa/stage.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,17 @@ def configure_samples_per_gpu(
306306

307307
if distributed:
308308
dataset_len = dataset_len // dist.get_world_size()
309+
310+
# set batch size as a total dataset
311+
# if it is smaller than total dataset
309312
if dataset_len < samples_per_gpu:
310313
dataloader_cfg.samples_per_gpu = dataset_len
314+
315+
# drop the last batch if the last batch size is 1
316+
# batch size of 1 is a runtime error for training batch normalization layer
317+
if subset in ("train", "unlabeled") and dataset_len % samples_per_gpu == 1:
318+
dataloader_cfg.drop_last = True
319+
311320
cfg.data[f"{subset}_dataloader"] = dataloader_cfg
312321

313322
@staticmethod

requirements/base.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
22
# Base Algo Requirements. #
33
natsort>=6.0.0
4-
nbmake
54
prettytable
65
protobuf>=3.20.0
76
pyyaml

0 commit comments

Comments
 (0)