diff options
Diffstat (limited to 'models/convnext')
-rw-r--r-- | models/convnext/discriminator.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/models/convnext/discriminator.py b/models/convnext/discriminator.py index 7dbbe3a..571b915 100644 --- a/models/convnext/discriminator.py +++ b/models/convnext/discriminator.py | |||
@@ -15,13 +15,7 @@ class ConvNeXtDiscriminator(): | |||
15 | self.img_std = torch.tensor(IMAGENET_DEFAULT_STD).view(1, -1, 1, 1) | 15 | self.img_std = torch.tensor(IMAGENET_DEFAULT_STD).view(1, -1, 1, 1) |
16 | 16 | ||
17 | def get_score(self, img): | 17 | def get_score(self, img): |
18 | img_mean = self.img_mean.to(device=img.device, dtype=img.dtype) | 18 | pred = self.get_all(img) |
19 | img_std = self.img_std.to(device=img.device, dtype=img.dtype) | ||
20 | |||
21 | img = ((img+1.)/2.).sub(img_mean).div(img_std) | ||
22 | |||
23 | img = F.interpolate(img, size=(self.input_size, self.input_size), mode='bicubic', align_corners=True) | ||
24 | pred = self.net(img) | ||
25 | return torch.softmax(pred, dim=-1)[:, 1] | 19 | return torch.softmax(pred, dim=-1)[:, 1] |
26 | 20 | ||
27 | def get_all(self, img): | 21 | def get_all(self, img): |