[Fix] Fix a not proper assertion in RandomChoiceResize (#2450)

* fix assertion

* remove assert

* use is_seq_of
pull/2374/merge
谢昕辰 2022-11-23 18:54:11 +08:00 committed by GitHub
parent a0939977a3
commit b852c1c433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -1063,7 +1063,7 @@ class RandomChoiceResize(BaseTransform):
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
@ -1079,7 +1079,6 @@ class RandomChoiceResize(BaseTransform):
``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