zdyshine / pytorch-loss-functions

A collection of loss functions with easy usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


This repo is a combination of victorca25/BasicSR, mit-han-lab/data-efficient-gans and huster-wgm/Pytorch-metrics.

It aims to make the usage of different loss function, metrics and dataset augmentation easy and avoids using pip or other external depenencies.

Currently usable without major problems and with example usage in example.py:

  • Differentiable Augmentation
  • Metrics (PSNR, SSIM, AE, MSE)
  • HFEN Loss (High Frequency Error Norm) [1 2]
  • Elastic Loss
  • Relative L1
  • L1 (CosineSim) [1 2]
  • Clip L1 [1]
  • FFT Loss (Frequency loss) [1]
  • OF Loss (Overflow loss) [1]
  • GP Loss (Gradient Profile Loss) [1]
  • CP Loss (Color Profile Loss)
  • Style Loss [1 2] (Warning: No AMP support.)
  • TV Loss (Total Variation Loss)
  • Perceptual Loss (LPIPS)
  • Contextual Loss [1 2 3 4]

May be added in the future in example.py, but already in loss.py:

  • Charbonnier Loss (L1)
  • GAN Loss
  • Gradient Loss
  • Masked L1 Loss
  • Multiscale Pixel Loss
  • OFR Loss (Optical flow reconstruction loss (for video)) [1]
  • L1 regularization
  • Color Loss
  • Average Loss (Averaging Downscale loss)
  • SPL Compute With Trace (Spatial Profile Loss with trace)
  • SP Loss (Spatial Profile Loss without trace)
ezoic increase your site revenue


A collection of loss functions with easy usage


Language:Python 100.0%