Skip to content

Commit 4002c0d

Browse files
committed
Fix AutoAugment abs translate calc
1 parent c06274e commit 4002c0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

timm/data/transforms.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,12 @@ def transforms_imagenet_train(
179179
transforms.RandomHorizontalFlip()
180180
]
181181
if auto_augment:
182+
if isinstance(img_size, tuple):
183+
img_size_min = min(img_size)
184+
else:
185+
img_size_min = img_size
182186
aa_params = dict(
183-
translate_const=img_size[-1] // 2 - 1,
187+
translate_const=int(img_size_min * 0.45),
184188
img_mean=tuple([min(255, round(255 * x)) for x in mean]),
185189
)
186190
if interpolation and interpolation != 'random':

0 commit comments

Comments
 (0)