Skip to content

Commit

Permalink
Fix tiling 0 stride issue in parameter adapter (openvinotoolkit#2078)
Browse files Browse the repository at this point in the history
fix tiling 0 stride issue
  • Loading branch information
eugene123tw authored and goodsong81 committed Apr 27, 2023
1 parent 1b3ba85 commit 57f1e67
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion otx/algorithms/common/configs/training_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class BaseTilingParameters(ParameterGroup):
description="Overlap between each two neighboring tiles.",
default_value=0.2,
min_value=0.0,
max_value=1.0,
max_value=0.9,
affects_outcome_of=ModelLifecycle.NONE,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ tiling_parameters:
affects_outcome_of: TRAINING
default_value: 0.2
min_value: 0.0
max_value: 1.0
max_value: 0.9
type: FLOAT
editable: true
ui_rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ tiling_parameters:
affects_outcome_of: TRAINING
default_value: 0.2
min_value: 0.0
max_value: 1.0
max_value: 0.9
type: FLOAT
editable: true
ui_rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ tiling_parameters:
affects_outcome_of: TRAINING
default_value: 0.2
min_value: 0.0
max_value: 1.0
max_value: 0.9
type: FLOAT
editable: true
ui_rules:
Expand Down
4 changes: 4 additions & 0 deletions otx/algorithms/detection/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ def adaptive_tile_params(
tile_size = int(math.sqrt(object_area / object_tile_ratio))
tile_overlap = max_area / (tile_size**2)

if tile_overlap >= tiling_parameters.get_metadata("tile_overlap")["max_value"]:
# Use the average object area if the tile overlap is too large to prevent 0 stride.
tile_overlap = object_area / (tile_size**2)

# validate parameters are in range
tile_size = max(
tiling_parameters.get_metadata("tile_size")["min_value"],
Expand Down

0 comments on commit 57f1e67

Please sign in to comment.