Skip to content

Commit

Permalink
Fix the target size to be in row-column format and work with all aspe…
Browse files Browse the repository at this point in the history
…ct ratios
  • Loading branch information
cansik committed May 31, 2024
1 parent 217353a commit 77f3fb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/super_gradients/training/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def apply_to_sample(self, sample: DetectionSample) -> DetectionSample:
targets=targets,
targets_seg=None,
crowd_targets=crowd_targets,
target_size=self.target_size or tuple(reversed(sample.image.shape[:2])),
target_size=self.target_size or tuple(sample.image.shape[:2]),
degrees=self.degrees,
translate=self.translate,
scales=self.scale,
Expand Down Expand Up @@ -1510,7 +1510,7 @@ def random_affine(

M = get_affine_matrix(img.shape[:2], target_size, degrees, translate, scales, shear)

img = cv2.warpAffine(img, M, dsize=target_size, borderValue=(border_value, border_value, border_value))
img = cv2.warpAffine(img, M, dsize=target_size[::-1], borderValue=(border_value, border_value, border_value))

# Transform label coordinates
if len(targets) > 0:
Expand Down

0 comments on commit 77f3fb5

Please sign in to comment.