(self, image)
| 91 | self.model = torch.hub.load("facebookresearch/dinov2", arch_str) |
| 92 | |
| 93 | def transform(self, image): |
| 94 | |
| 95 | imagenet_mean = np.array([0.485, 0.456, 0.406]) |
| 96 | imagenet_std = np.array([0.229, 0.224, 0.225]) |
| 97 | |
| 98 | image = TF.Compose( |
| 99 | [ |
| 100 | TF.Resize((224, 224), TF.InterpolationMode.BICUBIC), |
| 101 | ] |
| 102 | )(image) |
| 103 | image = image.to(torch.float) |
| 104 | |
| 105 | return TF.Normalize(imagenet_mean, imagenet_std)(image) |
| 106 | |
| 107 | |
| 108 | def _compute_fid(mu1: Tensor, sigma1: Tensor, mu2: Tensor, sigma2: Tensor) -> Tensor: |