Skip to content

Commit

Permalink
auto_augment: img_shape broken (open-mmlab#6259)
Browse files Browse the repository at this point in the history
* check/correct img.shape

* check/correct img.shape

* simpler fix for img_shape

* failtest Shear, Translate

* fix also _shear_img, _translate_img

* flake8
  • Loading branch information
yellowdolphin authored Oct 18, 2021
1 parent c1302d5 commit a32d7d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mmdet/datasets/pipelines/auto_augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def _shear_img(self,
border_value=self.img_fill_val,
interpolation=interpolation)
results[key] = img_sheared.astype(img.dtype)
results['img_shape'] = results[key].shape

def _shear_bboxes(self, results, magnitude):
"""Shear the bboxes."""
Expand Down Expand Up @@ -421,6 +422,7 @@ def _rotate_img(self, results, angle, center=None, scale=1.0):
img_rotated = mmcv.imrotate(
img, angle, center, scale, border_value=self.img_fill_val)
results[key] = img_rotated.astype(img.dtype)
results['img_shape'] = results[key].shape

def _rotate_bboxes(self, results, rotate_matrix):
"""Rotate the bboxes."""
Expand Down Expand Up @@ -621,6 +623,7 @@ def _translate_img(self, results, offset, direction='horizontal'):
img = results[key].copy()
results[key] = mmcv.imtranslate(
img, offset, direction, self.img_fill_val).astype(img.dtype)
results['img_shape'] = results[key].shape

def _translate_bboxes(self, results, offset):
"""Shift bboxes horizontally or vertically, according to offset."""
Expand Down

0 comments on commit a32d7d4

Please sign in to comment.