-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sampling #13
Comments
Hi Cristoph, you can sample from the model by sampling a latent vector from the prior (with ancestral sampling) and then decoding it. A snippet should look like this: def generate_images(model: LSACIFAR10, how_many: int) -> Tuple[torch.Tensor, torch.Tensor]:
z_samples = torch.zeros(how_many, model.code_length, dtype=torch.float).to('cuda')
model.eval()
with torch.no_grad():
for i in range(0, model.code_length):
z_dist = model.estimator(z_samples)
probs = torch.softmax(z_dist[:, :, i]).data
z_samples[:, i] = torch.multinomial(probs, 1).float().squeeze(1) / model.cpd_channels
x_samples = model.decoder(z_samples)
return z_samples, x_samples In principle, you can sample also from video models, such as the one trained on ShanghaiTech, but the sampling on latent vectors will have two nested loops as the code as the temporal axis as well. Let me know how it goes. D |
Hi Davide, Then I ran the sampling example. I had to adjust The variation of the samples looks a bit underestimated. It seems as the "memorization" works well but the density estimation is too smooth. Have I over-regularized with lambda=1? Second: Interestingly, the reconstructions are almost grayscale. Have you had similar issues during development? I'm looking forward to you hints and suggestions! Christoph |
Great!!! It looked like an over-regularization issue :) Best, |
Yap :-P How would you generalize the LSA_cifar10 model to a model with 256x256 input? Just add Down/Up sampling layers or would you also add residual blocks? Best, |
@DavideA Hi, thank you for sharing your code about the LSA model. May I get the full training code? |
@ChristophJud Can you share your code? |
Hey casgj,
|
@ChristophJud Yes, my training code doesn't work, the accuray and recall is always 0.009%. |
I'd recommend to check all hyper-parameters in the supplemental material |
Hi, thank you for sharing your code about the LSA model. Having trained the full model, I'm wondering how I can sample from the LSA? Can I just draw a uniform random vector as z and put it into the CPD estimator?
The text was updated successfully, but these errors were encountered: