facebookresearch / NeuralCompression

A collection of tools for neural compression enthusiasts.
MIT License
496 stars 43 forks source link

Add loss functions #199

Closed mmuckley closed 1 year ago

mmuckley commented 1 year ago

This PR includes a suite of loss function refactors. Loss functions for training models are pulled out of the metrics submodule and into the new loss_fn submodule. This provides a more clear delineation of intended purpose. It also allows separate implementations, which is useful for LPIPS, where we need divide-by-0 protection for the loss, but not for the metric.

Tests are included for all metrics. The normalized LPIPS loss is tested implicitly with the MSE-LPIPS loss.

Losses include: