Home

Awesome

Extra-Chainer

Useful classes and functions implementation for Chainer, the deep learning framework.
Various novel methods are (and will be) implemented for examples,
and various CNN-models are available in .\models\ directory.

Requirements

Training example

# ordinary learning
python trainer.py --gpu [# of GPU] --model [ex.)models\PreResNet20.py]
# between class learning
python trainer_bcl.py --gpu [# of GPU] --model [ex.)models\PreResNet20.py]

Send message to slack example

  1. Get slack token and save as slack_token on root directory.
    To get token, please show here, thanks to @yuishihara.
  2. Run below command. The option slack_interval means interval of epoch.
    *The example send message to slack channel bot.
    If you want to send to other channel, you rewrite SlackOut() to SlackOut(channel='xxx') in trainer.py.
python trainer.py --gpu [# of GPU] --model [ex.)models\PreResNet20.py] --slack_interval 10

links

Implementations of chainer.Link

In python script, write chain_modules and network_modules:

from chain_modules import Module
from network_modules import Encoder
import chainer.links as L

class MyCnnModel(chainer.Chain):
    def __init__(self):
        super(MyCnnModel, self).__init__()
        with self.init_scope()
            ...
            # ResNet module definition
            self.res = Module(16, 32, 'I+CBRCB>R')
            # PreActResNet module definition
            self.pres = Module(16, 32, 'I+BRCBRC')
            # PreActResNet (bottleneck) module definition
            self.bres = Module(16, 32, 'I+BRcBRcBR4c')
            # ResNeXt module definition
            self.resx = Module(64, 128, 'I+BR8cBR8GBR4c', G=(lambda s: L.Convolution2D(None, s.ch, 3, s.stride, 1, group=8)))
            # DenseNet module definition
            self.dense = Module(16, 12, 'I,BRC')
            # Encoder part of ResNet20 definition
            self.res20 = Encoder((3, 3, 3), None, (16, 32, 64), 'I+CBRCB>R', 'A', None, (1, 1, 1))
            ...

functions

Implementations of chainer.Function

models

Implementations of neural network models by chainer.Link.

Various examples are available in the directory.

utils

Implementations of utility functions.

Usages

Please look in each directory.