1
1
from __future__ import division
2
2
import torch
3
- import torchvision .transforms as transforms
3
+ import torchvision .transforms ._transforms_video as transforms
4
+ from torchvision .transforms import Compose
4
5
import unittest
5
6
import random
6
7
import numpy as np
@@ -20,7 +21,7 @@ def test_random_crop_video(self):
20
21
oheight = random .randint (5 , (height - 2 ) / 2 ) * 2
21
22
owidth = random .randint (5 , (width - 2 ) / 2 ) * 2
22
23
clip = torch .randint (0 , 256 , (numFrames , height , width , 3 ), dtype = torch .uint8 )
23
- result = transforms . Compose ([
24
+ result = Compose ([
24
25
transforms .ToTensorVideo (),
25
26
transforms .RandomCropVideo ((oheight , owidth )),
26
27
])(clip )
@@ -36,7 +37,7 @@ def test_random_resized_crop_video(self):
36
37
oheight = random .randint (5 , (height - 2 ) / 2 ) * 2
37
38
owidth = random .randint (5 , (width - 2 ) / 2 ) * 2
38
39
clip = torch .randint (0 , 256 , (numFrames , height , width , 3 ), dtype = torch .uint8 )
39
- result = transforms . Compose ([
40
+ result = Compose ([
40
41
transforms .ToTensorVideo (),
41
42
transforms .RandomResizedCropVideo ((oheight , owidth )),
42
43
])(clip )
@@ -57,7 +58,7 @@ def test_center_crop_video(self):
57
58
ow1 = (width - owidth ) // 2
58
59
clipNarrow = clip [:, oh1 :oh1 + oheight , ow1 :ow1 + owidth , :]
59
60
clipNarrow .fill_ (0 )
60
- result = transforms . Compose ([
61
+ result = Compose ([
61
62
transforms .ToTensorVideo (),
62
63
transforms .CenterCropVideo ((oheight , owidth )),
63
64
])(clip )
@@ -68,7 +69,7 @@ def test_center_crop_video(self):
68
69
69
70
oheight += 1
70
71
owidth += 1
71
- result = transforms . Compose ([
72
+ result = Compose ([
72
73
transforms .ToTensorVideo (),
73
74
transforms .CenterCropVideo ((oheight , owidth )),
74
75
])(clip )
@@ -80,7 +81,7 @@ def test_center_crop_video(self):
80
81
81
82
oheight += 1
82
83
owidth += 1
83
- result = transforms . Compose ([
84
+ result = Compose ([
84
85
transforms .ToTensorVideo (),
85
86
transforms .CenterCropVideo ((oheight , owidth )),
86
87
])(clip )
0 commit comments