Skip to content

Commit 10865fb

Browse files
authored
custom test dataset added
1 parent a7465fa commit 10865fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

datasets.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def get_data(self, data_path):
4949
def __getitem__(self, index):
5050
# read images in grayscale, then invert them
5151
img = 255 - cv2.imread(self.imgs_data[index] ,0)
52-
52+
5353
# aspect ratio of the image required to be fed into the model (height/width)
5454
out_ar = self.out_size[0]/self.out_size[1]
5555

@@ -63,14 +63,14 @@ def __getitem__(self, index):
6363
pad1 = int(pad/2)
6464
pad2 = int(img.shape[0]/out_ar) - img.shape[1] - pad1
6565
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]))
6767
else:
6868
# pad height
6969
pad = int(img.shape[1]*out_ar) - img.shape[0]
7070
pad1 = int(pad/2)
7171
pad2 = int(img.shape[1]*out_ar) - img.shape[0] - pad1
7272
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]))
7474

7575
if self.transform is not None:
7676
img = self.transform(img)

0 commit comments

Comments
 (0)