Caffe入门:mobilenet_V1的Caffe实现—卷积参数group的使用

问题:mobilenetV1是基于tensorflow实现的,现在我需要将depthwise separable convolution利用Caffe实现,应该怎么办呢?
解决方法:使用卷积参数group实现。
       group对输入输出对应分组,默认为1,也就是说默认输出输入的所有通道各为一组。输出一个通道由输入所有通道进行卷积运算。如果我们把卷积group等于输入通道,输出通道等于输入通道便轻松实现了depthwize separable convolution结构。
如下,便是一个depthwize sepatable convolution示例:

layer {
  name: "conv2_1"
  type: "Convolution"
  bottom: "pool1b"
  top: "conv2_1"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 0
    decay_mult: 0
  }
  convolution_param {
    num_output: 64
    kernel_size: 3
    stride: 1
    pad: 1
    group: 64
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "relu2_1"
  type: "PReLU"
  bottom: "conv2_1"
  top: "conv2_1"
}
layer {
  name: "conv2_1_1"
  type: "Convolution"
  bottom: "conv2_1"
  top: "conv2_1_1"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 0
    decay_mult: 0
  }
  convolution_param {
    num_output: 64
    kernel_size: 1
    stride: 1
    pad: 0
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "relu2_1_1"
  type: "PReLU"
  bottom: "conv2_1_1"
  top: "conv2_1_1"
}

备注:group参数理解:https://blog.csdn.net/duan19920101/article/details/102615917

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值