thangvubk / cascade-rpn Goto Github PK
View Code? Open in Web Editor NEWCode for NeurIPS 2019 paper: "Cascade RPN: Delving into High-Quality Region Proposal Network with Adaptive Convolution"
License: Apache License 2.0
Code for NeurIPS 2019 paper: "Cascade RPN: Delving into High-Quality Region Proposal Network with Adaptive Convolution"
License: Apache License 2.0
Hi,I wonder why you use a single anchor per location. Will you get a better result if using more anchor ratios? Thanks.
I can't run the code, either on mmdet1.0 or mmdet2.0.
Can you talk me if I use this branch, which pytorch , mmdet and mmcv should I use?
And I find commit 6b9866 of mmdetecion framework, but with the lasted mmdetection2.1 and your commit 6b9866, I can't run the code also.
I am trying to implement Cascade RPN with the most recent mmdetection. I have a custom dataset with 4 different id for detection. After running train.py script, after the 1st epoch I am getting the following error:
" File "/home/user/Downloads/mmdetection-master/mmdet/core/evaluation/bbox_overlaps.py", line 33, in bbox_overlaps
area2 = (bboxes2[:, 2] - bboxes2[:, 0] + 1) * (
IndexError: too many indices for array
"
Is it because I am using a CustomDataset? What changes I should do to make it work for my own dataset?
I have a epoch_1.pth file generated but I am not able to get mAP chart as expected for the detection task. I am new to this project and any help with this would be appreciated .Thanks.
What does “regression statistics” mean?
:), When mmdetectionv2 will support Cascade-RPN?
Hi! I'm June.
I'm so impressed with your idea of changing RPN in 2 stage detector.
And also thanks for well-organized Cascade-RPN code.
When I followed your instruction to train Cascade-RPN based Faster R-CNN, I found something strange.
The problem is "s0.loss_rpn_reg is always 0".
It was same when to train only Cascade-RPN.
Is it normal to get zero of regression loss at the first rpn stage?
It would be a pleasure if you explain this phenomenon.
I am Vansin, the technical operator of OpenMMLab. In September of last year, we announced the release of OpenMMLab 2.0 at the World Artificial Intelligence Conference in Shanghai. We invite you to upgrade your algorithm library to OpenMMLab 2.0 using MMEngine, which can be used for both research and commercial purposes. If you have any questions, please feel free to join us on the OpenMMLab Discord at https://discord.gg/amFNsyUBvm or add me on WeChat (van-sin) and I will invite you to the OpenMMLab WeChat group.
Here are the OpenMMLab 2.0 repos branches:
OpenMMLab 1.0 branch | OpenMMLab 2.0 branch | |
---|---|---|
MMEngine | 0.x | |
MMCV | 1.x | 2.x |
MMDetection | 0.x 、1.x、2.x | 3.x |
MMAction2 | 0.x | 1.x |
MMClassification | 0.x | 1.x |
MMSegmentation | 0.x | 1.x |
MMDetection3D | 0.x | 1.x |
MMEditing | 0.x | 1.x |
MMPose | 0.x | 1.x |
MMDeploy | 0.x | 1.x |
MMTracking | 0.x | 1.x |
MMOCR | 0.x | 1.x |
MMRazor | 0.x | 1.x |
MMSelfSup | 0.x | 1.x |
MMRotate | 1.x | 1.x |
MMYOLO | 0.x |
Attention: please create a new virtual environment for OpenMMLab 2.0.
Hi,
It is mentioned in the paper that the use of anchor-free and sample discrimination in stage 1, an anchor is a positive sample if its center is inside the center region of an object.
And then, I found the classification loss function that you use at this stage is CrossEntropyLoss. I wonder why you didn't use focal loss like the other anchor-free methods. Wouldn't you encounter the problem of unbalanced positive and negative samples.
Looking forward to your reply, thank you!
Hi,
can not found the related information by this repository?
could you share more info with me?
Thanks
According to your config at Faster RCNN, A mistake is encountered when I train Cascade RCNN. s0.loss_rpn_reg in the log information always is 0.....
my config is as follows:
rpn_weight = 0.7
model = dict(
type='CascadeRCNN',
num_stages=3,
num_rpn_stages=2,
pretrained="/home/tikboa/306_server_work/model_zoo/X101_dcn_backbone.pth",
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=4,
style='pytorch',
dcn=dict(
modulated=False,
groups=32,
deformable_groups=1,
fallback_on_stride=False),
stage_with_dcn=(False, True, True, True),
# gcb=dict(ratio=1. / 4., ),
# stage_with_gcb=(False, True, True, True)
),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
out_channels=256,
num_outs=5),
rpn_head=[
dict(
type='CascadeRPNHead',
in_channels=256,
feat_channels=256,
anchor_scales=[8],
anchor_ratios=[1.0],
anchor_strides=[4, 8, 16, 32, 64],
target_means=[.0, .0, .0, .0],
target_stds=[0.1, 0.1, 0.5, 0.5],
with_cls=False,
dilation=3,
bridged_feature=True,
sampling=False,
loss_cls=dict(
type='CrossEntropyLoss',
use_sigmoid=True,
loss_weight=rpn_weight),
loss_bbox=dict(
type='IoULoss', linear=True, loss_weight=10.0 * rpn_weight)),
dict(
type='CascadeRPNHead',
in_channels=256,
feat_channels=256,
anchor_scales=[8],
anchor_ratios=[1.0],
anchor_strides=[4, 8, 16, 32, 64],
target_means=[.0, .0, .0, .0],
target_stds=[0.05, 0.05, 0.1, 0.1],
feat_adapt=True,
loss_cls=dict(
type='CrossEntropyLoss',
use_sigmoid=True,
loss_weight=1.0 * rpn_weight),
loss_bbox=dict(
type='IoULoss', linear=True, loss_weight=10.0 * rpn_weight))],
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
bbox_head=[
dict(
type='ConvFCBBoxHead',
num_shared_convs=4,
num_shared_fcs=1,
in_channels=256,
conv_out_channels=256,
fc_out_channels=1024,
roi_feat_size=7,
num_classes=16,
target_means=[0., 0., 0., 0.],
target_stds=[0.1, 0.1, 0.2, 0.2],
reg_class_agnostic=True,
loss_cls=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)),
dict(
type='ConvFCBBoxHead',
num_shared_convs=4,
num_shared_fcs=1,
in_channels=256,
conv_out_channels=256,
fc_out_channels=1024,
roi_feat_size=7,
num_classes=16,
target_means=[0., 0., 0., 0.],
target_stds=[0.05, 0.05, 0.1, 0.1],
reg_class_agnostic=True,
loss_cls=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)),
dict(
type='ConvFCBBoxHead',
num_shared_convs=4,
num_shared_fcs=1,
in_channels=256,
conv_out_channels=256,
fc_out_channels=1024,
roi_feat_size=7,
num_classes=16,
target_means=[0., 0., 0., 0.],
target_stds=[0.033, 0.033, 0.067, 0.067],
reg_class_agnostic=True,
loss_cls=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))
]
)
train_cfg = dict(
rpn=[
dict(
assigner=dict(
type='RegionAssigner',
center_ratio=0.2,
ignore_ratio=0.5),
allowed_border=-1,
pos_weight=-1,
debug=False),
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.7,
neg_iou_thr=0.7,
min_pos_iou=0.3,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=256,
pos_fraction=0.5,
neg_pos_ub=-1,
add_gt_as_proposals=False),
allowed_border=-1,
pos_weight=-1,
debug=False)],
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=2000,
max_num=300,
nms_thr=0.8,
min_bbox_size=0),
rcnn=[
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.3,
neg_iou_thr=0.3,
min_pos_iou=0.3,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=512,
pos_fraction=0.25,
neg_pos_ub=-1,
add_gt_as_proposals=True),
pos_weight=-1,
debug=False),
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.4,
neg_iou_thr=0.4,
min_pos_iou=0.4,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=512,
pos_fraction=0.25,
neg_pos_ub=-1,
add_gt_as_proposals=True),
pos_weight=-1,
debug=False),
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.5,
neg_iou_thr=0.5,
min_pos_iou=0.5,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=512,
pos_fraction=0.25,
neg_pos_ub=-1,
add_gt_as_proposals=True),
pos_weight=-1,
debug=False)
],
stage_loss_weights=[1, 0.5, 0.25])
test_cfg = dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=300,
nms_thr=0.8,
min_bbox_size=0),
rcnn=dict(
score_thr=0.001, nms=dict(type='nms', iou_thr=0.5), max_per_img=100)
# soft-nms is also supported for rcnn testing
# e.g., nms=dict(type='soft_nms', iou_thr=0.5, min_score=0.05)
)
Thank you for your great work!
Do you try GIoU or CIoU loss in your experiments?
Firstly, many thanks for sharing this interest work.
I just had a very quick question on whether you were also able to see notable improvements when incorporating Cascade RPN with Cascade R-CNN, perhaps after increasing the IoU thresholds to reflect the higher quality of region proposals.
Kind regards,
Se
In paper's section 4.1 says that:
- 𝑦[𝑝]=∑_(𝑜∈𝑂)▒〖𝑤[𝑜]∙𝑥[𝑝+𝑜]〗
- 𝑂=𝑂_𝑐𝑡𝑟+𝑂_𝑠ℎ𝑝
- 𝑂_𝑠ℎ𝑝={ (±(𝑎_𝑤^)/2 𝑜𝑟 0,±(𝑎_ℎ^)/2 𝑜𝑟 0)} )
I don't quite understand the operation referred to line 3. Could you please to point out what parts does it include in the code?
I am pretty sure I have the environment set up as mentioned in #16 , I am getting this error though:
I am exploring the domain and a beginner at this. Any help would be appreciated. Thanks
Hello,
I want to get the model weight of crpn(Cascade R-CNN | Cascade RPN | R-50-FPN),
but http://bit.ly/crpn_cascade_rcnn_r50 can't access.
Is there any other alternative?
Thx.
Thanks for ur wonderful work!
I try to do some extension depends on ur codes, but when i read the code, I find something strange.
Its in mmdet/core/bbox/assigner/region_assigner.py
In step 4 :Assign -1 to ignore adjacent lvl
when use calc_region
function ,
d_ignore_region = calc_region(gt_bbox, d_stride, r2, d_featmap_size)
u_ignore_region = calc_region(gt_bbox, u_stride, r2, u_featmap_size)
should r2
and d_stride or u_stride
change their place?
I try some example and under this code condition I get strange x,y
gt_box : tensor([473.8398, 384.1748, 804.3822, 467.8830], device='cuda:0')
d_ignore_region : x1(tensor(167., dvice='cuda:0'), y2tensor(99., device='cuda:0'), x2:tensor(0., device='cuda:0'), y2:tensor(0., device='cuda:0'))
x1 even larger than x2
but I change their place, the d_ignore_region/u_ignore_region seems normal
So I wonder if the code is something wrong, or I misunderstand someting
Thanks
s0.loss_rpn_reg: 0.0636, s1.loss_rpn_cls: 0.0010, s1.loss_rpn_reg: 0.2153, loss_semantic_seg: 0.9256, s0.loss_cls: 0.0855, s0.acc: 98.7988, s0.loss_bbox: 0.0004, s0.loss_mask: 0.6273, s1.loss_cls: 0.0821, s1.acc: 98.8086, s1.loss_bbox: 0.0000, s1.loss_mask: 0.3148, s2.loss_cls: 0.1494, s2.acc: 98.8086, s2.loss_bbox: 0.0000, s2.loss_mask: 0.1577, loss: 2.6227
Hi, I transfer this project to mmdetectionv2.0 version using htc, but the loss in my project shows that the s0.loss_rpn_reg << s1.loss_rpn_reg, and when I using the IOU-loss, it will report "NAN" in loss.
Excuse me, Do you know the probable reason?
Hi,
Thanks for your great work. I am a bit curious about how you apply anchor-based metric to sample.
Faster R-CNN sets a positive training IoU threshold and a negative IoU threshold. It keeps their numbers close to a ratio of 1:3. Since you only use one threshold, does this mean you only compute losses on those proposals with IoU higher than 0.7, and ignore others?
Best,
Jy
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.