FCN全卷积 crop的计算方法
来源:互联网 发布:手机淘宝注册会员名 编辑:程序博客网 时间:2024/05/17 14:18
src:https://groups.google.com/forum/#!topic/caffe-users/YSRYy7Nd9J8
You're right. The cropping layer takes a crop bottom and a reference bottom.
To quickly answer your 2 questions :
1 - How does caffe understand where to crop? Apparently it does not by default. You have to tell it by specifying the offset
2 - What does the offset parameter used for? It is used to tell the cropping layer where exactly to crop.
2 - What does the offset parameter used for? It is used to tell the cropping layer where exactly to crop.
Let's take an example:
Blobs are 4D : (Batch size , Number of channels/filter , Height, Width) = (N,C,H,W)
1-crop bottom A is (20, 50, 512, 512)
2-reference bottom B is (20, 10, 256, 256)
3-the top blob C (result blob) will be (20, 10, 256, 256)
In this example we want to crop dimensions 1,2 & 3. But keep dimension 0 fixed.
So we set axis=1 (that will crop 1 and all the following axes)
The other parameter 'offset' specifies where exactly should the crop take place in A. Apparently this parameter has no defaults and have to be specified.
There are 2 modes :
1- Specify 3 offsets, one for each dimension : say offset = (25, 128, 128)
- So axis=1, offset=(25,128,128)
- The crop operation in numpy syntax will be : C = A[: , 25: 25+B.shape[1] , 128: 128+B.shape[2] , 128: 128+B.shape[3] ]
- In words : this will only take filters of A 25 to 35 and ignore the rest. And do a center crop for the spatial dimensions
2- Specify 1 offset that applies for all dimensions : offset = 25
- This will be exactly like in (1) with offset = (25, 25, 25)
The prototxt for mode (1) is the following :
layer {
name: "crop_layer"
type: "Crop"
bottom: "A"
bottom: "B"
top: "C"
crop_param {
axis: 1
axis: 1
offset: 25
offset: 128
offset: 128
offset: 128
}
}
一般情况下,都是中心点裁剪
Yea I've been there too...moving from longjon's branch to the recent caffe with a new crop layer.
Basically if you know you want to do center cropping (99% of the cases) it's easy to calculate the offsets :
To centrally crop a list of size 512 to only the middle 256 values, the offset would be 128.
offset = (Original_length - desired length ) / 2
do this for each dimension. To be able to do that you need to know the exact dimensions of the blobs coming in and out for your layers. Caffe prints these dimensions when the network is constructed.
阅读全文
0 0
- FCN全卷积 crop的计算方法
- 全卷积网络FCN的缺陷
- FCN全卷积网络
- FCN(全卷积神经网络)
- 全卷积网络(FCN)
- 全卷积网络(FCN)
- 全卷积网络FCN详解
- FCN 全卷积网络训练
- 全卷积网络 FCN 详解
- 全卷积网络FCN详解
- 全卷积与FCN详解
- FCN全卷积网原理
- 全卷积网络 FCN 详解
- fcn的反卷积
- FCN全卷积网络上采样理解
- 全卷积 FCN 数据标签制作
- 全卷积网络FCN几点认识
- FCN全卷积语义分割网络
- 开灯问题
- ViewPager+Fragment滑动切换页面(RadioButton底部导航栏)
- 编译opencv库QT
- TensorFlow 学习笔记(1)
- 梯度法-最优化算法设计与分析之一
- FCN全卷积 crop的计算方法
- TCP三次握手
- 这16道初级脚本算法题,你敢说全都会吗?
- bzoj4742 [Usaco2016 Dec] -- DP
- 二叉树实验报告
- 特殊的排序
- 【Unity3D】3D模型的使用——FBX的使用与Animation设置
- Leetcode 77. Combinations
- 手把手,脚把脚地教你实现网络爬虫程序(上)