MCPcopy Create free account
hub / github.com/CompVis/zigma / transform

Method transform

utils/torchmetric_fdd.py:93–105  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

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
108def _compute_fid(mu1: Tensor, sigma1: Tensor, mu2: Tensor, sigma2: Tensor) -> Tensor:

Callers

nothing calls this directly

Calls 1

toMethod · 0.80

Tested by

no test coverage detected