Skip to content

Commit

Permalink
[Fix] Fix a not proper assertion in RandomChoiceResize (open-mmlab#2450)
Browse files Browse the repository at this point in the history
* fix assertion

* remove assert

* use is_seq_of
  • Loading branch information
xiexinch authored and akozlov-outrider committed May 8, 2023
1 parent 398c6d3 commit 3acd117
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mmcv/transforms/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ def __init__(
self.scales = scales
else:
self.scales = [scales]
assert mmengine.is_list_of(self.scales, tuple)
assert mmengine.is_seq_of(self.scales, (tuple, int))

self.resize_cfg = dict(type=resize_type, **resize_kwargs)
# create a empty Resize object
Expand All @@ -1079,7 +1079,6 @@ def _random_select(self) -> Tuple[int, int]:
``scale_idx`` is the selected index in the given candidates.
"""

assert mmengine.is_list_of(self.scales, tuple)
scale_idx = np.random.randint(len(self.scales))
scale = self.scales[scale_idx]
return scale, scale_idx
Expand Down

0 comments on commit 3acd117

Please sign in to comment.