| 62 | self.netC = netC |
| 63 | |
| 64 | def load_image(self, image_path, mask_path): |
| 65 | # Name |
| 66 | img_name = os.path.splitext(os.path.basename(image_path))[0] |
| 67 | # Calib |
| 68 | B_MIN = np.array([-1, -1, -1]) |
| 69 | B_MAX = np.array([1, 1, 1]) |
| 70 | projection_matrix = np.identity(4) |
| 71 | projection_matrix[1, 1] = -1 |
| 72 | calib = torch.Tensor(projection_matrix).float() |
| 73 | # Mask |
| 74 | mask = Image.open(mask_path).convert('L') |
| 75 | mask = transforms.Resize(self.load_size)(mask) |
| 76 | mask = transforms.ToTensor()(mask).float() |
| 77 | # image |
| 78 | image = Image.open(image_path).convert('RGB') |
| 79 | image = self.to_tensor(image) |
| 80 | image = mask.expand_as(image) * image |
| 81 | return { |
| 82 | 'name': img_name, |
| 83 | 'img': image.unsqueeze(0), |
| 84 | 'calib': calib.unsqueeze(0), |
| 85 | 'mask': mask.unsqueeze(0), |
| 86 | 'b_min': B_MIN, |
| 87 | 'b_max': B_MAX, |
| 88 | } |
| 89 | |
| 90 | def eval(self, data, use_octree=False): |
| 91 | ''' |