Skip to content

Commit 4a43e68

Browse files
[Feature] Support Objects365 v1 and v2 Dataset (#7525)
Co-authored-by: RangiLyu <[email protected]>
1 parent 5ce2600 commit 4a43e68

17 files changed

+1098
-16
lines changed

.dev_scripts/gather_models.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def get_dataset_name(config):
141141
VOCDataset='Pascal VOC',
142142
WIDERFaceDataset='WIDER Face',
143143
OpenImagesDataset='OpenImagesDataset',
144-
OpenImagesChallengeDataset='OpenImagesChallengeDataset')
144+
OpenImagesChallengeDataset='OpenImagesChallengeDataset',
145+
Objects365V1Dataset='Objects365 v1',
146+
Objects365V2Dataset='Objects365 v2')
145147
cfg = mmcv.Config.fromfile('./configs/' + config)
146148
return name_map[cfg.dataset_type]
147149

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# dataset settings
2+
dataset_type = 'Objects365V1Dataset'
3+
data_root = 'data/Objects365/Obj365_v1/'
4+
img_norm_cfg = dict(
5+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
6+
train_pipeline = [
7+
dict(type='LoadImageFromFile'),
8+
dict(type='LoadAnnotations', with_bbox=True),
9+
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
10+
dict(type='RandomFlip', flip_ratio=0.5),
11+
dict(type='Normalize', **img_norm_cfg),
12+
dict(type='Pad', size_divisor=32),
13+
dict(type='DefaultFormatBundle'),
14+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
15+
]
16+
test_pipeline = [
17+
dict(type='LoadImageFromFile'),
18+
dict(
19+
type='MultiScaleFlipAug',
20+
img_scale=(1333, 800),
21+
flip=False,
22+
transforms=[
23+
dict(type='Resize', keep_ratio=True),
24+
dict(type='RandomFlip'),
25+
dict(type='Normalize', **img_norm_cfg),
26+
dict(type='Pad', size_divisor=32),
27+
dict(type='ImageToTensor', keys=['img']),
28+
dict(type='Collect', keys=['img']),
29+
])
30+
]
31+
data = dict(
32+
samples_per_gpu=2,
33+
workers_per_gpu=2,
34+
train=dict(
35+
type=dataset_type,
36+
ann_file=data_root + 'annotations/objects365_train.json',
37+
img_prefix=data_root + 'train/',
38+
pipeline=train_pipeline),
39+
val=dict(
40+
type=dataset_type,
41+
ann_file=data_root + 'annotations/objects365_val.json',
42+
img_prefix=data_root + 'val/',
43+
pipeline=test_pipeline),
44+
test=dict(
45+
type=dataset_type,
46+
ann_file=data_root + 'annotations/objects365_val.json',
47+
img_prefix=data_root + 'val/',
48+
pipeline=test_pipeline))
49+
evaluation = dict(interval=1, metric='bbox')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# dataset settings
2+
dataset_type = 'Objects365V2Dataset'
3+
data_root = 'data/Objects365/Obj365_v2/'
4+
img_norm_cfg = dict(
5+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
6+
train_pipeline = [
7+
dict(type='LoadImageFromFile'),
8+
dict(type='LoadAnnotations', with_bbox=True),
9+
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
10+
dict(type='RandomFlip', flip_ratio=0.5),
11+
dict(type='Normalize', **img_norm_cfg),
12+
dict(type='Pad', size_divisor=32),
13+
dict(type='DefaultFormatBundle'),
14+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
15+
]
16+
test_pipeline = [
17+
dict(type='LoadImageFromFile'),
18+
dict(
19+
type='MultiScaleFlipAug',
20+
img_scale=(1333, 800),
21+
flip=False,
22+
transforms=[
23+
dict(type='Resize', keep_ratio=True),
24+
dict(type='RandomFlip'),
25+
dict(type='Normalize', **img_norm_cfg),
26+
dict(type='Pad', size_divisor=32),
27+
dict(type='ImageToTensor', keys=['img']),
28+
dict(type='Collect', keys=['img']),
29+
])
30+
]
31+
data = dict(
32+
samples_per_gpu=2,
33+
workers_per_gpu=2,
34+
train=dict(
35+
type=dataset_type,
36+
ann_file=data_root + 'annotations/zhiyuan_objv2_train.json',
37+
img_prefix=data_root + 'train/',
38+
pipeline=train_pipeline),
39+
val=dict(
40+
type=dataset_type,
41+
ann_file=data_root + 'annotations/zhiyuan_objv2_val.json',
42+
img_prefix=data_root + 'val/',
43+
pipeline=test_pipeline),
44+
test=dict(
45+
type=dataset_type,
46+
ann_file=data_root + 'annotations/zhiyuan_objv2_val.json',
47+
img_prefix=data_root + 'val/',
48+
pipeline=test_pipeline))
49+
evaluation = dict(interval=1, metric='bbox')

configs/objects365/README.md

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Objects365 Dataset
2+
3+
> [Objects365 Dataset](https://openaccess.thecvf.com/content_ICCV_2019/papers/Shao_Objects365_A_Large-Scale_High-Quality_Dataset_for_Object_Detection_ICCV_2019_paper.pdf)
4+
5+
<!-- [DATASET] -->
6+
7+
## Abstract
8+
9+
<!-- [ABSTRACT] -->
10+
11+
#### Objects365 Dataset V1
12+
13+
[Objects365 Dataset V1](http://www.objects365.org/overview.html) is a brand new dataset,
14+
designed to spur object detection research with a focus on diverse objects in the Wild.
15+
It has 365 object categories over 600K training images. More than 10 million, high-quality bounding boxes are manually labeled through a three-step, carefully designed annotation pipeline. It is the largest object detection dataset (with full annotation) so far and establishes a more challenging benchmark for the community. Objects365 can serve as a better feature learning dataset for localization-sensitive tasks like object detection
16+
and semantic segmentation.
17+
18+
<!-- [IMAGE] -->
19+
20+
<div align=center>
21+
<img src="https://user-images.githubusercontent.com/48282753/208368046-b7573022-06c9-4a99-af17-a6ac7407e3d8.png" height="400"/>
22+
</div>
23+
24+
#### Objects365 Dataset V2
25+
26+
[Objects365 Dataset V2](http://www.objects365.org/overview.html) is based on the V1 release of the Objects365 dataset.
27+
Objects 365 annotated 365 object classes on more than 1800k images, with more than 29 million bounding boxes in the training set, surpassing PASCAL VOC, ImageNet, and COCO datasets.
28+
Objects 365 includes 11 categories of people, clothing, living room, bathroom, kitchen, office/medical, electrical appliances, transportation, food, animals, sports/musical instruments, and each category has dozens of subcategories.
29+
30+
## Citation
31+
32+
```
33+
@inproceedings{shao2019objects365,
34+
title={Objects365: A large-scale, high-quality dataset for object detection},
35+
author={Shao, Shuai and Li, Zeming and Zhang, Tianyuan and Peng, Chao and Yu, Gang and Zhang, Xiangyu and Li, Jing and Sun, Jian},
36+
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
37+
pages={8430--8439},
38+
year={2019}
39+
}
40+
```
41+
42+
## Prepare Dataset
43+
44+
1. You need to download and extract Objects365 dataset. Users can download Objects365 V2 by using `tools/misc/download_dataset.py`.
45+
46+
**Usage**
47+
48+
```shell
49+
python tools/misc/download_dataset.py --dataset-name objects365v2 \
50+
--save-dir ${SAVING PATH} \
51+
--unzip \
52+
--delete # Optional, delete the download zip file
53+
```
54+
55+
**Note:** There is no download link for Objects365 V1 right now. If you would like to download Objects365-V1, please visit [official website](http://www.objects365.org/) to concat the author.
56+
57+
2. The directory should be like this:
58+
59+
```none
60+
mmdetection
61+
├── mmdet
62+
├── tools
63+
├── configs
64+
├── data
65+
│ ├── Objects365
66+
│ │ ├── Obj365_v1
67+
│ │ │ ├── annotations
68+
│ │ │ │ ├── objects365_train.json
69+
│ │ │ │ ├── objects365_val.json
70+
│ │ │ ├── train # training images
71+
│ │ │ ├── val # validation images
72+
│ │ ├── Obj365_v2
73+
│ │ │ ├── annotations
74+
│ │ │ │ ├── zhiyuan_objv2_train.json
75+
│ │ │ │ ├── zhiyuan_objv2_val.json
76+
│ │ │ ├── train # training images
77+
│ │ │ │ ├── patch0
78+
│ │ │ │ ├── patch1
79+
│ │ │ │ ├── ...
80+
│ │ │ ├── val # validation images
81+
│ │ │ │ ├── patch0
82+
│ │ │ │ ├── patch1
83+
│ │ │ │ ├── ...
84+
```
85+
86+
## Results and Models
87+
88+
### Objects365 V1
89+
90+
| Architecture | Backbone | Style | Lr schd | Mem (GB) | box AP | Config | Download |
91+
| :----------: | :------: | :-----: | :-----: | :------: | :----: | :-----------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
92+
| Faster R-CNN | R-50 | pytorch | 1x | - | 19.6 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v1.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v1/faster_rcnn_r50_fpn_16x4_1x_obj365v1_20221219_181226-9ff10f95.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v1/faster_rcnn_r50_fpn_16x4_1x_obj365v1_20221219_181226.log.json) |
93+
| Faster R-CNN | R-50 | pytorch | 1350K | - | 22.3 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/objects365/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1_20220510_142457-337d8965.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1_20220510_142457.log.json) |
94+
| Retinanet | R-50 | pytorch | 1x | - | 14.8 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/objects365/retinanet_r50_fpn_1x_obj365v1.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_1x_obj365v1/retinanet_r50_fpn_1x_obj365v1_20221219_181859-ba3e3dd5.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_1x_obj365v1/retinanet_r50_fpn_1x_obj365v1_20221219_181859.log.json) |
95+
| Retinanet | R-50 | pytorch | 1350K | - | 18.0 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/objects365/retinanet_r50_fpn_syncbn_1350k_obj365v1.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_syncbn_1350k_obj365v1/retinanet_r50_fpn_syncbn_1350k_obj365v1_20220513_111237-7517c576.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_syncbn_1350k_obj365v1/retinanet_r50_fpn_syncbn_1350k_obj365v1_20220513_111237.log.json) |
96+
97+
### Objects365 V2
98+
99+
| Architecture | Backbone | Style | Lr schd | Mem (GB) | box AP | Config | Download |
100+
| :----------: | :------: | :-----: | :-----: | :------: | :----: | :------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
101+
| Faster R-CNN | R-50 | pytorch | 1x | - | 19.8 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v2.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v2/faster_rcnn_r50_fpn_16x4_1x_obj365v2_20221220_175040-5910b015.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v2/faster_rcnn_r50_fpn_16x4_1x_obj365v2_20221220_175040.log.json) |
102+
| Retinanet | R-50 | pytorch | 1x | - | 16.7 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/objects365/retinanet_r50_fpn_1x_obj365v2.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_1x_obj365v2/retinanet_r50_fpn_1x_obj365v2_20221223_122105-d9b191f1.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_1x_obj365v2/retinanet_r50_fpn_1x_obj365v2_20221223_122105.log.json) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
_base_ = [
2+
'../_base_/models/faster_rcnn_r50_fpn.py',
3+
'../_base_/datasets/objects365v1_detection.py',
4+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
5+
]
6+
7+
model = dict(roi_head=dict(bbox_head=dict(num_classes=365)))
8+
9+
data = dict(samples_per_gpu=4)
10+
11+
# Using 32 GPUS while training
12+
optimizer = dict(type='SGD', lr=0.08, momentum=0.9, weight_decay=0.0001)
13+
optimizer_config = dict(
14+
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
15+
lr_config = dict(
16+
policy='step',
17+
warmup='linear',
18+
warmup_iters=1000,
19+
warmup_ratio=1.0 / 1000,
20+
step=[8, 11])
21+
22+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
23+
# USER SHOULD NOT CHANGE ITS VALUES.
24+
# base_batch_size = (16 GPUs) x (4 samples per GPU)
25+
auto_scale_lr = dict(base_batch_size=64)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
_base_ = [
2+
'../_base_/models/faster_rcnn_r50_fpn.py',
3+
'../_base_/datasets/objects365v2_detection.py',
4+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
5+
]
6+
7+
model = dict(roi_head=dict(bbox_head=dict(num_classes=365)))
8+
9+
data = dict(samples_per_gpu=4)
10+
11+
# Using 32 GPUS while training
12+
optimizer = dict(type='SGD', lr=0.08, momentum=0.9, weight_decay=0.0001)
13+
optimizer_config = dict(
14+
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
15+
lr_config = dict(
16+
policy='step',
17+
warmup='linear',
18+
warmup_iters=1000,
19+
warmup_ratio=1.0 / 1000,
20+
step=[8, 11])
21+
22+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
23+
# USER SHOULD NOT CHANGE ITS VALUES.
24+
# base_batch_size = (16 GPUs) x (4 samples per GPU)
25+
auto_scale_lr = dict(base_batch_size=64)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
_base_ = [
2+
'../_base_/models/faster_rcnn_r50_fpn.py',
3+
'../_base_/datasets/objects365v1_detection.py',
4+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
5+
]
6+
norm_cfg = dict(type='SyncBN', requires_grad=True)
7+
model = dict(
8+
backbone=dict(norm_cfg=norm_cfg),
9+
roi_head=dict(bbox_head=dict(num_classes=365)))
10+
11+
# Using 8 GPUS while training
12+
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
13+
optimizer_config = dict(
14+
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
15+
16+
runner = dict(
17+
_delete_=True, type='IterBasedRunner', max_iters=1350000) # 36 epochs
18+
lr_config = dict(
19+
policy='step',
20+
warmup='linear',
21+
warmup_iters=1000,
22+
warmup_ratio=1.0 / 1000,
23+
step=[900000, 1200000])
24+
25+
checkpoint_config = dict(interval=150000)
26+
evaluation = dict(interval=150000, metric='bbox')
27+
28+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
29+
# USER SHOULD NOT CHANGE ITS VALUES.
30+
# base_batch_size = (8 GPUs) x (2 samples per GPU)
31+
auto_scale_lr = dict(base_batch_size=16)

configs/objects365/metafile.yml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
- Name: retinanet_r50_fpn_1x_obj365v1
2+
In Collection: RetinaNet
3+
Config: configs/objects365/retinanet_r50_fpn_1x_obj365v1.py
4+
Metadata:
5+
Training Memory (GB): 7.4
6+
Epochs: 12
7+
Training Data: Objects365 v1
8+
Training Techniques:
9+
- SGD with Momentum
10+
- Weight Decay
11+
Results:
12+
- Task: Object Detection
13+
Dataset: Objects365 v1
14+
Metrics:
15+
box AP: 14.8
16+
Weights: https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_1x_obj365v1/retinanet_r50_fpn_1x_obj365v1_20221219_181859-ba3e3dd5.pth
17+
18+
- Name: retinanet_r50_fpn_syncbn_1350k_obj365v1
19+
In Collection: RetinaNet
20+
Config: configs/objects365/retinanet_r50_fpn_syncbn_1350k_obj365v1.py
21+
Metadata:
22+
Training Memory (GB): 7.6
23+
Iterations: 1350000
24+
Training Data: Objects365 v1
25+
Training Techniques:
26+
- SGD with Momentum
27+
- Weight Decay
28+
Results:
29+
- Task: Object Detection
30+
Dataset: Objects365 v1
31+
Metrics:
32+
box AP: 18.0
33+
Weights: https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_syncbn_1350k_obj365v1/retinanet_r50_fpn_syncbn_1350k_obj365v1_20220513_111237-7517c576.pth
34+
35+
- Name: retinanet_r50_fpn_1x_obj365v2
36+
In Collection: RetinaNet
37+
Config: configs/objects365/retinanet_r50_fpn_1x_obj365v2.py
38+
Metadata:
39+
Training Memory (GB): 7.2
40+
Epochs: 12
41+
Training Data: Objects365 v2
42+
Training Techniques:
43+
- SGD with Momentum
44+
- Weight Decay
45+
Results:
46+
- Task: Object Detection
47+
Dataset: Objects365 v2
48+
Metrics:
49+
box AP: 16.7
50+
Weights: https://download.openmmlab.com/mmdetection/v2.0/objects365/retinanet_r50_fpn_1x_obj365v2/retinanet_r50_fpn_1x_obj365v2_20221223_122105-d9b191f1.pth
51+
52+
- Name: faster_rcnn_r50_fpn_16x4_1x_obj365v1
53+
In Collection: Faster R-CNN
54+
Config: configs/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v1.py
55+
Metadata:
56+
Training Memory (GB): 11.4
57+
Epochs: 12
58+
Training Data: Objects365 v1
59+
Training Techniques:
60+
- SGD with Momentum
61+
- Weight Decay
62+
Results:
63+
- Task: Object Detection
64+
Dataset: Objects365 v1
65+
Metrics:
66+
box AP: 19.6
67+
Weights: https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v1/faster_rcnn_r50_fpn_16x4_1x_obj365v1_20221219_181226-9ff10f95.pth
68+
69+
- Name: faster_rcnn_r50_fpn_syncbn_1350k_obj365v1
70+
In Collection: Faster R-CNN
71+
Config: configs/objects365/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1.py
72+
Metadata:
73+
Training Memory (GB): 8.6
74+
Iterations: 1350000
75+
Training Data: Objects365 v1
76+
Training Techniques:
77+
- SGD with Momentum
78+
- Weight Decay
79+
Results:
80+
- Task: Object Detection
81+
Dataset: Objects365 v1
82+
Metrics:
83+
box AP: 22.3
84+
Weights: https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1/faster_rcnn_r50_fpn_syncbn_1350k_obj365v1_20220510_142457-337d8965.pth
85+
86+
- Name: faster_rcnn_r50_fpn_16x4_1x_obj365v2
87+
In Collection: Faster R-CNN
88+
Config: configs/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v2.py
89+
Metadata:
90+
Training Memory (GB): 10.8
91+
Epochs: 12
92+
Training Data: Objects365 v1
93+
Training Techniques:
94+
- SGD with Momentum
95+
- Weight Decay
96+
Results:
97+
- Task: Object Detection
98+
Dataset: Objects365 v2
99+
Metrics:
100+
box AP: 19.8
101+
Weights: https://download.openmmlab.com/mmdetection/v2.0/objects365/faster_rcnn_r50_fpn_16x4_1x_obj365v2/faster_rcnn_r50_fpn_16x4_1x_obj365v2_20221220_175040-5910b015.pth

0 commit comments

Comments
 (0)