出于project的需要,不仅要detect和classify对象,还希望建立不同class的对象之间的关系,进行所谓的pair-matching。

需要完成以下几步:

1. dataset中label的增加:

在自定义的dataset类中,方法_load_XXX_annotation(self, index) 增加 gt_pair 这个annotation:

./lib/datasets/bar_noGroup.py:172: gt_pair = np.zeros((num_objs), dtype=np.int32) # for pair-matching algorithm
./lib/datasets/bar_noGroup.py:198: gt_pair[ix] = int(obj.find('ind_class'))
./lib/datasets/bar_noGroup.py:207: 'gt_pair': gt_pair,

2.

lib/layer_utils/proposal_target_layer.py:21:def proposal_target_layer(rpn_rois, rpn_scores, gt_boxes, gt_texts, gt_pair, _num_classes):
lib/layer_utils/proposal_target_layer.py:49: labels, texts, pair, rois, roi_scores, bbox_targets, bbox_inside_weights = _sample_rois(
lib/layer_utils/proposal_target_layer.py:50: all_rois, all_scores, gt_boxes, gt_texts, gt_pair, fg_rois_per_image,
lib/layer_utils/proposal_target_layer.py:60: return rois, roi_scores, labels,texts, pair, Variable(bbox_targets), Variable(bbox_inside_weights), Variable(bbox_outside_weights)
lib/layer_utils/proposal_target_layer.py:107:def _sample_rois(all_rois, all_scores, gt_boxes, gt_texts, gt_pair, fg_rois_per_image, rois_per_image, num_classes):
lib/layer_utils/proposal_target_layer.py:119: pair = [gt_pair[i] for i in gt_assignment]
lib/layer_utils/proposal_target_layer.py:120: print('pair:')
lib/layer_utils/proposal_target_layer.py:121: print(pair)
lib/layer_utils/proposal_target_layer.py:153: pair = [pair[i] for i in keep_inds]
lib/layer_utils/proposal_target_layer.py:167: return labels, texts, pair, rois, roi_scores, bbox_targets, bbox_inside_weights

3.

lib/nets/network.py:215: rois, roi_scores, labels,texts,pair, bbox_targets, bbox_inside_weights, bbox_outside_weights = \
lib/nets/network.py:217: rois, roi_scores, self._gt_boxes, self._gt_texts, self._gt_pair, self._num_classes)
lib/nets/network.py:222: self._proposal_targets['pair'] = pair
lib/nets/network.py:228: if (k != 'texts') and (k != 'pair'):
lib/nets/network.py:293: pair_targets = self._proposal_targets['pair']
lib/nets/network.py:294: #print(pair_targets)
lib/nets/network.py:522: def forward(self, image, im_info, gt_boxes=None, gt_texts=None, gt_pair=None, mode='TRAIN'):
lib/nets/network.py:534: self._gt_pair = gt_pair
lib/nets/network.py:601: blobs['gt_texts'], blobs['gt_pair'])
lib/nets/network.py:610: blobs['gt_texts'], blobs['gt_pair'])
lib/nets/network.py:629: blobs['gt_texts'], blobs['gt_pair'])

4.

lib/roi_data_layer/minibatch.py:50: blobs['gt_pair'] = [roidb[0]['gt_pair'][i] for i in gt_inds]

faster-RCNN 加入新的Ground Truth的更多相关文章

  1. Faster R-CNN利用新的网络结构来训练

    前言 最近利用Faster R-CNN训练数据,使用ZF模型,效果无法有效提高.就想尝试对ZF的网络结构进行改造,记录下具体操作. 一.更改网络,训练初始化模型 这里为了方便,我们假设更换的网络名为L ...

  2. AI佳作解读系列(二)——目标检测AI算法集杂谈:R-CNN,faster R-CNN,yolo,SSD,yoloV2,yoloV3

    1 引言 深度学习目前已经应用到了各个领域,应用场景大体分为三类:物体识别,目标检测,自然语言处理.本文着重与分析目标检测领域的深度学习方法,对其中的经典模型框架进行深入分析. 目标检测可以理解为是物 ...

  3. faster rcnn讲解很细

    https://blog.csdn.net/bailufeiyan/article/details/50749694 https://www.cnblogs.com/dudumiaomiao/p/65 ...

  4. 第三十一节,目标检测算法之 Faster R-CNN算法详解

    Ren, Shaoqing, et al. “Faster R-CNN: Towards real-time object detection with region proposal network ...

  5. faster rcnn相关内容

    转自: https://zhuanlan.zhihu.com/p/31426458 faster rcnn的基本结构 Faster RCNN其实可以分为4个主要内容: Conv layers.作为一种 ...

  6. 论文阅读笔记二十七:Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks(CVPR 2016)

    论文源址:https://arxiv.org/abs/1506.01497 tensorflow代码:https://github.com/endernewton/tf-faster-rcnn 室友对 ...

  7. faster rcnn 详解

    转自:https://zhuanlan.zhihu.com/p/31426458 经过R-CNN和Fast RCNN的积淀,Ross B. Girshick在2016年提出了新的Faster RCNN ...

  8. [转]CNN目标检测(一):Faster RCNN详解

    https://blog.csdn.net/a8039974/article/details/77592389 Faster RCNN github : https://github.com/rbgi ...

  9. Faster R-CNN论文详解 - CSDN博客

    废话不多说,上车吧,少年 paper链接:Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks ...

随机推荐

  1. Codeforces Round #598 (Div. 3) D. Binary String Minimizing

    You are given a binary string of length nn (i. e. a string consisting of nn characters '0' and '1'). ...

  2. linux 复制系统盘 dd

    lsblk sudo dd  if=/dev/mmcblk0 of=/dev/sda bs=8M sudo watch -n 5 pkill -USR1 ^dd$

  3. C++ 宏定义创建(销毁)单例

    Util.h: #define CREATE_SINGLETON_POINTER(CLASS,INSTANCE,MUTEX) if (NULL == INSTANCE) \ { \ MUTEX.loc ...

  4. Python - 装饰器实现缓存

    from functools import wraps def cache(func): cache = {} @wraps(func) def wrap(*args): if args not in ...

  5. Linux - 常用Shell软件

    tldr conda dstat htop oh-my-zsh https://github.com/nicolargo/glances neofetch

  6. cs/bs

    c(客户端)/s服务器:使用前必须安装,更新是,c s同时更新,不能跨频繁太,采用自由协议,相对来说安全. b(浏览器)/s:本质上还是cs ,只是使用了浏览器:如京东,淘宝.无需安装,客户端不需要更 ...

  7. python pylab.plot() 方法使用

    Python 中用pylab模块, pylab.plot() 函数,绘制折线统计图 import pylab as pl x = [, , , ] y = [, , , ] ''' plot参数说明: ...

  8. sort的使用

    sort主要是用来排序的,可以用自定义的函数进行比较,也可以用系统的4中函数进行比较,即less(),greater(),less_equal(),greater_equal().但是我试了一下,发现 ...

  9. 排序算法之插入排序的python实现

    插入排序的工作原理如下: (1)从数组第一个元素开始(0下标),从该元素开始进行构建有序序列: (2)取出待排序列中第一个元素,然后从“有序”序列中,从后往前扫描: (3)如果该元素(有序序列)大于待 ...

  10. No space left on device(总结)

    ..1 提示磁盘满了 df -hT 没有满 请问可能原因 可能是inode满了,原因是机器上的小文件太多了 使用df -hi 查看 ..2 提示没有磁盘空间已经满了 ..2.1 问题描述: 发现是日志 ...