Skip to content

Commit 01e2d71

Browse files
committed
refactor with open-mmlab://mmdetection
2 parents 38b0b8e + dd260bc commit 01e2d71

File tree

273 files changed

+23007
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+23007
-1196
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Thanks for your bug report and we appreciate that a lot.
11+
12+
**Checklist**
13+
- [ ] I have searched related issues but could not get the expected help.
14+
- [ ] The bug has not been fixed in the latest version.
15+
16+
**Describe the bug**
17+
A clear and concise description of what the bug is.
18+
If there are any related issues or upstream bugs, please also refer to them.
19+
20+
**Error traceback**
21+
1. What command or script did you run?
22+
```
23+
A placeholder for the command.
24+
```
25+
2. If applicable, paste the error trackback here using code blocks.
26+
```
27+
A placeholder for trackback.
28+
```
29+
30+
**Reproduction details**
31+
1. Did you make any modifications on the code? Did you understand what you have modified?
32+
2. What dataset did you use?
33+
34+
**Environment**
35+
- OS: [e.g., Ubuntu 16.04.6]
36+
- GCC [e.g., 5.4.0]
37+
- PyTorch version [e.g., 1.1.0]
38+
- How you installed PyTorch [e.g., pip, conda, source]
39+
- GPU model [e.g., 1080Ti, V100]
40+
- CUDA and CUDNN version
41+
- [optional] Other information that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
42+
43+
**Bug fix**
44+
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the feature**
11+
12+
**Motivation**
13+
A clear and concise description of the motivation of the feature.
14+
Ex1. It is inconvenient when [....].
15+
Ex2. There is a recent paper [....], which is very helpful for [....].
16+
17+
**Related resources**
18+
If there is an official code release or third-party implementations, please also provide the information here, which would be very helpful.
19+
20+
**Additional context**
21+
Add any other context or screenshots about the feature request here.
22+
If you would like to implement the feature and create a PR, please leave a comment here and that would be much appreciated.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: General questions
3+
about: Ask general questions to get help
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,13 @@ mmdet/version.py
109109
data
110110
.vscode
111111
.idea
112+
<<<<<<< HEAD
112113
work_dirs
114+
=======
115+
116+
# custom
117+
*.pkl
118+
*.pkl.json
119+
*.log.json
120+
work_dirs/
121+
>>>>>>> upstream/master

.style.yapf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[style]
2+
BASED_ON_STYLE = pep8
3+
BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true
4+
SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = true

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dist: xenial
2+
language: python
3+
4+
install:
5+
- pip install flake8
6+
7+
python:
8+
- "3.5"
9+
- "3.6"
10+
- "3.7"
11+
12+
script:
13+
- flake8

LICENSE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Copyright 2018-2019 Open-MMLab. All rights reserved.
2+
13
Apache License
24
Version 2.0, January 2004
35
http://www.apache.org/licenses/
@@ -186,7 +188,7 @@
186188
same "printed page" as the copyright notice for easier
187189
identification within third-party archives.
188190

189-
Copyright [yyyy] [name of copyright owner]
191+
Copyright 2018-2019 Open-MMLab.
190192

191193
Licensed under the Apache License, Version 2.0 (the "License");
192194
you may not use this file except in compliance with the License.

README.md

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
By [Yue Cao](http://yue-cao.me), [Jiarui Xu](http://jerryxu.net), [Stephen Lin](https://scholar.google.com/citations?user=c3PYmxUAAAAJ&hl=en), Fangyun Wei, [Han Hu](https://sites.google.com/site/hanhushomepage/).
44

55
This repo is a official implementation of ["GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond"](https://arxiv.org/abs/1904.11492) on COCO object detection based on open-mmlab's [mmdetection](https://github.com/open-mmlab/mmdetection).
6-
Many thanks to mmdetection for their simple and clean framework.
6+
Many thanks to mmdetection for their simple and clean framework.
7+
8+
*Update on 2019/07/01*
9+
10+
The code is refactored.
11+
More results are provided and all configs could be found in `configs/gcnet`.
12+
13+
**Notes**: Both PyTorch official SyncBN and Apex SyncBN have some stability issues.
14+
During training, mAP may drops to zero and back to normal during last few epochs.
15+
16+
*Update on 2019/06/03*
17+
18+
GCNet is supported by the official mmdetection repo [here](https://github.com/open-mmlab/mmdetection/tree/master/configs/gcnet).
19+
Thanks again for open-mmlab's work on open source projects.
720

821
## Introduction
922

@@ -22,41 +35,56 @@ Many thanks to mmdetection for their simple and clean framework.
2235

2336
## Main Results
2437

25-
| Backbone | Model | Context | Lr schd | box AP | mask AP | Download |
26-
| :-------: | :--------------: | :------------: | :-----: | :----: | :-----: | :-------: |
27-
| R-50-FPN | Mask | - | 1x | 37.2 | 33.8 | [model](https://1drv.ms/f/s!AkEXj14LxwVpcEkPyk8YWZVm9fo) |
28-
| | | GC(c3-c5, r16) | 1x | 39.4 | 35.7 | [model](https://1drv.ms/f/s!AkEXj14LxwVpbSe8MYcjXToB090) |
29-
| | | GC(c3-c5, r4) | 1x | 39.9 | 36.2 | [model](https://1drv.ms/f/s!AkEXj14LxwVpaiEOLB67my2og3c) |
30-
| R-101-FPN | Mask | - | 1x | 39.8 | 36.0 | [model](https://1drv.ms/f/s!AkEXj14LxwVpcTx0JnBi1tuK4KU) |
31-
| | | GC(c3-c5, r16) | 1x | 41.1 | 37.4 | [model](https://1drv.ms/f/s!AkEXj14LxwVpbqlp5GGBiZsoVaU) |
32-
| | | GC(c3-c5, r4) | 1x | 41.7 | 37.6 | [model](https://1drv.ms/f/s!AkEXj14LxwVpa-WTFi9kcyuWB8I) |
33-
| X-101-FPN | Mask | - | 1x | 41.2 | 37.3 | [model](https://1drv.ms/f/s!AkEXj14LxwVpcgwQlf8ok6IZahc) |
34-
| | | GC(c3-c5, r16) | 1x | 42.4 | 38.0 | [model](https://1drv.ms/f/s!AkEXj14LxwVpb_4H8Q_bsmHZP7c) |
35-
| | | GC(c3-c5, r4) | 1x | 42.9 | 38.5 | [model](https://1drv.ms/f/s!AkEXj14LxwVpbLZR1Wu2JjMNyW0) |
36-
| X-101-FPN | Cascade Mask | - | 1x | 44.7 | 38.3 | [model](https://1drv.ms/f/s!Ak5O6Kz9hYOghnGJIdfM2fWlBsMR) |
37-
| | | GC(c3-c5, r16) | 1x | 45.9 | 39.3 | [model](https://1drv.ms/f/s!Ak5O6Kz9hYOghm7gwd5yd4ZX-Dub) |
38-
| | | GC(c3-c5, r4) | 1x | 46.5 | 39.7 | [model](https://1drv.ms/f/s!Ak5O6Kz9hYOghk9roKJSNNpJGGsE) |
39-
| X-101-FPN | DCN Cascade Mask | - | 1x | 47.1 | 40.4 | [model](https://1drv.ms/f/s!Ak5O6Kz9hYOghmw3k3L6SbKl84Ex) |
40-
| | | GC(c3-c5, r16) | 1x | 47.9 | 40.9 | [model](https://1drv.ms/f/s!Ak5O6Kz9hYOghm98OS64BAt0ZuOo) |
41-
| | | GC(c3-c5, r4) | 1x | 47.9 | 40.8 | [model](https://1drv.ms/f/s!Ak5O6Kz9hYOghlHmLvwSeF43ZISq) |
42-
38+
| Backbone | Model | Backbone Norm | Heads | Context | Lr schd | Mem (GB) | Train time (s/iter) | Inf time (fps) | box AP | mask AP | Download |
39+
|:---------:|:----------------:|:-------------:|:----------------:|:--------------:|:-------:|:--------:|:-------------------:|:--------------:|:------:|:-------:|:--------:|
40+
| R-50-FPN | Mask | fixBN | 2fc(w/o BN) | - | 1x | 3.9 | 0.453 | 10.6 | 37.3 | 34.2 | [model]()|
41+
| R-50-FPN | Mask | fixBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | 4.5 | 0.533 | 10.1 | 38.5 | 35.1 | [model]()|
42+
| R-50-FPN | Mask | fixBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | 4.6 | 0.533 | 9.9 | 38.9 | 35.5 | [model]()|
43+
| R-50-FPN | Mask | fixBN | 2fc(w/o BN) | - | 2x | - | - | - | 38.2 | 34.9 | [model]()|
44+
| R-50-FPN | Mask | fixBN | 2fc(w/o BN) | GC(c3-c5, r16) | 2x | - | - | - | 39.7 | 36.1 | [model]()|
45+
| R-50-FPN | Mask | fixBN | 2fc(w/o BN) | GC(c3-c5, r4) | 2x | - | - | - | 40.0 | 36.2 | [model]()|
46+
| R-50-FPN | Mask | SyncBN | 2fc(w/o BN) | - | 1x | 3.9 | 0.543 | 10.2 | 37.2 | 33.8 | [model]()|
47+
| R-50-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | 4.5 | 0.547 | 9.9 | 39.4 | 35.7 | [model]()|
48+
| R-50-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | 4.6 | 0.603 | 9.4 | 39.9 | 36.2 | [model]()|
49+
| R-50-FPN | Mask | SyncBN | 2fc(w/o BN) | - | 2x | 3.9 | 0.543 | 10.2 | 37.7 | 34.3 | [model]()|
50+
| R-50-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r16) | 2x | 4.5 | 0.547 | 9.9 | 39.7 | 36.0 | [model]()|
51+
| R-50-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r4) | 2x | 4.6 | 0.603 | 9.4 | 40.2 | 36.3 | [model]()|
52+
| R-50-FPN | Mask | SyncBN | 4conv1fc(SyncBN) | - | 1x | - | - | - | 38.8 | 34.6 | [model]()|
53+
| R-50-FPN | Mask | SyncBN | 4conv1fc(SyncBN) | GC(c3-c5, r16) | 1x | - | - | - | 41.0 | 36.5 | [model]()|
54+
| R-50-FPN | Mask | SyncBN | 4conv1fc(SyncBN) | GC(c3-c5, r4) | 1x | - | - | - | 41.4 | 37.0 | [model]()|
55+
| R-101-FPN | Mask | fixBN | 2fc(w/o BN) | - | 1x | 5.8 | 0.571 | 9.5 | 39.4 | 35.9 | [model]()|
56+
| R-101-FPN | Mask | fixBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | 7.0 | 0.731 | 8.6 | 40.8 | 37.0 | [model]()|
57+
| R-101-FPN | Mask | fixBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | 7.1 | 0.747 | 8.6 | 40.8 | 36.9 | [model]()|
58+
| R-101-FPN | Mask | SyncBN | 2fc(w/o BN) | - | 1x | 5.8 | 0.665 | 9.2 | 39.8 | 36.0 | [model]()|
59+
| R-101-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | 7.0 | 0.778 | 9.0 | 41.1 | 37.4 | [model]()|
60+
| R-101-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | 7.1 | 0.786 | 8.9 | 41.7 | 37.6 | [model]()|
61+
| X-101-FPN | Mask | SyncBN | 2fc(w/o BN) | - | 1x | 7.1 | 0.912 | 8.5 | 41.2 | 37.3 | [model]()|
62+
| X-101-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | 8.2 | 1.055 | 7.7 | 42.4 | 38.0 | [model]()|
63+
| X-101-FPN | Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | 8.3 | 1.037 | 7.6 | 42.9 | 38.5 | [model]()|
64+
| X-101-FPN | Cascade Mask | SyncBN | 2fc(w/o BN) | - | 1x | - | - | - | 44.7 | 38.3 | [model]()|
65+
| X-101-FPN | Cascade Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | - | - | - | 45.9 | 39.3 | [model]()|
66+
| X-101-FPN | Cascade Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | - | - | - | 46.5 | 39.7 | [model]()|
67+
| X-101-FPN | DCN Cascade Mask | SyncBN | 2fc(w/o BN) | - | 1x | - | - | - | 47.1 | 40.4 | [model]()|
68+
| X-101-FPN | DCN Cascade Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r16) | 1x | - | - | - | 47.9 | 40.9 | [model]()|
69+
| X-101-FPN | DCN Cascade Mask | SyncBN | 2fc(w/o BN) | GC(c3-c5, r4) | 1x | - | - | - | 47.9 | 40.8 | [model]()|
4370
**Notes:**
4471

4572
- `GC` denotes Global Context (GC) block is inserted after 1x1 conv of backbone.
4673
- `DCN` denotes replace 3x3 conv with 3x3 Deformable Convolution in `c3-c5` stages of backbone.
4774
- `r4` and `r16` denote ratio 4 and ratio 16 in GC block respectively.
75+
- Some of models are trained on 4 GPUs with 4 images on each GPU.
4876

4977
## Requirements
5078

5179
- Linux(tested on Ubuntu 16.04)
5280
- Python 3.6+
53-
- PyTorch 1.0.0
81+
- PyTorch 1.1.0
5482
- Cython
5583
- [apex](https://github.com/NVIDIA/apex) (Sync BN)
5684

5785
## Install
5886

59-
a. Install PyTorch 1.0 and torchvision following the [official instructions](https://pytorch.org/).
87+
a. Install PyTorch 1.1 and torchvision following the [official instructions](https://pytorch.org/).
6088

6189
b. Install latest apex with CUDA and C++ extensions following this [instructions](https://github.com/NVIDIA/apex#quick-start).
6290
The [Sync BN](https://nvidia.github.io/apex/parallel.html#apex.parallel.SyncBatchNorm) implemented by apex is required.
@@ -97,7 +125,7 @@ Please refer to mmdetection install [instruction](https://github.com/open-mmlab/
97125
### Software environment
98126

99127
- Python 3.6.7
100-
- PyTorch 1.0.0
128+
- PyTorch 1.1.0
101129
- CUDA 9.0
102130
- CUDNN 7.0
103131
- NCCL 2.3.5

compile.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,10 @@ if [ -d "build" ]; then
3636
rm -r build
3737
fi
3838
$PYTHON setup.py build_ext --inplace
39+
40+
echo "Building masked conv op..."
41+
cd ../masked_conv
42+
if [ -d "build" ]; then
43+
rm -r build
44+
fi
45+
$PYTHON setup.py build_ext --inplace

configs/cascade_mask_rcnn_r101_fpn_1x.py

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
anchor_strides=[4, 8, 16, 32, 64],
2525
target_means=[.0, .0, .0, .0],
2626
target_stds=[1.0, 1.0, 1.0, 1.0],
27-
use_sigmoid_cls=True),
27+
loss_cls=dict(
28+
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
29+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)),
2830
bbox_roi_extractor=dict(
2931
type='SingleRoIExtractor',
3032
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2),
@@ -40,7 +42,15 @@
4042
num_classes=81,
4143
target_means=[0., 0., 0., 0.],
4244
target_stds=[0.1, 0.1, 0.2, 0.2],
43-
reg_class_agnostic=True),
45+
reg_class_agnostic=True,
46+
loss_cls=dict(
47+
type='CrossEntropyLoss',
48+
use_sigmoid=False,
49+
loss_weight=1.0),
50+
loss_bbox=dict(
51+
type='SmoothL1Loss',
52+
beta=1.0,
53+
loss_weight=1.0)),
4454
dict(
4555
type='SharedFCBBoxHead',
4656
num_fcs=2,
@@ -50,7 +60,15 @@
5060
num_classes=81,
5161
target_means=[0., 0., 0., 0.],
5262
target_stds=[0.05, 0.05, 0.1, 0.1],
53-
reg_class_agnostic=True),
63+
reg_class_agnostic=True,
64+
loss_cls=dict(
65+
type='CrossEntropyLoss',
66+
use_sigmoid=False,
67+
loss_weight=1.0),
68+
loss_bbox=dict(
69+
type='SmoothL1Loss',
70+
beta=1.0,
71+
loss_weight=1.0)),
5472
dict(
5573
type='SharedFCBBoxHead',
5674
num_fcs=2,
@@ -60,7 +78,15 @@
6078
num_classes=81,
6179
target_means=[0., 0., 0., 0.],
6280
target_stds=[0.033, 0.033, 0.067, 0.067],
63-
reg_class_agnostic=True)
81+
reg_class_agnostic=True,
82+
loss_cls=dict(
83+
type='CrossEntropyLoss',
84+
use_sigmoid=False,
85+
loss_weight=1.0),
86+
loss_bbox=dict(
87+
type='SmoothL1Loss',
88+
beta=1.0,
89+
loss_weight=1.0))
6490
],
6591
mask_roi_extractor=dict(
6692
type='SingleRoIExtractor',
@@ -72,7 +98,9 @@
7298
num_convs=4,
7399
in_channels=256,
74100
conv_out_channels=256,
75-
num_classes=81))
101+
num_classes=81,
102+
loss_mask=dict(
103+
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)))
76104
# model training and testing settings
77105
train_cfg = dict(
78106
rpn=dict(
@@ -90,8 +118,14 @@
90118
add_gt_as_proposals=False),
91119
allowed_border=0,
92120
pos_weight=-1,
93-
smoothl1_beta=1 / 9.0,
94121
debug=False),
122+
rpn_proposal=dict(
123+
nms_across_levels=False,
124+
nms_pre=2000,
125+
nms_post=2000,
126+
max_num=2000,
127+
nms_thr=0.7,
128+
min_bbox_size=0),
95129
rcnn=[
96130
dict(
97131
assigner=dict(
@@ -146,9 +180,9 @@
146180
test_cfg = dict(
147181
rpn=dict(
148182
nms_across_levels=False,
149-
nms_pre=2000,
150-
nms_post=2000,
151-
max_num=2000,
183+
nms_pre=1000,
184+
nms_post=1000,
185+
max_num=1000,
152186
nms_thr=0.7,
153187
min_bbox_size=0),
154188
rcnn=dict(

0 commit comments

Comments
 (0)