summaryrefslogtreecommitdiffstats
path: root/models/convnext
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-04-13 07:14:24 +0200
committerVolpeon <git@volpeon.ink>2023-04-13 07:14:24 +0200
commita0b63ee7f4a8c793c0d200c86ef07677aa4cbf2e (patch)
tree6a695b2b5a73cebc35ff9e581c70f1a0e75b62e8 /models/convnext
parentExperimental convnext discriminator support (diff)
downloadtextual-inversion-diff-a0b63ee7f4a8c793c0d200c86ef07677aa4cbf2e.tar.gz
textual-inversion-diff-a0b63ee7f4a8c793c0d200c86ef07677aa4cbf2e.tar.bz2
textual-inversion-diff-a0b63ee7f4a8c793c0d200c86ef07677aa4cbf2e.zip
Update
Diffstat (limited to 'models/convnext')
-rw-r--r--models/convnext/discriminator.py8
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):