Skip to content

Commit 16c682c

Browse files
GT9505ZwwWayne
authored andcommitted
Support keeping image ratio in the multi-scale training of YOLOX (#6732)
* Support keeping ratio in the multi-scale training of YOLOX * fix typos * fix typos
1 parent e89a844 commit 16c682c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mmdet/models/detectors/yolox.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ def _random_resize(self):
119119

120120
if self.rank == 0:
121121
size = random.randint(*self._random_size_range)
122-
size = (self._size_multiplier * size, self._size_multiplier * size)
122+
aspect_ratio = float(
123+
self._default_input_size[1]) / self._default_input_size[0]
124+
size = (self._size_multiplier * size,
125+
self._size_multiplier * int(aspect_ratio * size))
123126
tensor[0] = size[0]
124127
tensor[1] = size[1]
125128

0 commit comments

Comments
 (0)