mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-25 12:39:25 +01:00
add compatibility for torchvision>0.10.0
add compatibility for torchvision>0.10.0
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/12292460
This commit is contained in:
@@ -73,14 +73,25 @@ def _geometric_aug_func(x,
|
||||
labels_new.append(labels[i])
|
||||
else:
|
||||
x_crop = transforms.functional.to_pil_image(x_crop.cpu())
|
||||
x_crop = transforms.functional.affine(
|
||||
x_crop,
|
||||
angle,
|
||||
translate,
|
||||
scale,
|
||||
shear,
|
||||
resample=2,
|
||||
fillcolor=tuple([int(i) for i in pixel_mean]))
|
||||
try:
|
||||
x_crop = transforms.functional.affine(
|
||||
x_crop,
|
||||
angle,
|
||||
translate,
|
||||
scale,
|
||||
shear,
|
||||
resample=2,
|
||||
fillcolor=tuple([int(i) for i in pixel_mean]))
|
||||
except Exception:
|
||||
x_crop = transforms.functional.affine(
|
||||
x_crop,
|
||||
angle,
|
||||
translate,
|
||||
scale,
|
||||
shear,
|
||||
interpolation=2,
|
||||
fill=tuple([int(i) for i in pixel_mean]))
|
||||
|
||||
x_crop = transforms.functional.to_tensor(x_crop).to(x.device)
|
||||
x_crops.append(x_crop)
|
||||
y = _transform(x, x_crops, boxes_crops, translate)
|
||||
|
||||
Reference in New Issue
Block a user