Skip to content

Commit

Permalink
Merge pull request #1301 from openvinotoolkit/eugene/CVS-94542-tiling…
Browse files Browse the repository at this point in the history
…-bug

Fix tiling bug
  • Loading branch information
eugene123tw authored Oct 19, 2022
2 parents 00ff662 + c0bb70f commit 89754c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ class __TilingParameters(ParameterGroup):
header="Tile Image Size",
description="Tile Image Size",
default_value=400,
min_value=1024,
max_value=maxsize,
min_value=100,
max_value=1024,
affects_outcome_of=ModelLifecycle.NONE
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,17 @@ def _adapt_tiling_parameters(self, dataset):
Args:
dataset (ObjectDetectionDataset): OTX customized object detection dataset
"""
if bool(self._hyperparams.tiling_parameters.enable_adaptive_params):
tiling_parameters = self._hyperparams.tiling_parameters
if bool(tiling_parameters.enable_tiling) and bool(tiling_parameters.enable_adaptive_params):
# min_value and max_value are only accessible from model template
tplt_tile_params = self._task_environment.model_template.hyper_parameters.data.get("tiling_parameters")
tile_cfg = adaptive_tile_params(dataset)
if tile_cfg.get("tile_size"):
self._hyperparams.tiling_parameters.tile_size = tile_cfg.get("tile_size")
if tile_cfg.get("tile_overlap"):
self._hyperparams.tiling_parameters.tile_overlap = tile_cfg.get("tile_overlap")
if tile_cfg.get("tile_max_number"):
self._hyperparams.tiling_parameters.tile_max_number = tile_cfg.get("tile_max_number")
for key in ("tile_size", "tile_overlap", "tile_max_number"):
if tile_cfg.get(key):
min_value, max_value = tplt_tile_params[key]["min_value"], tplt_tile_params[key]["max_value"]
value = min(tile_cfg.get(key), max_value)
value = max(value, min_value)
tiling_parameters.__setattr__(key, value)


class DetectionNNCFTask(OTEDetectionNNCFTask):
Expand Down

0 comments on commit 89754c1

Please sign in to comment.