Comments (2)
Please check section H in DVAE++: https://arxiv.org/pdf/1802.04920.pdf and also section A in NVAE.
The basic idea is to multiply the KL term for each group with a scalar coefficient such that groups that have low KL are encouraged to use more latent variables (hence increase their KL) and groups that have high KL are encouraged to reduce it. We set this coefficient proportional to the average KL per group in a batch divided by the dimension of each group.
The problem with this coefficient is that we cannot just set it to any value and we need to normalize it such that it sums to N (N=number of groups). This way our KL term is scaled properly compared to the reconstruction term. When all the groups are used equally kl_coeff_i
becomes ~1 for each group.
The operations you noted are redundant indeed. We just basically need to do:
kl_coeff_i = kl_coeff_i / feature_resolution # division by latent resolution
kl_coeff_i = num_group * kl_coeff_i / torch.sum(kl_coeff_i, dim=1, keepdim=True) # normalization such that sum = num_group
kl = torch.sum(kl_all * kl_coeff_i.detach(), dim=1)
I also noticed that in the paper we say that we set the coefficient proportional to the size of each group on page 14 which is a typo and it should have been reverse proportional to the size of each group.
from nvae.
Thanks a lot for your detailed explanation. It is really helpful.
from nvae.
Related Issues (20)
- FID score of CelebA-HQ 256x256 HOT 1
- NomalDecoder & num_bits
- TypeError: batch_norm_backward_elemt() missing 1 required positional arguments: "count" HOT 1
- How to run without using parallelization? HOT 1
- Can you provide pretrained models? HOT 1
- why is there self.prior_ftr0 in the decoder model?
- Why some of the generate images by the official checkpoint of CelebA64 are NaN-value? HOT 2
- Query: CelebA HQ 256
- Query: Dataset CelebA-HQ 256x256 issue
- Query: FFHQ Pre-Processing HOT 3
- FFHQ Training
- CelebA-HQ 256x256 Data Pre-processing HOT 1
- Possible typo in the log_p() function
- ImageNet Checkpoint
- Question regarding traversing the latent space
- Why output for 3-rd channel is unused in Logistic mixture? HOT 1
- how can i use the code on my own dataset. if it's necessary to modify the code carefully myself? HOT 1
- "arch_instance" argument
- Problem while converting tfrecord to lmdb data AttributeError: 'bytes' object has no attribute 'cpu' HOT 4
- Question about KL computation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvae.