RandomAffine in PyTorch

Buy Me a Coffee

*Memos:

RandomAffine() can do rotation or affine transformation for zero or more images as shown below:

*Memos:

  • The 1st argument for initialization is degrees(Required-Type:int, float or tuple/list(int or float)): *Memos:
    • It can do rotation.
    • It’s the range of the degrees [min, max] so it must min <= max.
    • A degrees value is randomly taken from the range of [min, max].
    • A tuple/list must be the 1D with 2 elements.
    • A single value means [-degrees(min), +degrees(max)].
    • A single value must be 0 <= x.
  • The 2nd argument for initialization is translate(Optional-Default:None-Type:tuple/list(int or float)): *Memos:
    • It’s [a, b]. *Each value must be 0 <= 1.
    • It must be the 1D with 2 elements.
    • The 1st element is for the horizontal shift randomly taken in the range of -img_width * a < horizontal shift < img_width * a.
    • The 2nd element is for the vertical shift randomly taken in the range of -img_height * b < vertical shift < img_height * b.
  • The 3rd argument for initialization is scale(Optional-Default:None-Type:tuple/list(int or float)): *Memos:
    • It’s [min, max] so it must min <= max. *Each element must be 0 < x.
    • A scale value is randomly taken from the range of [min, max].
  • The 4th argument for initialization is shear(Optional-Default:None-Type:int, float or tuple/list(int or float)): *Memos:
    • It can do affine transformation with x and y.
    • It’s [min, max, min, max] so it must min <= max. *Memos:
    • The 1st two elements are the range of x.
    • The 2nd two elements are the range of y.
    • x value is randomly taken from the range of the 1st two elements.
    • y value is randomly taken from the range of the 2nd two elements.
    • A tuple/list must be the 1D with 2 or 4 elements.
    • The tuple/list of 2 elements means [shear[0](min), shear[1](max), 0.0(min), 0.0(min)].
    • A single value means [-shear(min), +shear(max), 0.0(min), 0.0(max)].
    • A single value must be 0 <= x.
  • The 5th argument for initialization is interpolation(Optional-Default:InterpolationMode.NEAREST-Type:InterpolationMode).
  • The 6th argument for initialization is fill(Optional-Default:0-Type:int, float or tuple/list(int or float)): *Memos:
    • It can change the background of images. *The background can be seen when doing rotation or affine transformation for images.
    • A tuple/list must be the 1D with 3 elements.
  • The 7th argument for initialization is center(Optional-Default:None-Type:tuple/list(int or float)). *It must be the 1D with 2 elements.
  • The 1st argument is img(Required-Type:PIL Image or tensor(int, float, complex or bool)): *Memos:
    • It must be the 3D tensor of zero or more elements.
    • Don’t use img=.
  • v2 is recommended to use according to V1 or V2? Which one should I use?.
from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import RandomAffine
from torchvision.transforms.functional import InterpolationMode

randomaffine = RandomAffine(degrees=90)
randomaffine = RandomAffine(degrees=[-90, 90],
                            translate=None,
                            scale=None,
                            shear=None,
                            interpolation=InterpolationMode.NEAREST,
                            fill=0,
                            center=None)
randomaffine
# RandomAffine(degrees=[-90, 90], # interpolation=InterpolationMode.NEAREST, # fill=0) 
randomaffine.degrees
# [-90.0, 90.0] 
print(randomaffine.translate)
# None 
print(randomaffine.scale)
# None 
print(randomaffine.shear)
# None 
randomaffine.interpolation
# <InterpolationMode.NEAREST: 'nearest'> 
randomaffine.fill
# 0 
print(randomaffine.center)
# None 
origin_data = OxfordIIITPet(
    root="data",
    transform=None
    # transform=RandomAffine(degrees=[0, 0]) )

p90_data = OxfordIIITPet( # `p` is plus.     root="data",
    transform=RandomAffine(degrees=90)
    # transform=RandomAffine(degrees=[-90, 90]) )

p90p90_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[90, 90])
)

m90m90_data = OxfordIIITPet( # `m` is minus.     root="data",
    transform=RandomAffine(degrees=[-90, -90])
)

p180p180_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[180, 180])
)

