import torch
from BigGAN import Discriminator
import utils
from utils import Distribution
def load():
path ='pre-trained/138k/'
d_state_dict = torch.load(path + 'D.pth')
D = Discriminator(D_ch=96, skip_init=True)
D.load_state_dict(d_state_dict)
return D
if __name__ == '__main__':
D = load()
D.eval()
D.cuda()
x = ... //x is an image
x = x.to('cuda')
y_ = Distribution(torch.zeros(1, requires_grad=False))
y_.init_distribution('categorical', num_categories=1000)
y_ = y_.to('cuda', torch.int64, non_blocking=False, copy=False)
y_.sample_()
print(D(x, y_[:1]))
I have three questions:
Is my code correct? Especially the preparation of y_.
How to preprocess x? I use imagenet val 2012.
How to understand the output of D? I find the value could be positive or negative, I am wondering to know which region means Discriminator think the input is fake/real?
Hi, I want to use the discriminator alone.
Following is my code:
I have three questions:
Thanks for your time.