Skip to content

VAE Loss: The weight of BCE vs. KL #234

@huanghoujing

Description

@huanghoujing

The BCE loss is averaged over the batch dimension, but KL is averaged over both batch and image pixel dimension. I hope to know the reason for this.

I tried both

  • averaging the BCE loss over both dimensions
  • averaging the KL loss just over batch dimension

But the reconstructed images and generated images in test time are rather faint and blurry (just like digit 8), which is far worse than the setting here.

If the setting here is just to balance between two loss, why do you use the number of image pixels (which is intuitively supposed to have some mathematical meaning) for scaling. Why not use some number like 10, 100 or 1000?

Thanks for help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions