faster-rcnn中添加Mask中的RoiAlign层,使回归框更精确( roi_align_layer.cu:240] Check failed: error == cudaSuccess *)
版權聲明:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/e01528/article/details/80265118
具體的操作為什么這樣做,可參照:
1.Caffe學習之自定義創建新的Layer層
?
2.如何在caffe中自定義網絡層
ROI pooling層
說起ROI Alignment,就要說道faster-rcnn的ROI pooling,
ROIpooling層結構是為了將原圖像的rois映射到固定大小的feature map上。而此方法有一些缺點,會帶來邊緣像素的缺失
ROI Pooling層解析。
ROI Align的作用
詳解 ROI Align 的基本原理和實現細節
如果roi大小為(7,6),而roipooling是分成了(6,6)的部分,(7,6)到(6,6)的轉換必然帶來了邊緣某像素的損失。而roialign利用雙線性插值,將roi(7,6)插值擴充到(12,12),此時再做(6,6)的roipooling,會提高精度,充分利用了roi的像素。
用到的文件鏈接: https://pan.baidu.com/s/1-f98btUdxX5h8bFTKRxLmA 密碼: mypk
1.~/py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers 添加roi_align_layer.hpp
2.~/py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers 添加roi_align_layer.cpp roi_align_layer.cu
3.~/py-faster-rcnn/caffe-fast-rcnn/src/caffe/proto 中caffe.proto添加add for roi align以下的
// Message that stores parameters used by ROIPoolingLayer
message ROIPoolingParameter {
// Pad, kernel size, and stride are all given as a single value for equal
// dimensions in height and width or as Y, X pairs.
optional uint32 pooled_h = 1 [default = 0]; // The pooled output height
optional uint32 pooled_w = 2 [default = 0]; // The pooled output width
// Multiplicative spatial scale factor to translate ROI coords from their
// input scale to the scale used when pooling
optional float spatial_scale = 3 [default = 1];
// add for roi align
optional float pad_ratio = 4[default = 0];
optional uint32 bi_type = 5 [default = 0];
optional bool is_multi_interpolate = 6 [default = true];
?
4.返回caffe-fast-rcnn路徑下 make clean ,make -j64,make pycaffe
5.修改model文件夾下面的prototxt模型文件,將ROIPooling換成ROIAlign
?
---------------------------------------- ???? 更新與2018年5月16日???? --------------------------------------
如果你電腦出現下面這樣的問題
roi_align_layer.cu:240] Check failed: error == cudaSuccess (7 vs. 0) too many resources requested for launch?
【解決方法】:
1. 刪除 roi_align_layer.cu文件
2. 打開roi_align_layer.hpp文件注釋掉需要gpu加速的語句.(如下圖)
3. 重新編譯 make clean ,make -j64,make pycaffe
注意:如果不注釋hpp的那一段,直接刪除cu文件,重新編譯會報錯
--------------------- 本文來自 Snoopy_Dream 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/e01528/article/details/80265118?utm_source=copy
總結
以上是生活随笔為你收集整理的faster-rcnn中添加Mask中的RoiAlign层,使回归框更精确( roi_align_layer.cu:240] Check failed: error == cudaSuccess *)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Faster R-CNN改进篇(二):
- 下一篇: 机器学习专业术语