## Spatial CNN Prototxt Generator
This script is for generating [Spatial CNN](https://github.com/XingangPan/SCNN) caffe prototxt file.
### How to use
- Run run.sh to generate Spatial CNN module, modify parameters to yours.
'--height', '--width', and '--channel' are number of rows, columns, and channels of the last feature maps respectively.
- Copy the text in the generated SCNN.prototxt, and paste it to the right position in your original model prototxt file (the one that you want to add Spatial CNN).
- Don't forget to modify the 'bottom' of the next layer to "SCNN".
- Example:
Original prototxt file: examples/resnet101.prototxt
Generated SCNN text: examples/SCNN.prototxt
New prototxt file with SCNN: examples/resnet101_SCNN.prototxt
(For this example, the prototxt is aligned with the caffe version at https://github.com/hszhao/PSPNet)
You can visualize the network architecture at http://ethereon.github.io/netscope/#/editor.
### About Spatial CNN (SCNN)
![SCNN](examples/SCNN.png)
- Spatial CNN enables explicit and effective spatial information propagation between neurons in the same layer of a CNN.
- For more details, please refer to [our paper](https://arxiv.org/abs/1712.06080).
### Practical Concerns
- In practice I initialize SCNN layers with variance sqrt(5) times smaller than the MSRA initialization for numarical stability concern.
- It would be helpful to initialize all other layers with a pretrained model. Directly training from random initialization may cause SCNN to diverge.
- The best way to utilize SCNN is to insert it right after the last feature maps (top hidden layer, before the classification layer).
- The number of channels (num_c) of the last feature maps should not be too large since the memory consumption of SCNN is sensitive to num_c.
In practive I find 128 to be an appropriate choice for num_c, 512 might be a little bit large. You can try larger num_c if you have enough GPU memory.
- To reduce num_c in ResNet50/101, directly change num_output from 512 to 128 in "Conv5_4" layer may decrease the performance. Aternatively, you can add an extra "Conv5_5" layer to map the 512 feature maps to 128 with 1x1 convolution, as did in 'examples/resnet101.prototxt'.
没有合适的资源?快使用搜索试试~ 我知道了~
SCNN-prototxt-generator:生成空间CNN caffe prototxt文件的脚本
共7个文件
prototxt:3个
py:1个
md:1个
需积分: 10 0 下载量 41 浏览量
2021-05-13
19:25:32
上传
评论
收藏 123KB ZIP 举报
温馨提示
空间CNN Prototxt生成器 该脚本用于生成 caffe prototxt文件。 如何使用 运行run.sh生成Spatial CNN模块,然后修改参数。 “ --height”,“-width”和“ --channel”分别是最后一个特征图的行数,列数和通道数。 将文本复制到生成的SCNN.prototxt中,然后将其粘贴到原始模型prototxt文件(您要添加Spatial CNN的文件)中的正确位置。 不要忘记将下一层的“底部”修改为“ SCNN”。 例子: 原始prototxt文件:examples / resnet101.prototxt 生成的SCNN文本:examples / SCNN.prototxt 带有SCNN的新prototxt文件:examples / resnet101_SCNN.prototxt (对于此示例,prototxt与caffe版本在对齐)
资源详情
资源评论
资源推荐
收起资源包目录
SCNN-prototxt-generator-master.zip (7个子文件)
SCNN-prototxt-generator-master
SCNN_generator.py 6KB
run.sh 173B
examples
resnet101_SCNN.prototxt 217KB
resnet101.prototxt 100KB
SCNN.prototxt 117KB
SCNN.png 98KB
README.md 2KB
共 7 条
- 1
还是那个小宇
- 粉丝: 26
- 资源: 4729
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0