(self, image_root, gt_root, testsize)
| 138 | |
| 139 | class test_dataset: |
| 140 | def __init__(self, image_root, gt_root, testsize): |
| 141 | self.testsize = testsize |
| 142 | self.images = [image_root + f for f in os.listdir(image_root) if f.endswith('.jpg') or f.endswith('.png')] |
| 143 | self.gts = [gt_root + f for f in os.listdir(gt_root) if f.endswith('.tif') or f.endswith('.png' or f.endswith('.jpg'))] |
| 144 | self.images = sorted(self.images) |
| 145 | self.gts = sorted(self.gts) |
| 146 | self.transform = transforms.Compose([ |
| 147 | transforms.Resize((self.testsize, self.testsize)), |
| 148 | transforms.ToTensor(), |
| 149 | transforms.Normalize([0.485, 0.456, 0.406], |
| 150 | [0.229, 0.224, 0.225])]) |
| 151 | self.gt_transform = transforms.ToTensor() |
| 152 | self.size = len(self.images) |
| 153 | self.index = 0 |
| 154 | |
| 155 | def load_data(self): |
| 156 | image = self.rgb_loader(self.images[self.index]) |
nothing calls this directly
no outgoing calls
no test coverage detected