Data Science Asked by user3023715 on March 21, 2021
OK, let’s say we have well-labeled images with non-discrete labels such as brightness or size or something and we want to generate images based on it. If it were done with a discrete label it could be done like:
def forward(self, inputs, label):
self.batch = inputs.size(0)
h = self.res1(inputs)
h = self.attn(h)
...
h = self.res5(h)
h = torch.sum((F.leaky_relu(h,0.2)).view(self.batch,-1,4*4), dim=2)
outputs = self.fc(h)
if label is not None:
embed = self.embedding(label)
outputs += torch.sum(embed*h,dim=1,keepdim=True)
The embedding can be made to match any shape to be added to a hidden layer and summing the embeddings to the latent, which forces the discriminator to recognize the class that’s it’s discriminating to make a better judgment on the discrimination. That’s cool and all, but this method uses embeddings which is the discrete method. How about a continuous label? I can’t really find a method for doing this except for some semisupervised methods whereas I have exact labels. Is anyone able to help me?
I think the answer is, you have to either create a very large number of categories, or do it completely differently than with the code I provided. The paper as a good solution to the problem.
Answered by user3023715 on March 21, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP