目标检测系列(一)—— R-CNN模型

R-CNN

论文地址:论文
代码地址:代码

简介

在这里插入图片描述
利用Selective Search方法在输入图像上提取候选框(每张图片约2k个),之后将这些候选框resize到一定尺寸后,传入预训练好的模型进行特征提取,最后利用SVM进行图像分类, 并且,单独训练一个BBox回归器用于回归Bounding Box

性能

RCNN算法在VOC-07数据集上取得了非常显著的效果,平均精度由33.7%(DPM-V5, 传统检测的SOTA算法)提升到58.5%。相比于传统检测算法,基于深度学习的检测算法在精度上取得了质的飞跃。

核心代码复现
  1. 用 Selective Search 提取图像ROI
    安装opencv-contrib-python方法,利用其中的cv2.ximgproc.segmentation.createSelectiveSearchSegmentation 方法完成选择性搜索
    def cal_pro_region(self, img_path):
        '''
        计算每张图片的proposal region
        Returns:
            np.array: proposal region的坐标, 大小为num*4, 4列分别[xmin, ymin, xmax, ymax]
        '''
        # 选择性搜索类
        try:
            ss = cv2.ximgproc.segmentation.createSelectiveSearchSegmentation()
        except AttributeError:
            raise Exception('需要安装opencv-contrib-python, 安装前请先删除原有的opencv-python')
        ss.setBaseImage(cv2.imread(img_path))
        ss.switchToSelectiveSearchFast()
        rects = ss.process()
        rects[:, 2] += rects[:, 0]
        rects[:, 3] += rects[:, 1]
        return rects
  1. 用预训练好的模型在提取的候选框图像上微调
def train(train_dataloader,val_dataloader,net,epochs,lr,loss_f
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值