(self, index)
| 216 | |
| 217 | |
| 218 | def __getitem__(self, index): |
| 219 | im1 = cv2.imread(os.path.join(self.images_dir, 'image_{:06d}_0.png'.format(index))) |
| 220 | im2 = cv2.imread(os.path.join(self.images_dir, 'image_{:06d}_1.png'.format(index))) |
| 221 | flow = readFlow(os.path.join(self.flows_dir, 'flow_{:06d}.flo'.format(index))) |
| 222 | |
| 223 | H, W = im1.shape[:2] |
| 224 | |
| 225 | im1 = torch.from_numpy(im1).permute([2, 0, 1]) |
| 226 | im2 = torch.from_numpy(im2).permute([2, 0, 1]) |
| 227 | flow = torch.from_numpy(flow).permute([2, 0, 1]) |
| 228 | |
| 229 | valid_mask = np.ones([H, W]).astype(bool) |
| 230 | if os.path.exists(self.masks_dir): |
| 231 | valid_mask = cv2.imread(os.path.join(self.masks_dir, 'mask_{:06d}.png'.format(index)), cv2.IMREAD_UNCHANGED).astype(bool) |
| 232 | return im1, im2, flow, valid_mask |
| 233 | |
| 234 | def __len__(self): |
| 235 | return len(os.listdir(self.flows_dir)) |
nothing calls this directly
no test coverage detected