(image_path: Path)
| 150 | |
| 151 | |
| 152 | def image_path_to_tensor(image_path: Path): |
| 153 | import torchvision.transforms as transforms |
| 154 | |
| 155 | img = Image.open(image_path) |
| 156 | transform = transforms.ToTensor() |
| 157 | img_tensor = transform(img).permute(1, 2, 0)[..., :3] |
| 158 | return img_tensor |
| 159 | |
| 160 | |
| 161 | def main( |