VAE --Need only 1's Samples --(Important Needed help)-Day 10

Hi All,

I have a question on sample generation from VAE.(need to generate only 1’s)

I am referring to VAE implementation in pytorch,

After training the code generates the samples
sample = Variable(torch.randn(64, 20))
sample = model.decode(sample).cpu()
save_image(sample.data.view(64, 1, 28, 28), ‘results/sample_’ + str(epoch) + ‘.png’)

But it generates all the images is there any possibility that i can only sample 1’s separately and 2’s separately and…so on

Thanks,
Jay

If by “only 1’s” you mean generating only sample images representing the digit 1, then it is (almost) impossible to do it perfectly if you trained your network on the whole MNIST dataset.

What you can do if you want to use a VAE to generate samples of 1’s and 2’s separately is to train one VAE for each digit.

Yeah,…i was hoping if there is anyway we can do it…

But thanks a lot for your response