hrtran_data = OxfordIIITPet( # `hr` is horizontal and `tran` is translate.     root="data",
    transform=RandomAffine(degrees=[0, 0], translate=[0.8, 0])
)

vrtran_data = OxfordIIITPet( # `vr` is vertical.     root="data",
    transform=RandomAffine(degrees=[0, 0], translate=[0, 0.5])
)

hrvrtran_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], translate=[0.8, 0.5])
)

scale_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], scale=[1, 13])
)

m45m45fillgray_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[-45, -45], fill=150)
)

p135p135fillpurple_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[135, 135], fill=[160, 32, 240])
)

p180p180offcenter_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[180, 180], center=[270, 200])
)

shearp90_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0],
                           shear=90)
    # transform=RandomAffine(degrees=[0, 0], shear=[-90, 90, 0, 0]) )

shearp0p90_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 90])
    # transform=RandomAffine(degrees=[0, 0], shear=[0, 90, 0, 0]) )

shearm90p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-90, 0])
    # transform=RandomAffine(degrees=[0, 0], shear=[-90, 0, 0, 0]) )

shearm90p90m90p90_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-90, 90, -90, 90])
)

shearp0p0p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 0, 0])
)

shearp10p10p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[10, 10, 0, 0])
)

shearp20p20p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[20, 20, 0, 0])
)

shearp30p30p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[30, 30, 0, 0])
)

shearp40p40p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[40, 40, 0, 0])
)

shearp50p50p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[50, 50, 0, 0])
)

shearp60p60p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[60, 60, 0, 0])
)

shearp70p70p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[70, 70, 0, 0])
)

shearp80p80p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[80, 80, 0, 0])
)

shearp90p90p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[90, 90, 0, 0])
)

shearm10m10p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-10, -10, 0, 0])
)

shearm20m20p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-20, -20, 0, 0])
)

shearm30m30p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-30, -30, 0, 0])
)

shearm40m40p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-40, -40, 0, 0])
)

shearm50m50p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-50, -50, 0, 0])
)

shearm60m60p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-60, -60, 0, 0])
)

shearm70m70p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-70, -70, 0, 0])
)

shearm80m80p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-80, -80, 0, 0])
)

shearm90m90p0p0_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[-90, -90, 0, 0])
)

shearp0p0p10p10_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 10, 10])
)

shearp0p0p20p20_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 20, 20])
)

shearp0p0p30p30_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 30, 30])
)

shearp0p0p40p40_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 40, 40])
)

shearp0p0p50p50_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 50, 50])
)

shearp0p0p60p60_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 60, 60])
)

shearp0p0p70p70_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 70, 70])
)

shearp0p0p80p80_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 80, 80])
)

shearp0p0p90p90_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, 90, 90])
)

shearp0p0m10m10_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -10, -10])
)

shearp0p0m20m20_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -20, -20])
)

shearp0p0m30m30_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -30, -30])
)

shearp0p0m40m40_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -40, -40])
)

shearp0p0m50m50_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -50, -50])
)

shearp0p0m60m60_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -60, -60])
)

shearp0p0m70m70_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -70, -70])
)

shearp0p0m80m80_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -80, -80])
)

shearp0p0m90m90_data = OxfordIIITPet(
    root="data",
    transform=RandomAffine(degrees=[0, 0], shear=[0, 0, -90, -90])
)

import matplotlib.pyplot as plt

def show_images1(data, main_title=None):
    plt.figure(figsize=(10, 5))
    plt.suptitle(t=main_title, y=0.8, fontsize=14)
    for i, (im, _) in zip(range(1, 6), data):
        plt.subplot(1, 5, i)
        plt.imshow(X=im)
        plt.xticks(ticks=[])
        plt.yticks(ticks=[])
    plt.tight_layout()
    plt.show()

show_images1(data=origin_data, main_title="origin_data")
show_images1(data=p90_data, main_title="p90_data")
show_images1(data=p90p90_data, main_title="p90p90_data")
show_images1(data=m90m90_data, main_title="m90m90_data")
show_images1(data=p180p180_data, main_title="p180p180_data")
show_images1(data=hrtran_data, main_title="hrtran_data")
show_images1(data=vrtran_data, main_title="vrtran_data")
show_images1(data=hrvrtran_data, main_title="hrvrtran_data")
show_images1(data=scale_data, main_title="scale_data")
show_images1(data=m45m45fillgray_data, main_title="m45m45fillgray_data")
show_images1(data=p135p135fillpurple_data, 
             main_title="p135p135fillpurple_data")
show_images1(data=p180p180offcenter_data,
             main_title="p180p180offcenter_data")
print()
show_images1(data=shearp90_data, main_title="shearp90_data")
show_images1(data=shearp0p90_data, main_title="shearp0p90_data")
show_images1(data=shearm90p0_data, main_title="shearm90p0_data")
show_images1(data=shearm90p90m90p90_data, main_title="shearm90p90m90p90_data")
print()
show_images1(data=shearp0p0p0p0_data, main_title="shearp0p0p0p0_data")
show_images1(data=shearp10p10p0p0_data, main_title="shearp10p10p0p0_data")
show_images1(data=shearp20p20p0p0_data, main_title="shearp20p20p0p0_data")
show_images1(data=shearp30p30p0p0_data, main_title="shearp30p30p0p0_data")
show_images1(data=shearp40p40p0p0_data, main_title="shearp40p40p0p0_data")
show_images1(data=shearp50p50p0p0_data, main_title="shearp50p50p0p0_data")
show_images1(data=shearp60p60p0p0_data, main_title="shearp60p60p0p0_data")
show_images1(data=shearp70p70p0p0_data, main_title="shearp70p70p0p0_data")
show_images1(data=shearp80p80p0p0_data, main_title="shearp80p80p0p0_data")
show_images1(data=shearp90p90p0p0_data, main_title="shearp90p90p0p0_data")
print()
show_images1(data=shearp0p0p0p0_data, main_title="shearp0p0p0p0_data")
show_images1(data=shearm10m10p0p0_data, main_title="shearm10m10p0p0_data")
show_images1(data=shearm20m20p0p0_data, main_title="shearm20m20p0p0_data")
show_images1(data=shearm30m30p0p0_data, main_title="shearm30m30p0p0_data")
show_images1(data=shearm40m40p0p0_data, main_title="shearm40m40p0p0_data")
show_images1(data=shearm50m50p0p0_data, main_title="shearm50m50p0p0_data")
show_images1(data=shearm60m60p0p0_data, main_title="shearm60m60p0p0_data")
show_images1(data=shearm70m70p0p0_data, main_title="shearm70m70p0p0_data")
show_images1(data=shearm80m80p0p0_data, main_title="shearm80m80p0p0_data")
show_images1(data=shearm90m90p0p0_data, main_title="shearm90m90p0p0_data")
print()
show_images1(data=shearp0p0p0p0_data, main_title="shearp0p0p0p0_data")
show_images1(data=shearp0p0p10p10_data, main_title="shearp0p0p10p10_data")
show_images1(data=shearp0p0p20p20_data, main_title="shearp0p0p20p20_data")
show_images1(data=shearp0p0p30p30_data, main_title="shearp0p0p30p30_data")
show_images1(data=shearp0p0p40p40_data, main_title="shearp0p0p40p40_data")
show_images1(data=shearp0p0p50p50_data, main_title="shearp0p0p50p50_data")
show_images1(data=shearp0p0p60p60_data, main_title="shearp0p0p60p60_data")
show_images1(data=shearp0p0p70p70_data, main_title="shearp0p0p70p70_data")
show_images1(data=shearp0p0p80p80_data, main_title="shearp0p0p80p80_data")
show_images1(data=shearp0p0p90p90_data, main_title="shearp0p0p90p90_data")
print()
show_images1(data=shearp0p0p0p0_data, main_title="shearp0p0p0p0_data")
show_images1(data=shearp0p0m10m10_data, main_title="shearp0p0m10m10_data")
show_images1(data=shearp0p0m20m20_data, main_title="shearp0p0m20m20_data")
show_images1(data=shearp0p0m30m30_data, main_title="shearp0p0m30m30_data")
show_images1(data=shearp0p0m40m40_data, main_title="shearp0p0m40m40_data")
show_images1(data=shearp0p0m50m50_data, main_title="shearp0p0m50m50_data")
show_images1(data=shearp0p0m60m60_data, main_title="shearp0p0m60m60_data")
show_images1(data=shearp0p0m70m70_data, main_title="shearp0p0m70m70_data")
show_images1(data=shearp0p0m80m80_data, main_title="shearp0p0m80m80_data")
show_images1(data=shearp0p0m90m90_data, main_title="shearp0p0m90m90_data")

