@@ -49,7 +49,7 @@ def get_data(self, data_path):
49
49
def __getitem__ (self , index ):
50
50
# read images in grayscale, then invert them
51
51
img = 255 - cv2 .imread (self .imgs_data [index ] ,0 )
52
-
52
+
53
53
# aspect ratio of the image required to be fed into the model (height/width)
54
54
out_ar = self .out_size [0 ]/ self .out_size [1 ]
55
55
@@ -63,14 +63,14 @@ def __getitem__(self, index):
63
63
pad1 = int (pad / 2 )
64
64
pad2 = int (img .shape [0 ]/ out_ar ) - img .shape [1 ] - pad1
65
65
img = np .pad (img , ((0 ,0 ),(pad1 , pad2 )), constant_values = (0 ,0 ))
66
- img = cv2 .resize (img , self .out_size )
66
+ img = cv2 .resize (img , ( self .out_size [ 1 ], self . out_size [ 0 ]) )
67
67
else :
68
68
# pad height
69
69
pad = int (img .shape [1 ]* out_ar ) - img .shape [0 ]
70
70
pad1 = int (pad / 2 )
71
71
pad2 = int (img .shape [1 ]* out_ar ) - img .shape [0 ] - pad1
72
72
img = np .pad (img , ((pad1 , pad2 ), (0 ,0 )), constant_values = (0 ,0 ))
73
- img = cv2 .resize (img , self .out_size )
73
+ img = cv2 .resize (img , ( self .out_size [ 1 ], self . out_size [ 0 ]) )
74
74
75
75
if self .transform is not None :
76
76
img = self .transform (img )
0 commit comments