model.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:chainer-DenseNet 作者: t-hanya 项目源码 文件源码
def __init__(self, depth=40, growth_rate=12, in_channels=16,
                 dropout_ratio=0.2, n_class=10):

        assert (depth - 4) % 3 == 0
        n_layers = int((depth - 4) / 3)
        n_ch = [in_channels + growth_rate * n_layers * i for i in range(4)]
        dropout_ratio = dropout_ratio if dropout_ratio > 0 else None

        super(DenseNet, self).__init__(
            conv0=L.Convolution2D(3, n_ch[0], 3, pad=1),
            dense1=DenseBlock(
                n_ch[0], n_layers, growth_rate, dropout_ratio),
            trans1=TransitionLayer(n_ch[1], n_ch[1], dropout_ratio),
            dense2=DenseBlock(
                n_ch[1], n_layers, growth_rate, dropout_ratio),
            trans2=TransitionLayer(n_ch[2], n_ch[2], dropout_ratio),
            dense3=DenseBlock(
                n_ch[2], n_layers, growth_rate, dropout_ratio),
            norm4=L.BatchNormalization(n_ch[3]),
            fc4=L.Linear(n_ch[3], n_class),
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号