torch-firewood

Firewood is a PyTorch implementation of layers and models.


License
MIT
Install
pip install torch-firewood==0.0.1

Documentation

Firewood

Implementation of custom torch layers and models.
All layers are compatible with official pytorch nn.Module and support ddp strategy.

Installation

Models & Trainers

(nn.Module model & pytorch-lightning trainer)

GAN

Semantic Segmentation

  • BiSeNetV1
  • BiSeNetV2
Layers

Separable Convolution

  • Depthwise - Pointwise Convolution
    • weight shape: Conv(in, out, K, K) β†’ Conv(in, 1, K, K) X Conv(1, out, 1, 1)
  • Spatialwise Convolution
    • weight shape: Conv(in, out, K, K) β†’ Conv(in, smaller, K, 1) X Conv(smaller, out, 1, K)

Denormalizations

  • AdaIN
  • SPADE

Introduced from ProGAN

  • Learning rate Equalizer hooks

Introduced from StyleGAN

  • Weight Gradient Fixable Convolution
    • All options are compatible with tensorflow convolution. (e.g. "same" padding)
    • Can implement exactly same with tensorflow.
  • Fused Activation (biased activation, cuda extension)
  • Up Fir Down filter 1D, 2D, 3D (only 2D support cuda extension)
  • Weight Demodulation hooks
    • Support Conv and Linear

PyTorchLightning

Callbacks

  • Latent Interpolator
  • Latent Sampler
  • Condition Interpolator (Multi-Condition)
  • Image to Image Translation Sampler
  • Save Last K ModelCheckpoint

Metrics

  • FID
    • selectable resizing method
      • default: antialiased torchvision
      • original: tf1
    • On CPU computable to avoid GPU VRAM overflow error

Dataset

  • NoClassImageFolder for single class model
  • PairedImageFolder for I2I model
  • ConditionImageFolder for multi-condition(multi-class) model