欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

faster-rcnn中添加Mask中的RoiAlign层,使回归框更精确( roi_align_layer.cu:240] Check failed: error == cudaSuccess *)

发布时间:2024/9/21 编程问答 43 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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/protocaffe.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 *)的全部内容,希望文章能够帮你解决所遇到的问题。

    如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。