# ↓ ↓ ↓ ↓ ↓ ↓ The code below is identical to the code above. ↓ ↓ ↓ ↓ ↓ ↓ def show_images2(data, main_title=None, d=0, t=None,
                 sc=None, sh=None, f=0, c=None):
    plt.figure(figsize=(10, 5))
    plt.suptitle(t=main_title, y=0.8, fontsize=14)
    for i, (im, _) in zip(range(1, 6), data):
        plt.subplot(1, 5, i)
        ra = RandomAffine(degrees=d, translate=t, scale=sc, # Here                           shear=sh, center=c, fill=f)
        plt.imshow(X=ra(im)) # Here         plt.xticks(ticks=[])
        plt.yticks(ticks=[])
    plt.tight_layout()
    plt.show()

show_images2(data=origin_data, main_title="origin_data")
show_images2(data=origin_data, main_title="p90_data", d=90)
show_images2(data=origin_data, main_title="p90p90_data", d=[90, 90])
show_images2(data=origin_data, main_title="m90m90_data", d=[-90, -90])
show_images2(data=origin_data, main_title="p180p180_data", d=[180, 180])
show_images2(data=origin_data, main_title="hrtran_data",
             d=[0, 0], t=[0.8, 0])
show_images2(data=origin_data, main_title="vrtran_data",
             d=[0, 0], t=[0, 0.5])
show_images2(data=origin_data, main_title="hrvrtran_data",
             d=[0, 0], t=[0.8, 0.5])
show_images2(data=origin_data, main_title="scale_data",
             d=[0, 0], sc=[1, 13])
show_images2(data=origin_data, main_title="m45m45fillgray_data",
             d=[-45, -45], f=150)
show_images2(data=origin_data, main_title="p135p135fillpurple_data",
             d=[135, 135], f=[160, 32, 240])
show_images2(data=origin_data, main_title="p180p180offcenter_data",
             d=[180, 180], c=[270, 200])
print()
show_images2(data=origin_data, main_title="shearp90_data",
             d=[0, 0], sh=90)
show_images2(data=origin_data, main_title="shearp0p90_data",
             d=[0, 0], sh=[0, 90])
show_images2(data=origin_data, main_title="shearm90p0_data",
             d=[0, 0], sh=[-90, 0])
show_images2(data=origin_data, main_title="shearm90p90m90p90_data",
             d=[0, 0], sh=[-90, 90, -90, 90])
print()
show_images2(data=origin_data, main_title="shearp0p0p0p0_data",
             d=[0, 0], sh=[0, 0, 0, 0])
show_images2(data=origin_data, main_title="shearp10p10p0p0_data",
             d=[0, 0], sh=[10, 10, 0, 0])
show_images2(data=origin_data, main_title="shearp20p20p0p0_data",
             d=[0, 0], sh=[20, 20, 0, 0])
show_images2(data=origin_data, main_title="shearp30p30p0p0_data",
             d=[0, 0], sh=[30, 30, 0, 0])
show_images2(data=origin_data, main_title="shearp40p40p0p0_data",
             d=[0, 0], sh=[40, 40, 0, 0])
show_images2(data=origin_data, main_title="shearp50p50p0p0_data",
             d=[0, 0], sh=[50, 50, 0, 0])
show_images2(data=origin_data, main_title="shearp60p60p0p0_data",
             d=[0, 0], sh=[60, 60, 0, 0])
show_images2(data=origin_data, main_title="shearp70p70p0p0_data",
             d=[0, 0], sh=[70, 70, 0, 0])
show_images2(data=origin_data, main_title="shearp80p80p0p0_data",
             d=[0, 0], sh=[80, 80, 0, 0])
show_images2(data=origin_data, main_title="shearp90p90p0p0_data",
             d=[0, 0], sh=[90, 90, 0, 0])
print()
show_images2(data=origin_data, main_title="shearp0p0p0p0_data",
             d=[0, 0], sh=[0, 0, 0, 0])
show_images2(data=origin_data, main_title="shearm10m10p0p0_data",
             d=[0, 0], sh=[-10, -10, 0, 0])
show_images2(data=origin_data, main_title="shearm20m20p0p0_data",
             d=[0, 0], sh=[-20, -20, 0, 0])
show_images2(data=origin_data, main_title="shearm30m30p0p0_data",
             d=[0, 0], sh=[-30, -30, 0, 0])
show_images2(data=origin_data, main_title="shearm40m40p0p0_data",
             d=[0, 0], sh=[-40, -40, 0, 0])
show_images2(data=origin_data, main_title="shearm50m50p0p0_data",
             d=[0, 0], sh=[-50, -50, 0, 0])
show_images2(data=origin_data, main_title="shearm60m60p0p0_data",
             d=[0, 0], sh=[-60, -60, 0, 0])
show_images2(data=origin_data, main_title="shearm70m70p0p0_data",
             d=[0, 0], sh=[-70, -70, 0, 0])
show_images2(data=origin_data, main_title="shearm80m80p0p0_data",
             d=[0, 0], sh=[-80, -80, 0, 0])
show_images2(data=origin_data, main_title="shearm90m90p0p0_data",
             d=[0, 0], sh=[-90, -90, 0, 0])
print()
show_images2(data=origin_data, main_title="shearp0p0p0p0_data",
             d=[0, 0], sh=[0, 0, 0, 0])
show_images2(data=origin_data, main_title="shearp0p0p10p10_data",
             d=[0, 0], sh=[0, 0, 10, 10])
show_images2(data=origin_data, main_title="shearp0p0p20p20_data",
             d=[0, 0], sh=[0, 0, 20, 20])
show_images2(data=origin_data, main_title="shearp0p0p30p30_data",
             d=[0, 0], sh=[0, 0, 30, 30])
show_images2(data=origin_data, main_title="shearp0p0p40p40_data",
             d=[0, 0], sh=[0, 0, 40, 40])
show_images2(data=origin_data, main_title="shearp0p0p50p50_data",
             d=[0, 0], sh=[0, 0, 50, 50])
show_images2(data=origin_data, main_title="shearp0p0p60p60_data",
             d=[0, 0], sh=[0, 0, 60, 60])
show_images2(data=origin_data, main_title="shearp0p0p70p70_data",
             d=[0, 0], sh=[0, 0, 70, 70])
show_images2(data=origin_data, main_title="shearp0p0p80p80_data",
             d=[0, 0], sh=[0, 0, 80, 80])
show_images2(data=origin_data, main_title="shearp0p0p90p90_data",
             d=[0, 0], sh=[0, 0, 90, 90])
print()
show_images2(data=origin_data, main_title="shearp0p0p0p0_data",
             d=[0, 0], sh=[0, 0, 0, 0])
show_images2(data=origin_data, main_title="shearp0p0m10m10_data",
             d=[0, 0], sh=[0, 0, -10, -10])
show_images2(data=origin_data, main_title="shearp0p0m20m20_data",
             d=[0, 0], sh=[0, 0, -20, -20])
show_images2(data=origin_data, main_title="shearp0p0m30m30_data",
             d=[0, 0], sh=[0, 0, -30, -30])
show_images2(data=origin_data, main_title="shearp0p0m40m40_data",
             d=[0, 0], sh=[0, 0, -40, -40])
show_images2(data=origin_data, main_title="shearp0p0m50m50_data",
             d=[0, 0], sh=[0, 0, -50, -50])
show_images2(data=origin_data, main_title="shearp0p0m60m60_data",
             d=[0, 0], sh=[0, 0, -60, -60])
show_images2(data=origin_data, main_title="shearp0p0m70m70_data",
             d=[0, 0], sh=[0, 0, -70, -70])
show_images2(data=origin_data, main_title="shearp0p0m80m80_data",
             d=[0, 0], sh=[0, 0, -80, -80])
show_images2(data=origin_data, main_title="shearp0p0m90m90_data",
             d=[0, 0], sh=[0, 0, -90, -90])

Enter fullscreen mode Exit fullscreen mode






原文链接:RandomAffine in PyTorch

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容