Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- grounding-dino/mmdetection/configs/_base_/schedules/schedule_1x.py +28 -0
- grounding-dino/mmdetection/configs/_base_/schedules/schedule_20e.py +28 -0
- grounding-dino/mmdetection/configs/_base_/schedules/schedule_2x.py +28 -0
- grounding-dino/mmdetection/configs/sort/README.md +108 -0
- grounding-dino/mmdetection/configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py +54 -0
- grounding-dino/mmdetection/configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17train_test-mot17test.py +15 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/README.md +38 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/metafile.yml +80 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r101_fpn_300-proposals_crop-ms-480-800-3x_coco.py +7 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r101_fpn_ms-480-800-3x_coco.py +7 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r50_fpn_1x_coco.py +101 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r50_fpn_300-proposals_crop-ms-480-800-3x_coco.py +43 -0
- grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r50_fpn_ms-480-800-3x_coco.py +32 -0
- grounding-dino/mmdetection/configs/ssd/README.md +62 -0
- grounding-dino/mmdetection/configs/ssd/metafile.yml +78 -0
- grounding-dino/mmdetection/configs/ssd/ssd300_coco.py +71 -0
- grounding-dino/mmdetection/configs/ssd/ssd512_coco.py +60 -0
- grounding-dino/mmdetection/configs/ssd/ssdlite_mobilenetv2-scratch_8xb24-600e_coco.py +158 -0
- grounding-dino/mmdetection/configs/strong_baselines/README.md +20 -0
- grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_amp-lsj-100e_coco.py +4 -0
- grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py +68 -0
- grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-400e_coco.py +20 -0
- grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_amp-lsj-100e_coco.py +4 -0
- grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py +30 -0
- grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-50e_coco.py +5 -0
- grounding-dino/mmdetection/configs/strong_baselines/metafile.yml +24 -0
- grounding-dino/mmdetection/configs/strongsort/README.md +108 -0
- grounding-dino/mmdetection/configs/strongsort/metafile.yml +48 -0
- grounding-dino/mmdetection/configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py +130 -0
- grounding-dino/mmdetection/configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py +44 -0
- grounding-dino/mmdetection/configs/strongsort/yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py +188 -0
- grounding-dino/mmdetection/configs/strongsort/yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py +108 -0
- grounding-dino/mmdetection/configs/swin/README.md +41 -0
- grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco.py +6 -0
- grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py +60 -0
- grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py +3 -0
- grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py +99 -0
- grounding-dino/mmdetection/configs/swin/metafile.yml +120 -0
- grounding-dino/mmdetection/configs/swin/retinanet_swin-t-p4-w7_fpn_1x_coco.py +31 -0
- grounding-dino/mmdetection/configs/timm_example/README.md +62 -0
- grounding-dino/mmdetection/configs/timm_example/retinanet_timm-efficientnet-b1_fpn_1x_coco.py +23 -0
- grounding-dino/mmdetection/configs/timm_example/retinanet_timm-tv-resnet50_fpn_1x_coco.py +22 -0
- grounding-dino/mmdetection/configs/tood/README.md +40 -0
- grounding-dino/mmdetection/configs/tood/metafile.yml +95 -0
- grounding-dino/mmdetection/configs/tood/tood_r101-dconv-c3-c5_fpn_ms-2x_coco.py +7 -0
- grounding-dino/mmdetection/configs/tood/tood_r101_fpn_ms-2x_coco.py +7 -0
- grounding-dino/mmdetection/configs/tood/tood_r50_fpn_1x_coco.py +80 -0
- grounding-dino/mmdetection/configs/tood/tood_r50_fpn_anchor-based_1x_coco.py +2 -0
- grounding-dino/mmdetection/configs/tood/tood_r50_fpn_ms-2x_coco.py +30 -0
- grounding-dino/mmdetection/configs/tood/tood_x101-64x4d-dconv-c4-c5_fpn_ms-2x_coco.py +7 -0
grounding-dino/mmdetection/configs/_base_/schedules/schedule_1x.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# training schedule for 1x
|
| 2 |
+
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=12, val_interval=1)
|
| 3 |
+
val_cfg = dict(type='ValLoop')
|
| 4 |
+
test_cfg = dict(type='TestLoop')
|
| 5 |
+
|
| 6 |
+
# learning rate
|
| 7 |
+
param_scheduler = [
|
| 8 |
+
dict(
|
| 9 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
|
| 10 |
+
dict(
|
| 11 |
+
type='MultiStepLR',
|
| 12 |
+
begin=0,
|
| 13 |
+
end=12,
|
| 14 |
+
by_epoch=True,
|
| 15 |
+
milestones=[8, 11],
|
| 16 |
+
gamma=0.1)
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
# optimizer
|
| 20 |
+
optim_wrapper = dict(
|
| 21 |
+
type='OptimWrapper',
|
| 22 |
+
optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001))
|
| 23 |
+
|
| 24 |
+
# Default setting for scaling LR automatically
|
| 25 |
+
# - `enable` means enable scaling LR automatically
|
| 26 |
+
# or not by default.
|
| 27 |
+
# - `base_batch_size` = (8 GPUs) x (2 samples per GPU).
|
| 28 |
+
auto_scale_lr = dict(enable=False, base_batch_size=16)
|
grounding-dino/mmdetection/configs/_base_/schedules/schedule_20e.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# training schedule for 20e
|
| 2 |
+
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=20, val_interval=1)
|
| 3 |
+
val_cfg = dict(type='ValLoop')
|
| 4 |
+
test_cfg = dict(type='TestLoop')
|
| 5 |
+
|
| 6 |
+
# learning rate
|
| 7 |
+
param_scheduler = [
|
| 8 |
+
dict(
|
| 9 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
|
| 10 |
+
dict(
|
| 11 |
+
type='MultiStepLR',
|
| 12 |
+
begin=0,
|
| 13 |
+
end=20,
|
| 14 |
+
by_epoch=True,
|
| 15 |
+
milestones=[16, 19],
|
| 16 |
+
gamma=0.1)
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
# optimizer
|
| 20 |
+
optim_wrapper = dict(
|
| 21 |
+
type='OptimWrapper',
|
| 22 |
+
optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001))
|
| 23 |
+
|
| 24 |
+
# Default setting for scaling LR automatically
|
| 25 |
+
# - `enable` means enable scaling LR automatically
|
| 26 |
+
# or not by default.
|
| 27 |
+
# - `base_batch_size` = (8 GPUs) x (2 samples per GPU).
|
| 28 |
+
auto_scale_lr = dict(enable=False, base_batch_size=16)
|
grounding-dino/mmdetection/configs/_base_/schedules/schedule_2x.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# training schedule for 2x
|
| 2 |
+
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=24, val_interval=1)
|
| 3 |
+
val_cfg = dict(type='ValLoop')
|
| 4 |
+
test_cfg = dict(type='TestLoop')
|
| 5 |
+
|
| 6 |
+
# learning rate
|
| 7 |
+
param_scheduler = [
|
| 8 |
+
dict(
|
| 9 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
|
| 10 |
+
dict(
|
| 11 |
+
type='MultiStepLR',
|
| 12 |
+
begin=0,
|
| 13 |
+
end=24,
|
| 14 |
+
by_epoch=True,
|
| 15 |
+
milestones=[16, 22],
|
| 16 |
+
gamma=0.1)
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
# optimizer
|
| 20 |
+
optim_wrapper = dict(
|
| 21 |
+
type='OptimWrapper',
|
| 22 |
+
optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001))
|
| 23 |
+
|
| 24 |
+
# Default setting for scaling LR automatically
|
| 25 |
+
# - `enable` means enable scaling LR automatically
|
| 26 |
+
# or not by default.
|
| 27 |
+
# - `base_batch_size` = (8 GPUs) x (2 samples per GPU).
|
| 28 |
+
auto_scale_lr = dict(enable=False, base_batch_size=16)
|
grounding-dino/mmdetection/configs/sort/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Simple online and realtime tracking
|
| 2 |
+
|
| 3 |
+
## Abstract
|
| 4 |
+
|
| 5 |
+
<!-- [ABSTRACT] -->
|
| 6 |
+
|
| 7 |
+
This paper explores a pragmatic approach to multiple object tracking where the main focus is to associate objects efficiently for online and realtime applications. To this end, detection quality is identified as a key factor influencing tracking performance, where changing the detector can improve tracking by up to 18.9%. Despite only using a rudimentary combination of familiar techniques such as the Kalman Filter and Hungarian algorithm for the tracking components, this approach achieves an accuracy comparable to state-of-the-art online trackers. Furthermore, due to the simplicity of our tracking method, the tracker updates at a rate of 260 Hz which is over 20x faster than other state-of-the-art trackers.
|
| 8 |
+
|
| 9 |
+
<!-- [IMAGE] -->
|
| 10 |
+
|
| 11 |
+
<div align="center">
|
| 12 |
+
<img src="https://user-images.githubusercontent.com/99722489/176848133-d6621813-7b8f-4b25-96cd-2fbcc87983ce.png"/>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
## Citation
|
| 16 |
+
|
| 17 |
+
<!-- [ALGORITHM] -->
|
| 18 |
+
|
| 19 |
+
```latex
|
| 20 |
+
@inproceedings{bewley2016simple,
|
| 21 |
+
title={Simple online and realtime tracking},
|
| 22 |
+
author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
|
| 23 |
+
booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
|
| 24 |
+
pages={3464--3468},
|
| 25 |
+
year={2016},
|
| 26 |
+
organization={IEEE}
|
| 27 |
+
}
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Results and models on MOT17
|
| 31 |
+
|
| 32 |
+
| Method | Detector | ReID | Train Set | Test Set | Public | Inf time (fps) | HOTA | MOTA | IDF1 | FP | FN | IDSw. | Config | Download |
|
| 33 |
+
| :----: | :----------------: | :--: | :--------: | :------: | :----: | :------------: | :--: | :--: | :--: | :---: | :---: | :---: | :----------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------: |
|
| 34 |
+
| SORT | R50-FasterRCNN-FPN | - | half-train | half-val | N | 18.6 | 52.0 | 62.0 | 57.8 | 15150 | 40410 | 5847 | [config](sort_faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py) | [detector](https://download.openmmlab.com/mmtracking/mot/faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-half-64ee2ed4.pth) |
|
| 35 |
+
|
| 36 |
+
## Get started
|
| 37 |
+
|
| 38 |
+
### 1. Development Environment Setup
|
| 39 |
+
|
| 40 |
+
Tracking Development Environment Setup can refer to this [document](../../docs/en/get_started.md).
|
| 41 |
+
|
| 42 |
+
### 2. Dataset Prepare
|
| 43 |
+
|
| 44 |
+
Tracking Dataset Prepare can refer to this [document](../../docs/en/user_guides/tracking_dataset_prepare.md).
|
| 45 |
+
|
| 46 |
+
### 3. Training
|
| 47 |
+
|
| 48 |
+
We implement SORT with independent detector models.
|
| 49 |
+
Note that, due to the influence of parameters such as learning rate in default configuration file,
|
| 50 |
+
we recommend using 8 GPUs for training in order to reproduce accuracy.
|
| 51 |
+
|
| 52 |
+
You can train the detector as follows.
|
| 53 |
+
|
| 54 |
+
```shell script
|
| 55 |
+
# Training Faster R-CNN on mot17-half-train dataset with following command.
|
| 56 |
+
# The number after config file represents the number of GPUs used. Here we use 8 GPUs.
|
| 57 |
+
bash tools/dist_train.sh configs/sort/faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py 8
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
If you want to know about more detailed usage of `train.py/dist_train.sh/slurm_train.sh`,
|
| 61 |
+
please refer to this [document](../../docs/en/user_guides/tracking_train_test.md).
|
| 62 |
+
|
| 63 |
+
### 4. Testing and evaluation
|
| 64 |
+
|
| 65 |
+
### 4.1 Example on MOTxx-halfval dataset
|
| 66 |
+
|
| 67 |
+
**4.1.1 use separate trained detector model to evaluating and testing**\*
|
| 68 |
+
|
| 69 |
+
```shell script
|
| 70 |
+
# Example 1: Test on motXX-half-val set.
|
| 71 |
+
# The number after config file represents the number of GPUs used. Here we use 8 GPUs.
|
| 72 |
+
bash tools/dist_test_tracking.sh configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py 8 --detector ${DETECTOR_CHECKPOINT_PATH}
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
**4.1.2 use video_baesd to evaluating and testing**
|
| 76 |
+
|
| 77 |
+
we also provide two_ways(img_based or video_based) to evaluating and testing.
|
| 78 |
+
if you want to use video_based to evaluating and testing, you can modify config as follows
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
val_dataloader = dict(
|
| 82 |
+
sampler=dict(type='DefaultSampler', shuffle=False, round_up=False))
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
### 4.2 Example on MOTxx-test dataset
|
| 86 |
+
|
| 87 |
+
If you want to get the results of the [MOT Challenge](https://motchallenge.net/) test set,
|
| 88 |
+
please use the following command to generate result files that can be used for submission.
|
| 89 |
+
It will be stored in `./mot_17_test_res`, you can modify the saved path in `test_evaluator` of the config.
|
| 90 |
+
|
| 91 |
+
```shell script
|
| 92 |
+
# Example 2: Test on motxx-test set
|
| 93 |
+
# The number after config file represents the number of GPUs used
|
| 94 |
+
bash tools/dist_test_tracking.sh configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17train_test-mot17test.py 8 --detector ${DETECTOR_CHECKPOINT_PATH}
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
If you want to know about more detailed usage of `test_tracking.py/dist_test_tracking.sh/slurm_test_tracking.sh`,
|
| 98 |
+
please refer to this [document](../../docs/en/user_guides/tracking_train_test.md).
|
| 99 |
+
|
| 100 |
+
### 5.Inference
|
| 101 |
+
|
| 102 |
+
Use a single GPU to predict a video and save it as a video.
|
| 103 |
+
|
| 104 |
+
```shell
|
| 105 |
+
python demo/mot_demo.py demo/demo_mot.mp4 configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py --detector ${DETECTOR_CHECKPOINT_PATH} --out mot.mp4
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
If you want to know about more detailed usage of `mot_demo.py`, please refer to this [document](../../docs/en/user_guides/tracking_inference.md).
|
grounding-dino/mmdetection/configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/faster-rcnn_r50_fpn.py',
|
| 3 |
+
'../_base_/datasets/mot_challenge.py', '../_base_/default_runtime.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
default_hooks = dict(
|
| 7 |
+
logger=dict(type='LoggerHook', interval=1),
|
| 8 |
+
visualization=dict(type='TrackVisualizationHook', draw=False))
|
| 9 |
+
|
| 10 |
+
vis_backends = [dict(type='LocalVisBackend')]
|
| 11 |
+
visualizer = dict(
|
| 12 |
+
type='TrackLocalVisualizer', vis_backends=vis_backends, name='visualizer')
|
| 13 |
+
|
| 14 |
+
# custom hooks
|
| 15 |
+
custom_hooks = [
|
| 16 |
+
# Synchronize model buffers such as running_mean and running_var in BN
|
| 17 |
+
# at the end of each epoch
|
| 18 |
+
dict(type='SyncBuffersHook')
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
detector = _base_.model
|
| 22 |
+
detector.pop('data_preprocessor')
|
| 23 |
+
detector.rpn_head.bbox_coder.update(dict(clip_border=False))
|
| 24 |
+
detector.roi_head.bbox_head.update(dict(num_classes=1))
|
| 25 |
+
detector.roi_head.bbox_head.bbox_coder.update(dict(clip_border=False))
|
| 26 |
+
detector['init_cfg'] = dict(
|
| 27 |
+
type='Pretrained',
|
| 28 |
+
checkpoint= # noqa: E251
|
| 29 |
+
'https://download.openmmlab.com/mmtracking/mot/'
|
| 30 |
+
'faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-half-64ee2ed4.pth') # noqa: E501
|
| 31 |
+
del _base_.model
|
| 32 |
+
|
| 33 |
+
model = dict(
|
| 34 |
+
type='DeepSORT',
|
| 35 |
+
data_preprocessor=dict(
|
| 36 |
+
type='TrackDataPreprocessor',
|
| 37 |
+
mean=[123.675, 116.28, 103.53],
|
| 38 |
+
std=[58.395, 57.12, 57.375],
|
| 39 |
+
bgr_to_rgb=True,
|
| 40 |
+
rgb_to_bgr=False,
|
| 41 |
+
pad_size_divisor=32),
|
| 42 |
+
detector=detector,
|
| 43 |
+
tracker=dict(
|
| 44 |
+
type='SORTTracker',
|
| 45 |
+
motion=dict(type='KalmanFilter', center_only=False),
|
| 46 |
+
obj_score_thr=0.5,
|
| 47 |
+
match_iou_thr=0.5,
|
| 48 |
+
reid=None))
|
| 49 |
+
|
| 50 |
+
train_dataloader = None
|
| 51 |
+
|
| 52 |
+
train_cfg = None
|
| 53 |
+
val_cfg = dict(type='ValLoop')
|
| 54 |
+
test_cfg = dict(type='TestLoop')
|
grounding-dino/mmdetection/configs/sort/sort_faster-rcnn_r50_fpn_8xb2-4e_mot17train_test-mot17test.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'./sort_faster-rcnn_r50_fpn_8xb2-4e_mot17halftrain'
|
| 3 |
+
'_test-mot17halfval.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
# dataloader
|
| 7 |
+
val_dataloader = dict(
|
| 8 |
+
dataset=dict(ann_file='annotations/train_cocoformat.json'))
|
| 9 |
+
test_dataloader = dict(
|
| 10 |
+
dataset=dict(
|
| 11 |
+
ann_file='annotations/test_cocoformat.json',
|
| 12 |
+
data_prefix=dict(img_path='test')))
|
| 13 |
+
|
| 14 |
+
# evaluator
|
| 15 |
+
test_evaluator = dict(format_only=True, outfile_prefix='./mot_17_test_res')
|
grounding-dino/mmdetection/configs/sparse_rcnn/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Sparse R-CNN
|
| 2 |
+
|
| 3 |
+
> [Sparse R-CNN: End-to-End Object Detection with Learnable Proposals](https://arxiv.org/abs/2011.12450)
|
| 4 |
+
|
| 5 |
+
<!-- [ALGORITHM] -->
|
| 6 |
+
|
| 7 |
+
## Abstract
|
| 8 |
+
|
| 9 |
+
We present Sparse R-CNN, a purely sparse method for object detection in images. Existing works on object detection heavily rely on dense object candidates, such as k anchor boxes pre-defined on all grids of image feature map of size H×W. In our method, however, a fixed sparse set of learned object proposals, total length of N, are provided to object recognition head to perform classification and location. By eliminating HWk (up to hundreds of thousands) hand-designed object candidates to N (e.g. 100) learnable proposals, Sparse R-CNN completely avoids all efforts related to object candidates design and many-to-one label assignment. More importantly, final predictions are directly output without non-maximum suppression post-procedure. Sparse R-CNN demonstrates accuracy, run-time and training convergence performance on par with the well-established detector baselines on the challenging COCO dataset, e.g., achieving 45.0 AP in standard 3× training schedule and running at 22 fps using ResNet-50 FPN model. We hope our work could inspire re-thinking the convention of dense prior in object detectors.
|
| 10 |
+
|
| 11 |
+
<div align=center>
|
| 12 |
+
<img src="https://user-images.githubusercontent.com/40661020/143998489-8a5a687d-ceec-4590-8347-708e427e7dfe.png" height="300"/>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
## Results and Models
|
| 16 |
+
|
| 17 |
+
| Model | Backbone | Style | Lr schd | Number of Proposals | Multi-Scale | RandomCrop | box AP | Config | Download |
|
| 18 |
+
| :----------: | :-------: | :-----: | :-----: | :-----------------: | :---------: | :--------: | :----: | :-----------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 19 |
+
| Sparse R-CNN | R-50-FPN | pytorch | 1x | 100 | False | False | 37.9 | [config](./sparse-rcnn_r50_fpn_1x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_1x_coco/sparse_rcnn_r50_fpn_1x_coco_20201222_214453-dc79b137.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_1x_coco/sparse_rcnn_r50_fpn_1x_coco_20201222_214453-dc79b137.log.json) |
|
| 20 |
+
| Sparse R-CNN | R-50-FPN | pytorch | 3x | 100 | True | False | 42.8 | [config](./sparse-rcnn_r50_fpn_ms-480-800-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_mstrain_480-800_3x_coco/sparse_rcnn_r50_fpn_mstrain_480-800_3x_coco_20201218_154234-7bc5c054.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_mstrain_480-800_3x_coco/sparse_rcnn_r50_fpn_mstrain_480-800_3x_coco_20201218_154234-7bc5c054.log.json) |
|
| 21 |
+
| Sparse R-CNN | R-50-FPN | pytorch | 3x | 300 | True | True | 45.0 | [config](./sparse-rcnn_r50_fpn_300-proposals_crop-ms-480-800-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_300_proposals_crop_mstrain_480-800_3x_coco/sparse_rcnn_r50_fpn_300_proposals_crop_mstrain_480-800_3x_coco_20201223_024605-9fe92701.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_300_proposals_crop_mstrain_480-800_3x_coco/sparse_rcnn_r50_fpn_300_proposals_crop_mstrain_480-800_3x_coco_20201223_024605-9fe92701.log.json) |
|
| 22 |
+
| Sparse R-CNN | R-101-FPN | pytorch | 3x | 100 | True | False | 44.2 | [config](./sparse-rcnn_r101_fpn_ms-480-800-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r101_fpn_mstrain_480-800_3x_coco/sparse_rcnn_r101_fpn_mstrain_480-800_3x_coco_20201223_121552-6c46c9d6.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r101_fpn_mstrain_480-800_3x_coco/sparse_rcnn_r101_fpn_mstrain_480-800_3x_coco_20201223_121552-6c46c9d6.log.json) |
|
| 23 |
+
| Sparse R-CNN | R-101-FPN | pytorch | 3x | 300 | True | True | 46.2 | [config](./sparse-rcnn_r101_fpn_300-proposals_crop-ms-480-800-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r101_fpn_300_proposals_crop_mstrain_480-800_3x_coco/sparse_rcnn_r101_fpn_300_proposals_crop_mstrain_480-800_3x_coco_20201223_023452-c23c3564.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r101_fpn_300_proposals_crop_mstrain_480-800_3x_coco/sparse_rcnn_r101_fpn_300_proposals_crop_mstrain_480-800_3x_coco_20201223_023452-c23c3564.log.json) |
|
| 24 |
+
|
| 25 |
+
### Notes
|
| 26 |
+
|
| 27 |
+
We observe about 0.3 AP noise especially when using ResNet-101 as the backbone.
|
| 28 |
+
|
| 29 |
+
## Citation
|
| 30 |
+
|
| 31 |
+
```latex
|
| 32 |
+
@article{peize2020sparse,
|
| 33 |
+
title = {{SparseR-CNN}: End-to-End Object Detection with Learnable Proposals},
|
| 34 |
+
author = {Peize Sun and Rufeng Zhang and Yi Jiang and Tao Kong and Chenfeng Xu and Wei Zhan and Masayoshi Tomizuka and Lei Li and Zehuan Yuan and Changhu Wang and Ping Luo},
|
| 35 |
+
journal = {arXiv preprint arXiv:2011.12450},
|
| 36 |
+
year = {2020}
|
| 37 |
+
}
|
| 38 |
+
```
|
grounding-dino/mmdetection/configs/sparse_rcnn/metafile.yml
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Collections:
|
| 2 |
+
- Name: Sparse R-CNN
|
| 3 |
+
Metadata:
|
| 4 |
+
Training Data: COCO
|
| 5 |
+
Training Techniques:
|
| 6 |
+
- SGD with Momentum
|
| 7 |
+
- Weight Decay
|
| 8 |
+
Training Resources: 8x V100 GPUs
|
| 9 |
+
Architecture:
|
| 10 |
+
- FPN
|
| 11 |
+
- ResNet
|
| 12 |
+
- Sparse R-CNN
|
| 13 |
+
Paper:
|
| 14 |
+
URL: https://arxiv.org/abs/2011.12450
|
| 15 |
+
Title: 'Sparse R-CNN: End-to-End Object Detection with Learnable Proposals'
|
| 16 |
+
README: configs/sparse_rcnn/README.md
|
| 17 |
+
Code:
|
| 18 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.9.0/mmdet/models/detectors/sparse_rcnn.py#L6
|
| 19 |
+
Version: v2.9.0
|
| 20 |
+
|
| 21 |
+
Models:
|
| 22 |
+
- Name: sparse-rcnn_r50_fpn_1x_coco
|
| 23 |
+
In Collection: Sparse R-CNN
|
| 24 |
+
Config: configs/sparse_rcnn/sparse-rcnn_r50_fpn_1x_coco.py
|
| 25 |
+
Metadata:
|
| 26 |
+
Epochs: 12
|
| 27 |
+
Results:
|
| 28 |
+
- Task: Object Detection
|
| 29 |
+
Dataset: COCO
|
| 30 |
+
Metrics:
|
| 31 |
+
box AP: 37.9
|
| 32 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_1x_coco/sparse_rcnn_r50_fpn_1x_coco_20201222_214453-dc79b137.pth
|
| 33 |
+
|
| 34 |
+
- Name: sparse-rcnn_r50_fpn_ms-480-800-3x_coco
|
| 35 |
+
In Collection: Sparse R-CNN
|
| 36 |
+
Config: configs/sparse_rcnn/sparse-rcnn_r50_fpn_ms-480-800-3x_coco.py
|
| 37 |
+
Metadata:
|
| 38 |
+
Epochs: 36
|
| 39 |
+
Results:
|
| 40 |
+
- Task: Object Detection
|
| 41 |
+
Dataset: COCO
|
| 42 |
+
Metrics:
|
| 43 |
+
box AP: 42.8
|
| 44 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_mstrain_480-800_3x_coco/sparse_rcnn_r50_fpn_mstrain_480-800_3x_coco_20201218_154234-7bc5c054.pth
|
| 45 |
+
|
| 46 |
+
- Name: sparse-rcnn_r50_fpn_300-proposals_crop-ms-480-800-3x_coco
|
| 47 |
+
In Collection: Sparse R-CNN
|
| 48 |
+
Config: configs/sparse_rcnn/sparse-rcnn_r50_fpn_300-proposals_crop-ms-480-800-3x_coco.py
|
| 49 |
+
Metadata:
|
| 50 |
+
Epochs: 36
|
| 51 |
+
Results:
|
| 52 |
+
- Task: Object Detection
|
| 53 |
+
Dataset: COCO
|
| 54 |
+
Metrics:
|
| 55 |
+
box AP: 45.0
|
| 56 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r50_fpn_300_proposals_crop_mstrain_480-800_3x_coco/sparse_rcnn_r50_fpn_300_proposals_crop_mstrain_480-800_3x_coco_20201223_024605-9fe92701.pth
|
| 57 |
+
|
| 58 |
+
- Name: sparse-rcnn_r101_fpn_ms-480-800-3x_coco
|
| 59 |
+
In Collection: Sparse R-CNN
|
| 60 |
+
Config: configs/sparse_rcnn/sparse-rcnn_r101_fpn_ms-480-800-3x_coco.py
|
| 61 |
+
Metadata:
|
| 62 |
+
Epochs: 36
|
| 63 |
+
Results:
|
| 64 |
+
- Task: Object Detection
|
| 65 |
+
Dataset: COCO
|
| 66 |
+
Metrics:
|
| 67 |
+
box AP: 44.2
|
| 68 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r101_fpn_mstrain_480-800_3x_coco/sparse_rcnn_r101_fpn_mstrain_480-800_3x_coco_20201223_121552-6c46c9d6.pth
|
| 69 |
+
|
| 70 |
+
- Name: sparse-rcnn_r101_fpn_300-proposals_crop-ms-480-800-3x_coco
|
| 71 |
+
In Collection: Sparse R-CNN
|
| 72 |
+
Config: configs/sparse_rcnn/sparse-rcnn_r101_fpn_300-proposals_crop-ms-480-800-3x_coco.py
|
| 73 |
+
Metadata:
|
| 74 |
+
Epochs: 36
|
| 75 |
+
Results:
|
| 76 |
+
- Task: Object Detection
|
| 77 |
+
Dataset: COCO
|
| 78 |
+
Metrics:
|
| 79 |
+
box AP: 46.2
|
| 80 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/sparse_rcnn/sparse_rcnn_r101_fpn_300_proposals_crop_mstrain_480-800_3x_coco/sparse_rcnn_r101_fpn_300_proposals_crop_mstrain_480-800_3x_coco_20201223_023452-c23c3564.pth
|
grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r101_fpn_300-proposals_crop-ms-480-800-3x_coco.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './sparse-rcnn_r50_fpn_300-proposals_crop-ms-480-800-3x_coco.py'
|
| 2 |
+
|
| 3 |
+
model = dict(
|
| 4 |
+
backbone=dict(
|
| 5 |
+
depth=101,
|
| 6 |
+
init_cfg=dict(type='Pretrained',
|
| 7 |
+
checkpoint='torchvision://resnet101')))
|
grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r101_fpn_ms-480-800-3x_coco.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './sparse-rcnn_r50_fpn_ms-480-800-3x_coco.py'
|
| 2 |
+
|
| 3 |
+
model = dict(
|
| 4 |
+
backbone=dict(
|
| 5 |
+
depth=101,
|
| 6 |
+
init_cfg=dict(type='Pretrained',
|
| 7 |
+
checkpoint='torchvision://resnet101')))
|
grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r50_fpn_1x_coco.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/datasets/coco_detection.py',
|
| 3 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 4 |
+
]
|
| 5 |
+
num_stages = 6
|
| 6 |
+
num_proposals = 100
|
| 7 |
+
model = dict(
|
| 8 |
+
type='SparseRCNN',
|
| 9 |
+
data_preprocessor=dict(
|
| 10 |
+
type='DetDataPreprocessor',
|
| 11 |
+
mean=[123.675, 116.28, 103.53],
|
| 12 |
+
std=[58.395, 57.12, 57.375],
|
| 13 |
+
bgr_to_rgb=True,
|
| 14 |
+
pad_size_divisor=32),
|
| 15 |
+
backbone=dict(
|
| 16 |
+
type='ResNet',
|
| 17 |
+
depth=50,
|
| 18 |
+
num_stages=4,
|
| 19 |
+
out_indices=(0, 1, 2, 3),
|
| 20 |
+
frozen_stages=1,
|
| 21 |
+
norm_cfg=dict(type='BN', requires_grad=True),
|
| 22 |
+
norm_eval=True,
|
| 23 |
+
style='pytorch',
|
| 24 |
+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
|
| 25 |
+
neck=dict(
|
| 26 |
+
type='FPN',
|
| 27 |
+
in_channels=[256, 512, 1024, 2048],
|
| 28 |
+
out_channels=256,
|
| 29 |
+
start_level=0,
|
| 30 |
+
add_extra_convs='on_input',
|
| 31 |
+
num_outs=4),
|
| 32 |
+
rpn_head=dict(
|
| 33 |
+
type='EmbeddingRPNHead',
|
| 34 |
+
num_proposals=num_proposals,
|
| 35 |
+
proposal_feature_channel=256),
|
| 36 |
+
roi_head=dict(
|
| 37 |
+
type='SparseRoIHead',
|
| 38 |
+
num_stages=num_stages,
|
| 39 |
+
stage_loss_weights=[1] * num_stages,
|
| 40 |
+
proposal_feature_channel=256,
|
| 41 |
+
bbox_roi_extractor=dict(
|
| 42 |
+
type='SingleRoIExtractor',
|
| 43 |
+
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=2),
|
| 44 |
+
out_channels=256,
|
| 45 |
+
featmap_strides=[4, 8, 16, 32]),
|
| 46 |
+
bbox_head=[
|
| 47 |
+
dict(
|
| 48 |
+
type='DIIHead',
|
| 49 |
+
num_classes=80,
|
| 50 |
+
num_ffn_fcs=2,
|
| 51 |
+
num_heads=8,
|
| 52 |
+
num_cls_fcs=1,
|
| 53 |
+
num_reg_fcs=3,
|
| 54 |
+
feedforward_channels=2048,
|
| 55 |
+
in_channels=256,
|
| 56 |
+
dropout=0.0,
|
| 57 |
+
ffn_act_cfg=dict(type='ReLU', inplace=True),
|
| 58 |
+
dynamic_conv_cfg=dict(
|
| 59 |
+
type='DynamicConv',
|
| 60 |
+
in_channels=256,
|
| 61 |
+
feat_channels=64,
|
| 62 |
+
out_channels=256,
|
| 63 |
+
input_feat_shape=7,
|
| 64 |
+
act_cfg=dict(type='ReLU', inplace=True),
|
| 65 |
+
norm_cfg=dict(type='LN')),
|
| 66 |
+
loss_bbox=dict(type='L1Loss', loss_weight=5.0),
|
| 67 |
+
loss_iou=dict(type='GIoULoss', loss_weight=2.0),
|
| 68 |
+
loss_cls=dict(
|
| 69 |
+
type='FocalLoss',
|
| 70 |
+
use_sigmoid=True,
|
| 71 |
+
gamma=2.0,
|
| 72 |
+
alpha=0.25,
|
| 73 |
+
loss_weight=2.0),
|
| 74 |
+
bbox_coder=dict(
|
| 75 |
+
type='DeltaXYWHBBoxCoder',
|
| 76 |
+
clip_border=False,
|
| 77 |
+
target_means=[0., 0., 0., 0.],
|
| 78 |
+
target_stds=[0.5, 0.5, 1., 1.])) for _ in range(num_stages)
|
| 79 |
+
]),
|
| 80 |
+
# training and testing settings
|
| 81 |
+
train_cfg=dict(
|
| 82 |
+
rpn=None,
|
| 83 |
+
rcnn=[
|
| 84 |
+
dict(
|
| 85 |
+
assigner=dict(
|
| 86 |
+
type='HungarianAssigner',
|
| 87 |
+
match_costs=[
|
| 88 |
+
dict(type='FocalLossCost', weight=2.0),
|
| 89 |
+
dict(type='BBoxL1Cost', weight=5.0, box_format='xyxy'),
|
| 90 |
+
dict(type='IoUCost', iou_mode='giou', weight=2.0)
|
| 91 |
+
]),
|
| 92 |
+
sampler=dict(type='PseudoSampler'),
|
| 93 |
+
pos_weight=1) for _ in range(num_stages)
|
| 94 |
+
]),
|
| 95 |
+
test_cfg=dict(rpn=None, rcnn=dict(max_per_img=num_proposals)))
|
| 96 |
+
|
| 97 |
+
# optimizer
|
| 98 |
+
optim_wrapper = dict(
|
| 99 |
+
optimizer=dict(
|
| 100 |
+
_delete_=True, type='AdamW', lr=0.000025, weight_decay=0.0001),
|
| 101 |
+
clip_grad=dict(max_norm=1, norm_type=2))
|
grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r50_fpn_300-proposals_crop-ms-480-800-3x_coco.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './sparse-rcnn_r50_fpn_ms-480-800-3x_coco.py'
|
| 2 |
+
num_proposals = 300
|
| 3 |
+
model = dict(
|
| 4 |
+
rpn_head=dict(num_proposals=num_proposals),
|
| 5 |
+
test_cfg=dict(
|
| 6 |
+
_delete_=True, rpn=None, rcnn=dict(max_per_img=num_proposals)))
|
| 7 |
+
|
| 8 |
+
# augmentation strategy originates from DETR.
|
| 9 |
+
train_pipeline = [
|
| 10 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 11 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 12 |
+
dict(type='RandomFlip', prob=0.5),
|
| 13 |
+
dict(
|
| 14 |
+
type='RandomChoice',
|
| 15 |
+
transforms=[[
|
| 16 |
+
dict(
|
| 17 |
+
type='RandomChoiceResize',
|
| 18 |
+
scales=[(480, 1333), (512, 1333), (544, 1333), (576, 1333),
|
| 19 |
+
(608, 1333), (640, 1333), (672, 1333), (704, 1333),
|
| 20 |
+
(736, 1333), (768, 1333), (800, 1333)],
|
| 21 |
+
keep_ratio=True)
|
| 22 |
+
],
|
| 23 |
+
[
|
| 24 |
+
dict(
|
| 25 |
+
type='RandomChoiceResize',
|
| 26 |
+
scales=[(400, 1333), (500, 1333), (600, 1333)],
|
| 27 |
+
keep_ratio=True),
|
| 28 |
+
dict(
|
| 29 |
+
type='RandomCrop',
|
| 30 |
+
crop_type='absolute_range',
|
| 31 |
+
crop_size=(384, 600),
|
| 32 |
+
allow_negative_crop=True),
|
| 33 |
+
dict(
|
| 34 |
+
type='RandomChoiceResize',
|
| 35 |
+
scales=[(480, 1333), (512, 1333), (544, 1333),
|
| 36 |
+
(576, 1333), (608, 1333), (640, 1333),
|
| 37 |
+
(672, 1333), (704, 1333), (736, 1333),
|
| 38 |
+
(768, 1333), (800, 1333)],
|
| 39 |
+
keep_ratio=True)
|
| 40 |
+
]]),
|
| 41 |
+
dict(type='PackDetInputs')
|
| 42 |
+
]
|
| 43 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
grounding-dino/mmdetection/configs/sparse_rcnn/sparse-rcnn_r50_fpn_ms-480-800-3x_coco.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './sparse-rcnn_r50_fpn_1x_coco.py'
|
| 2 |
+
|
| 3 |
+
train_pipeline = [
|
| 4 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 5 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 6 |
+
dict(
|
| 7 |
+
type='RandomChoiceResize',
|
| 8 |
+
scales=[(480, 1333), (512, 1333), (544, 1333), (576, 1333),
|
| 9 |
+
(608, 1333), (640, 1333), (672, 1333), (704, 1333),
|
| 10 |
+
(736, 1333), (768, 1333), (800, 1333)],
|
| 11 |
+
keep_ratio=True),
|
| 12 |
+
dict(type='RandomFlip', prob=0.5),
|
| 13 |
+
dict(type='PackDetInputs')
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
| 17 |
+
|
| 18 |
+
# learning policy
|
| 19 |
+
max_epochs = 36
|
| 20 |
+
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=max_epochs)
|
| 21 |
+
|
| 22 |
+
param_scheduler = [
|
| 23 |
+
dict(
|
| 24 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
|
| 25 |
+
dict(
|
| 26 |
+
type='MultiStepLR',
|
| 27 |
+
begin=0,
|
| 28 |
+
end=max_epochs,
|
| 29 |
+
by_epoch=True,
|
| 30 |
+
milestones=[27, 33],
|
| 31 |
+
gamma=0.1)
|
| 32 |
+
]
|
grounding-dino/mmdetection/configs/ssd/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SSD
|
| 2 |
+
|
| 3 |
+
> [SSD: Single Shot MultiBox Detector](https://arxiv.org/abs/1512.02325)
|
| 4 |
+
|
| 5 |
+
<!-- [ALGORITHM] -->
|
| 6 |
+
|
| 7 |
+
## Abstract
|
| 8 |
+
|
| 9 |
+
We present a method for detecting objects in images using a single deep neural network. Our approach, named SSD, discretizes the output space of bounding boxes into a set of default boxes over different aspect ratios and scales per feature map location. At prediction time, the network generates scores for the presence of each object category in each default box and produces adjustments to the box to better match the object shape. Additionally, the network combines predictions from multiple feature maps with different resolutions to naturally handle objects of various sizes. Our SSD model is simple relative to methods that require object proposals because it completely eliminates proposal generation and subsequent pixel or feature resampling stage and encapsulates all computation in a single network. This makes SSD easy to train and straightforward to integrate into systems that require a detection component. Experimental results on the PASCAL VOC, MS COCO, and ILSVRC datasets confirm that SSD has comparable accuracy to methods that utilize an additional object proposal step and is much faster, while providing a unified framework for both training and inference. Compared to other single stage methods, SSD has much better accuracy, even with a smaller input image size. For 300×300 input, SSD achieves 72.1% mAP on VOC2007 test at 58 FPS on a Nvidia Titan X and for 500×500 input, SSD achieves 75.1% mAP, outperforming a comparable state of the art Faster R-CNN model.
|
| 10 |
+
|
| 11 |
+
<div align=center>
|
| 12 |
+
<img src="https://user-images.githubusercontent.com/40661020/143998553-4e12f681-6025-46b4-8410-9e2e1e53a8ec.png"/>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
## Results and models of SSD
|
| 16 |
+
|
| 17 |
+
| Backbone | Size | Style | Lr schd | Mem (GB) | Inf time (fps) | box AP | Config | Download |
|
| 18 |
+
| :------: | :--: | :---: | :-----: | :------: | :------------: | :----: | :------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 19 |
+
| VGG16 | 300 | caffe | 120e | 9.9 | 43.7 | 25.5 | [config](./ssd300_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd300_coco/ssd300_coco_20210803_015428-d231a06e.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd300_coco/ssd300_coco_20210803_015428.log.json) |
|
| 20 |
+
| VGG16 | 512 | caffe | 120e | 19.4 | 30.7 | 29.5 | [config](./ssd512_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd512_coco/ssd512_coco_20210803_022849-0a47a1ca.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd512_coco/ssd512_coco_20210803_022849.log.json) |
|
| 21 |
+
|
| 22 |
+
## Results and models of SSD-Lite
|
| 23 |
+
|
| 24 |
+
| Backbone | Size | Training from scratch | Lr schd | Mem (GB) | Inf time (fps) | box AP | Config | Download |
|
| 25 |
+
| :---------: | :--: | :-------------------: | :-----: | :------: | :------------: | :----: | :--------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 26 |
+
| MobileNetV2 | 320 | yes | 600e | 4.0 | 69.9 | 21.3 | [config](./ssdlite_mobilenetv2-scratch_8xb24-600e_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/ssd/ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627-974d9307.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/ssd/ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627.log.json) |
|
| 27 |
+
|
| 28 |
+
## Notice
|
| 29 |
+
|
| 30 |
+
### Compatibility
|
| 31 |
+
|
| 32 |
+
In v2.14.0, [PR5291](https://github.com/open-mmlab/mmdetection/pull/5291) refactored SSD neck and head for more
|
| 33 |
+
flexible usage. If users want to use the SSD checkpoint trained in the older versions, we provide a scripts
|
| 34 |
+
`tools/model_converters/upgrade_ssd_version.py` to convert the model weights.
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
python tools/model_converters/upgrade_ssd_version.py ${OLD_MODEL_PATH} ${NEW_MODEL_PATH}
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
- OLD_MODEL_PATH: the path to load the old version SSD model.
|
| 42 |
+
- NEW_MODEL_PATH: the path to save the converted model weights.
|
| 43 |
+
|
| 44 |
+
### SSD-Lite training settings
|
| 45 |
+
|
| 46 |
+
There are some differences between our implementation of MobileNetV2 SSD-Lite and the one in [TensorFlow 1.x detection model zoo](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md) .
|
| 47 |
+
|
| 48 |
+
1. Use 320x320 as input size instead of 300x300.
|
| 49 |
+
2. The anchor sizes are different.
|
| 50 |
+
3. The C4 feature map is taken from the last layer of stage 4 instead of the middle of the block.
|
| 51 |
+
4. The model in TensorFlow1.x is trained on coco 2014 and validated on coco minival2014, but we trained and validated the model on coco 2017. The mAP on val2017 is usually a little lower than minival2014 (refer to the results in TensorFlow Object Detection API, e.g., MobileNetV2 SSD gets 22 mAP on minival2014 but 20.2 mAP on val2017).
|
| 52 |
+
|
| 53 |
+
## Citation
|
| 54 |
+
|
| 55 |
+
```latex
|
| 56 |
+
@article{Liu_2016,
|
| 57 |
+
title={SSD: Single Shot MultiBox Detector},
|
| 58 |
+
journal={ECCV},
|
| 59 |
+
author={Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C.},
|
| 60 |
+
year={2016},
|
| 61 |
+
}
|
| 62 |
+
```
|
grounding-dino/mmdetection/configs/ssd/metafile.yml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Collections:
|
| 2 |
+
- Name: SSD
|
| 3 |
+
Metadata:
|
| 4 |
+
Training Data: COCO
|
| 5 |
+
Training Techniques:
|
| 6 |
+
- SGD with Momentum
|
| 7 |
+
- Weight Decay
|
| 8 |
+
Training Resources: 8x V100 GPUs
|
| 9 |
+
Architecture:
|
| 10 |
+
- VGG
|
| 11 |
+
Paper:
|
| 12 |
+
URL: https://arxiv.org/abs/1512.02325
|
| 13 |
+
Title: 'SSD: Single Shot MultiBox Detector'
|
| 14 |
+
README: configs/ssd/README.md
|
| 15 |
+
Code:
|
| 16 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.14.0/mmdet/models/dense_heads/ssd_head.py#L16
|
| 17 |
+
Version: v2.14.0
|
| 18 |
+
|
| 19 |
+
Models:
|
| 20 |
+
- Name: ssd300_coco
|
| 21 |
+
In Collection: SSD
|
| 22 |
+
Config: configs/ssd/ssd300_coco.py
|
| 23 |
+
Metadata:
|
| 24 |
+
Training Memory (GB): 9.9
|
| 25 |
+
inference time (ms/im):
|
| 26 |
+
- value: 22.88
|
| 27 |
+
hardware: V100
|
| 28 |
+
backend: PyTorch
|
| 29 |
+
batch size: 1
|
| 30 |
+
mode: FP32
|
| 31 |
+
resolution: (300, 300)
|
| 32 |
+
Epochs: 120
|
| 33 |
+
Results:
|
| 34 |
+
- Task: Object Detection
|
| 35 |
+
Dataset: COCO
|
| 36 |
+
Metrics:
|
| 37 |
+
box AP: 25.5
|
| 38 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd300_coco/ssd300_coco_20210803_015428-d231a06e.pth
|
| 39 |
+
|
| 40 |
+
- Name: ssd512_coco
|
| 41 |
+
In Collection: SSD
|
| 42 |
+
Config: configs/ssd/ssd512_coco.py
|
| 43 |
+
Metadata:
|
| 44 |
+
Training Memory (GB): 19.4
|
| 45 |
+
inference time (ms/im):
|
| 46 |
+
- value: 32.57
|
| 47 |
+
hardware: V100
|
| 48 |
+
backend: PyTorch
|
| 49 |
+
batch size: 1
|
| 50 |
+
mode: FP32
|
| 51 |
+
resolution: (512, 512)
|
| 52 |
+
Epochs: 120
|
| 53 |
+
Results:
|
| 54 |
+
- Task: Object Detection
|
| 55 |
+
Dataset: COCO
|
| 56 |
+
Metrics:
|
| 57 |
+
box AP: 29.5
|
| 58 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd512_coco/ssd512_coco_20210803_022849-0a47a1ca.pth
|
| 59 |
+
|
| 60 |
+
- Name: ssdlite_mobilenetv2-scratch_8xb24-600e_coco
|
| 61 |
+
In Collection: SSD
|
| 62 |
+
Config: configs/ssd/ssdlite_mobilenetv2-scratch_8xb24-600e_coco.py
|
| 63 |
+
Metadata:
|
| 64 |
+
Training Memory (GB): 4.0
|
| 65 |
+
inference time (ms/im):
|
| 66 |
+
- value: 14.3
|
| 67 |
+
hardware: V100
|
| 68 |
+
backend: PyTorch
|
| 69 |
+
batch size: 1
|
| 70 |
+
mode: FP32
|
| 71 |
+
resolution: (320, 320)
|
| 72 |
+
Epochs: 600
|
| 73 |
+
Results:
|
| 74 |
+
- Task: Object Detection
|
| 75 |
+
Dataset: COCO
|
| 76 |
+
Metrics:
|
| 77 |
+
box AP: 21.3
|
| 78 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/ssd/ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627-974d9307.pth
|
grounding-dino/mmdetection/configs/ssd/ssd300_coco.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/ssd300.py', '../_base_/datasets/coco_detection.py',
|
| 3 |
+
'../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
# dataset settings
|
| 7 |
+
input_size = 300
|
| 8 |
+
train_pipeline = [
|
| 9 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 10 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 11 |
+
dict(
|
| 12 |
+
type='Expand',
|
| 13 |
+
mean={{_base_.model.data_preprocessor.mean}},
|
| 14 |
+
to_rgb={{_base_.model.data_preprocessor.bgr_to_rgb}},
|
| 15 |
+
ratio_range=(1, 4)),
|
| 16 |
+
dict(
|
| 17 |
+
type='MinIoURandomCrop',
|
| 18 |
+
min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
|
| 19 |
+
min_crop_size=0.3),
|
| 20 |
+
dict(type='Resize', scale=(input_size, input_size), keep_ratio=False),
|
| 21 |
+
dict(type='RandomFlip', prob=0.5),
|
| 22 |
+
dict(
|
| 23 |
+
type='PhotoMetricDistortion',
|
| 24 |
+
brightness_delta=32,
|
| 25 |
+
contrast_range=(0.5, 1.5),
|
| 26 |
+
saturation_range=(0.5, 1.5),
|
| 27 |
+
hue_delta=18),
|
| 28 |
+
dict(type='PackDetInputs')
|
| 29 |
+
]
|
| 30 |
+
test_pipeline = [
|
| 31 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 32 |
+
dict(type='Resize', scale=(input_size, input_size), keep_ratio=False),
|
| 33 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 34 |
+
dict(
|
| 35 |
+
type='PackDetInputs',
|
| 36 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
| 37 |
+
'scale_factor'))
|
| 38 |
+
]
|
| 39 |
+
train_dataloader = dict(
|
| 40 |
+
batch_size=8,
|
| 41 |
+
num_workers=2,
|
| 42 |
+
batch_sampler=None,
|
| 43 |
+
dataset=dict(
|
| 44 |
+
_delete_=True,
|
| 45 |
+
type='RepeatDataset',
|
| 46 |
+
times=5,
|
| 47 |
+
dataset=dict(
|
| 48 |
+
type={{_base_.dataset_type}},
|
| 49 |
+
data_root={{_base_.data_root}},
|
| 50 |
+
ann_file='annotations/instances_train2017.json',
|
| 51 |
+
data_prefix=dict(img='train2017/'),
|
| 52 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 53 |
+
pipeline=train_pipeline,
|
| 54 |
+
backend_args={{_base_.backend_args}})))
|
| 55 |
+
val_dataloader = dict(batch_size=8, dataset=dict(pipeline=test_pipeline))
|
| 56 |
+
test_dataloader = val_dataloader
|
| 57 |
+
|
| 58 |
+
# optimizer
|
| 59 |
+
optim_wrapper = dict(
|
| 60 |
+
type='OptimWrapper',
|
| 61 |
+
optimizer=dict(type='SGD', lr=2e-3, momentum=0.9, weight_decay=5e-4))
|
| 62 |
+
|
| 63 |
+
custom_hooks = [
|
| 64 |
+
dict(type='NumClassCheckHook'),
|
| 65 |
+
dict(type='CheckInvalidLossHook', interval=50, priority='VERY_LOW')
|
| 66 |
+
]
|
| 67 |
+
|
| 68 |
+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
|
| 69 |
+
# USER SHOULD NOT CHANGE ITS VALUES.
|
| 70 |
+
# base_batch_size = (8 GPUs) x (8 samples per GPU)
|
| 71 |
+
auto_scale_lr = dict(base_batch_size=64)
|
grounding-dino/mmdetection/configs/ssd/ssd512_coco.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = 'ssd300_coco.py'
|
| 2 |
+
|
| 3 |
+
# model settings
|
| 4 |
+
input_size = 512
|
| 5 |
+
model = dict(
|
| 6 |
+
neck=dict(
|
| 7 |
+
out_channels=(512, 1024, 512, 256, 256, 256, 256),
|
| 8 |
+
level_strides=(2, 2, 2, 2, 1),
|
| 9 |
+
level_paddings=(1, 1, 1, 1, 1),
|
| 10 |
+
last_kernel_size=4),
|
| 11 |
+
bbox_head=dict(
|
| 12 |
+
in_channels=(512, 1024, 512, 256, 256, 256, 256),
|
| 13 |
+
anchor_generator=dict(
|
| 14 |
+
type='SSDAnchorGenerator',
|
| 15 |
+
scale_major=False,
|
| 16 |
+
input_size=input_size,
|
| 17 |
+
basesize_ratio_range=(0.1, 0.9),
|
| 18 |
+
strides=[8, 16, 32, 64, 128, 256, 512],
|
| 19 |
+
ratios=[[2], [2, 3], [2, 3], [2, 3], [2, 3], [2], [2]])))
|
| 20 |
+
|
| 21 |
+
# dataset settings
|
| 22 |
+
train_pipeline = [
|
| 23 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 24 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 25 |
+
dict(
|
| 26 |
+
type='Expand',
|
| 27 |
+
mean={{_base_.model.data_preprocessor.mean}},
|
| 28 |
+
to_rgb={{_base_.model.data_preprocessor.bgr_to_rgb}},
|
| 29 |
+
ratio_range=(1, 4)),
|
| 30 |
+
dict(
|
| 31 |
+
type='MinIoURandomCrop',
|
| 32 |
+
min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
|
| 33 |
+
min_crop_size=0.3),
|
| 34 |
+
dict(type='Resize', scale=(input_size, input_size), keep_ratio=False),
|
| 35 |
+
dict(type='RandomFlip', prob=0.5),
|
| 36 |
+
dict(
|
| 37 |
+
type='PhotoMetricDistortion',
|
| 38 |
+
brightness_delta=32,
|
| 39 |
+
contrast_range=(0.5, 1.5),
|
| 40 |
+
saturation_range=(0.5, 1.5),
|
| 41 |
+
hue_delta=18),
|
| 42 |
+
dict(type='PackDetInputs')
|
| 43 |
+
]
|
| 44 |
+
test_pipeline = [
|
| 45 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 46 |
+
dict(type='Resize', scale=(input_size, input_size), keep_ratio=False),
|
| 47 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 48 |
+
dict(
|
| 49 |
+
type='PackDetInputs',
|
| 50 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
| 51 |
+
'scale_factor'))
|
| 52 |
+
]
|
| 53 |
+
train_dataloader = dict(dataset=dict(dataset=dict(pipeline=train_pipeline)))
|
| 54 |
+
val_dataloader = dict(dataset=dict(pipeline=test_pipeline))
|
| 55 |
+
test_dataloader = val_dataloader
|
| 56 |
+
|
| 57 |
+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
|
| 58 |
+
# USER SHOULD NOT CHANGE ITS VALUES.
|
| 59 |
+
# base_batch_size = (8 GPUs) x (8 samples per GPU)
|
| 60 |
+
auto_scale_lr = dict(base_batch_size=64)
|
grounding-dino/mmdetection/configs/ssd/ssdlite_mobilenetv2-scratch_8xb24-600e_coco.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/datasets/coco_detection.py',
|
| 3 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
# model settings
|
| 7 |
+
data_preprocessor = dict(
|
| 8 |
+
type='DetDataPreprocessor',
|
| 9 |
+
mean=[123.675, 116.28, 103.53],
|
| 10 |
+
std=[58.395, 57.12, 57.375],
|
| 11 |
+
bgr_to_rgb=True,
|
| 12 |
+
pad_size_divisor=1)
|
| 13 |
+
model = dict(
|
| 14 |
+
type='SingleStageDetector',
|
| 15 |
+
data_preprocessor=data_preprocessor,
|
| 16 |
+
backbone=dict(
|
| 17 |
+
type='MobileNetV2',
|
| 18 |
+
out_indices=(4, 7),
|
| 19 |
+
norm_cfg=dict(type='BN', eps=0.001, momentum=0.03),
|
| 20 |
+
init_cfg=dict(type='TruncNormal', layer='Conv2d', std=0.03)),
|
| 21 |
+
neck=dict(
|
| 22 |
+
type='SSDNeck',
|
| 23 |
+
in_channels=(96, 1280),
|
| 24 |
+
out_channels=(96, 1280, 512, 256, 256, 128),
|
| 25 |
+
level_strides=(2, 2, 2, 2),
|
| 26 |
+
level_paddings=(1, 1, 1, 1),
|
| 27 |
+
l2_norm_scale=None,
|
| 28 |
+
use_depthwise=True,
|
| 29 |
+
norm_cfg=dict(type='BN', eps=0.001, momentum=0.03),
|
| 30 |
+
act_cfg=dict(type='ReLU6'),
|
| 31 |
+
init_cfg=dict(type='TruncNormal', layer='Conv2d', std=0.03)),
|
| 32 |
+
bbox_head=dict(
|
| 33 |
+
type='SSDHead',
|
| 34 |
+
in_channels=(96, 1280, 512, 256, 256, 128),
|
| 35 |
+
num_classes=80,
|
| 36 |
+
use_depthwise=True,
|
| 37 |
+
norm_cfg=dict(type='BN', eps=0.001, momentum=0.03),
|
| 38 |
+
act_cfg=dict(type='ReLU6'),
|
| 39 |
+
init_cfg=dict(type='Normal', layer='Conv2d', std=0.001),
|
| 40 |
+
|
| 41 |
+
# set anchor size manually instead of using the predefined
|
| 42 |
+
# SSD300 setting.
|
| 43 |
+
anchor_generator=dict(
|
| 44 |
+
type='SSDAnchorGenerator',
|
| 45 |
+
scale_major=False,
|
| 46 |
+
strides=[16, 32, 64, 107, 160, 320],
|
| 47 |
+
ratios=[[2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3]],
|
| 48 |
+
min_sizes=[48, 100, 150, 202, 253, 304],
|
| 49 |
+
max_sizes=[100, 150, 202, 253, 304, 320]),
|
| 50 |
+
bbox_coder=dict(
|
| 51 |
+
type='DeltaXYWHBBoxCoder',
|
| 52 |
+
target_means=[.0, .0, .0, .0],
|
| 53 |
+
target_stds=[0.1, 0.1, 0.2, 0.2])),
|
| 54 |
+
# model training and testing settings
|
| 55 |
+
train_cfg=dict(
|
| 56 |
+
assigner=dict(
|
| 57 |
+
type='MaxIoUAssigner',
|
| 58 |
+
pos_iou_thr=0.5,
|
| 59 |
+
neg_iou_thr=0.5,
|
| 60 |
+
min_pos_iou=0.,
|
| 61 |
+
ignore_iof_thr=-1,
|
| 62 |
+
gt_max_assign_all=False),
|
| 63 |
+
sampler=dict(type='PseudoSampler'),
|
| 64 |
+
smoothl1_beta=1.,
|
| 65 |
+
allowed_border=-1,
|
| 66 |
+
pos_weight=-1,
|
| 67 |
+
neg_pos_ratio=3,
|
| 68 |
+
debug=False),
|
| 69 |
+
test_cfg=dict(
|
| 70 |
+
nms_pre=1000,
|
| 71 |
+
nms=dict(type='nms', iou_threshold=0.45),
|
| 72 |
+
min_bbox_size=0,
|
| 73 |
+
score_thr=0.02,
|
| 74 |
+
max_per_img=200))
|
| 75 |
+
env_cfg = dict(cudnn_benchmark=True)
|
| 76 |
+
|
| 77 |
+
# dataset settings
|
| 78 |
+
input_size = 320
|
| 79 |
+
train_pipeline = [
|
| 80 |
+
dict(type='LoadImageFromFile'),
|
| 81 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 82 |
+
dict(
|
| 83 |
+
type='Expand',
|
| 84 |
+
mean=data_preprocessor['mean'],
|
| 85 |
+
to_rgb=data_preprocessor['bgr_to_rgb'],
|
| 86 |
+
ratio_range=(1, 4)),
|
| 87 |
+
dict(
|
| 88 |
+
type='MinIoURandomCrop',
|
| 89 |
+
min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
|
| 90 |
+
min_crop_size=0.3),
|
| 91 |
+
dict(type='Resize', scale=(input_size, input_size), keep_ratio=False),
|
| 92 |
+
dict(type='RandomFlip', prob=0.5),
|
| 93 |
+
dict(
|
| 94 |
+
type='PhotoMetricDistortion',
|
| 95 |
+
brightness_delta=32,
|
| 96 |
+
contrast_range=(0.5, 1.5),
|
| 97 |
+
saturation_range=(0.5, 1.5),
|
| 98 |
+
hue_delta=18),
|
| 99 |
+
dict(type='PackDetInputs')
|
| 100 |
+
]
|
| 101 |
+
test_pipeline = [
|
| 102 |
+
dict(type='LoadImageFromFile'),
|
| 103 |
+
dict(type='Resize', scale=(input_size, input_size), keep_ratio=False),
|
| 104 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 105 |
+
dict(
|
| 106 |
+
type='PackDetInputs',
|
| 107 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
| 108 |
+
'scale_factor'))
|
| 109 |
+
]
|
| 110 |
+
train_dataloader = dict(
|
| 111 |
+
batch_size=24,
|
| 112 |
+
num_workers=4,
|
| 113 |
+
batch_sampler=None,
|
| 114 |
+
dataset=dict(
|
| 115 |
+
_delete_=True,
|
| 116 |
+
type='RepeatDataset',
|
| 117 |
+
times=5,
|
| 118 |
+
dataset=dict(
|
| 119 |
+
type={{_base_.dataset_type}},
|
| 120 |
+
data_root={{_base_.data_root}},
|
| 121 |
+
ann_file='annotations/instances_train2017.json',
|
| 122 |
+
data_prefix=dict(img='train2017/'),
|
| 123 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 124 |
+
pipeline=train_pipeline)))
|
| 125 |
+
val_dataloader = dict(batch_size=8, dataset=dict(pipeline=test_pipeline))
|
| 126 |
+
test_dataloader = val_dataloader
|
| 127 |
+
|
| 128 |
+
# training schedule
|
| 129 |
+
max_epochs = 120
|
| 130 |
+
train_cfg = dict(max_epochs=max_epochs, val_interval=5)
|
| 131 |
+
|
| 132 |
+
# learning rate
|
| 133 |
+
param_scheduler = [
|
| 134 |
+
dict(
|
| 135 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
|
| 136 |
+
dict(
|
| 137 |
+
type='CosineAnnealingLR',
|
| 138 |
+
begin=0,
|
| 139 |
+
T_max=max_epochs,
|
| 140 |
+
end=max_epochs,
|
| 141 |
+
by_epoch=True,
|
| 142 |
+
eta_min=0)
|
| 143 |
+
]
|
| 144 |
+
|
| 145 |
+
# optimizer
|
| 146 |
+
optim_wrapper = dict(
|
| 147 |
+
type='OptimWrapper',
|
| 148 |
+
optimizer=dict(type='SGD', lr=0.015, momentum=0.9, weight_decay=4.0e-5))
|
| 149 |
+
|
| 150 |
+
custom_hooks = [
|
| 151 |
+
dict(type='NumClassCheckHook'),
|
| 152 |
+
dict(type='CheckInvalidLossHook', interval=50, priority='VERY_LOW')
|
| 153 |
+
]
|
| 154 |
+
|
| 155 |
+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
|
| 156 |
+
# USER SHOULD NOT CHANGE ITS VALUES.
|
| 157 |
+
# base_batch_size = (8 GPUs) x (24 samples per GPU)
|
| 158 |
+
auto_scale_lr = dict(base_batch_size=192)
|
grounding-dino/mmdetection/configs/strong_baselines/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Strong Baselines
|
| 2 |
+
|
| 3 |
+
<!-- [OTHERS] -->
|
| 4 |
+
|
| 5 |
+
We train Mask R-CNN with large-scale jitter and longer schedule as strong baselines.
|
| 6 |
+
The modifications follow those in [Detectron2](https://github.com/facebookresearch/detectron2/tree/master/configs/new_baselines).
|
| 7 |
+
|
| 8 |
+
## Results and Models
|
| 9 |
+
|
| 10 |
+
| Backbone | Style | Lr schd | Mem (GB) | Inf time (fps) | box AP | mask AP | Config | Download |
|
| 11 |
+
| :------: | :-----: | :-----: | :------: | :------------: | :----: | :-----: | :--------------------------------------------------------------------------------: | :----------------------: |
|
| 12 |
+
| R-50-FPN | pytorch | 50e | | | | | [config](./mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-50e_coco.py) | [model](<>) \| [log](<>) |
|
| 13 |
+
| R-50-FPN | pytorch | 100e | | | | | [config](./mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py) | [model](<>) \| [log](<>) |
|
| 14 |
+
| R-50-FPN | caffe | 100e | | | 44.7 | 40.4 | [config](./mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py) | [model](<>) \| [log](<>) |
|
| 15 |
+
| R-50-FPN | caffe | 400e | | | | | [config](./mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-400e_coco.py) | [model](<>) \| [log](<>) |
|
| 16 |
+
|
| 17 |
+
## Notice
|
| 18 |
+
|
| 19 |
+
When using large-scale jittering, there are sometimes empty proposals in the box and mask heads during training.
|
| 20 |
+
This requires MMSyncBN that allows empty tensors. Therefore, please use mmcv-full>=1.3.14 to train models supported in this directory.
|
grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_amp-lsj-100e_coco.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = 'mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py' # noqa
|
| 2 |
+
|
| 3 |
+
# Enable automatic-mixed-precision training with AmpOptimWrapper.
|
| 4 |
+
optim_wrapper = dict(type='AmpOptimWrapper')
|
grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/mask-rcnn_r50_fpn.py',
|
| 3 |
+
'../common/lsj-100e_coco-instance.py'
|
| 4 |
+
]
|
| 5 |
+
image_size = (1024, 1024)
|
| 6 |
+
batch_augments = [
|
| 7 |
+
dict(type='BatchFixedSizePad', size=image_size, pad_mask=True)
|
| 8 |
+
]
|
| 9 |
+
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
| 10 |
+
# Use MMSyncBN that handles empty tensor in head. It can be changed to
|
| 11 |
+
# SyncBN after https://github.com/pytorch/pytorch/issues/36530 is fixed
|
| 12 |
+
head_norm_cfg = dict(type='MMSyncBN', requires_grad=True)
|
| 13 |
+
model = dict(
|
| 14 |
+
# use caffe norm
|
| 15 |
+
data_preprocessor=dict(
|
| 16 |
+
mean=[103.530, 116.280, 123.675],
|
| 17 |
+
std=[1.0, 1.0, 1.0],
|
| 18 |
+
bgr_to_rgb=False,
|
| 19 |
+
|
| 20 |
+
# pad_size_divisor=32 is unnecessary in training but necessary
|
| 21 |
+
# in testing.
|
| 22 |
+
pad_size_divisor=32,
|
| 23 |
+
batch_augments=batch_augments),
|
| 24 |
+
backbone=dict(
|
| 25 |
+
frozen_stages=-1,
|
| 26 |
+
norm_eval=False,
|
| 27 |
+
norm_cfg=norm_cfg,
|
| 28 |
+
init_cfg=None,
|
| 29 |
+
style='caffe'),
|
| 30 |
+
neck=dict(norm_cfg=norm_cfg),
|
| 31 |
+
rpn_head=dict(num_convs=2),
|
| 32 |
+
roi_head=dict(
|
| 33 |
+
bbox_head=dict(
|
| 34 |
+
type='Shared4Conv1FCBBoxHead',
|
| 35 |
+
conv_out_channels=256,
|
| 36 |
+
norm_cfg=head_norm_cfg),
|
| 37 |
+
mask_head=dict(norm_cfg=head_norm_cfg)))
|
| 38 |
+
|
| 39 |
+
train_pipeline = [
|
| 40 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 41 |
+
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
| 42 |
+
dict(
|
| 43 |
+
type='RandomResize',
|
| 44 |
+
scale=image_size,
|
| 45 |
+
ratio_range=(0.1, 2.0),
|
| 46 |
+
keep_ratio=True),
|
| 47 |
+
dict(
|
| 48 |
+
type='RandomCrop',
|
| 49 |
+
crop_type='absolute_range',
|
| 50 |
+
crop_size=image_size,
|
| 51 |
+
recompute_bbox=True,
|
| 52 |
+
allow_negative_crop=True),
|
| 53 |
+
dict(type='FilterAnnotations', min_gt_bbox_wh=(1e-2, 1e-2)),
|
| 54 |
+
dict(type='RandomFlip', prob=0.5),
|
| 55 |
+
dict(type='PackDetInputs')
|
| 56 |
+
]
|
| 57 |
+
test_pipeline = [
|
| 58 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 59 |
+
dict(type='Resize', scale=(1333, 800), keep_ratio=True),
|
| 60 |
+
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
| 61 |
+
dict(
|
| 62 |
+
type='PackDetInputs',
|
| 63 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
| 64 |
+
'scale_factor'))
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
# Use RepeatDataset to speed up training
|
| 68 |
+
train_dataloader = dict(dataset=dict(dataset=dict(pipeline=train_pipeline)))
|
grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-400e_coco.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py' # noqa
|
| 2 |
+
|
| 3 |
+
# Use RepeatDataset to speed up training
|
| 4 |
+
# change repeat time from 4 (for 100 epochs) to 16 (for 400 epochs)
|
| 5 |
+
train_dataloader = dict(dataset=dict(times=4 * 4))
|
| 6 |
+
param_scheduler = [
|
| 7 |
+
dict(
|
| 8 |
+
type='LinearLR',
|
| 9 |
+
start_factor=0.067,
|
| 10 |
+
by_epoch=False,
|
| 11 |
+
begin=0,
|
| 12 |
+
end=500 * 4),
|
| 13 |
+
dict(
|
| 14 |
+
type='MultiStepLR',
|
| 15 |
+
begin=0,
|
| 16 |
+
end=12,
|
| 17 |
+
by_epoch=True,
|
| 18 |
+
milestones=[22, 24],
|
| 19 |
+
gamma=0.1)
|
| 20 |
+
]
|
grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_amp-lsj-100e_coco.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = 'mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py'
|
| 2 |
+
|
| 3 |
+
# Enable automatic-mixed-precision training with AmpOptimWrapper.
|
| 4 |
+
optim_wrapper = dict(type='AmpOptimWrapper')
|
grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/mask-rcnn_r50_fpn.py',
|
| 3 |
+
'../common/lsj-100e_coco-instance.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
image_size = (1024, 1024)
|
| 7 |
+
batch_augments = [
|
| 8 |
+
dict(type='BatchFixedSizePad', size=image_size, pad_mask=True)
|
| 9 |
+
]
|
| 10 |
+
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
| 11 |
+
# Use MMSyncBN that handles empty tensor in head. It can be changed to
|
| 12 |
+
# SyncBN after https://github.com/pytorch/pytorch/issues/36530 is fixed
|
| 13 |
+
head_norm_cfg = dict(type='MMSyncBN', requires_grad=True)
|
| 14 |
+
model = dict(
|
| 15 |
+
# the model is trained from scratch, so init_cfg is None
|
| 16 |
+
data_preprocessor=dict(
|
| 17 |
+
# pad_size_divisor=32 is unnecessary in training but necessary
|
| 18 |
+
# in testing.
|
| 19 |
+
pad_size_divisor=32,
|
| 20 |
+
batch_augments=batch_augments),
|
| 21 |
+
backbone=dict(
|
| 22 |
+
frozen_stages=-1, norm_eval=False, norm_cfg=norm_cfg, init_cfg=None),
|
| 23 |
+
neck=dict(norm_cfg=norm_cfg),
|
| 24 |
+
rpn_head=dict(num_convs=2), # leads to 0.1+ mAP
|
| 25 |
+
roi_head=dict(
|
| 26 |
+
bbox_head=dict(
|
| 27 |
+
type='Shared4Conv1FCBBoxHead',
|
| 28 |
+
conv_out_channels=256,
|
| 29 |
+
norm_cfg=head_norm_cfg),
|
| 30 |
+
mask_head=dict(norm_cfg=head_norm_cfg)))
|
grounding-dino/mmdetection/configs/strong_baselines/mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-50e_coco.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = 'mask-rcnn_r50_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py'
|
| 2 |
+
|
| 3 |
+
# Use RepeatDataset to speed up training
|
| 4 |
+
# change repeat time from 4 (for 100 epochs) to 2 (for 50 epochs)
|
| 5 |
+
train_dataloader = dict(dataset=dict(times=2))
|
grounding-dino/mmdetection/configs/strong_baselines/metafile.yml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Models:
|
| 2 |
+
- Name: mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco
|
| 3 |
+
In Collection: Mask R-CNN
|
| 4 |
+
Config: configs/strong_baselines/mask-rcnn_r50-caffe_fpn_rpn-2conv_4conv1fc_syncbn-all_lsj-100e_coco.py
|
| 5 |
+
Metadata:
|
| 6 |
+
Epochs: 100
|
| 7 |
+
Training Data: COCO
|
| 8 |
+
Training Techniques:
|
| 9 |
+
- SGD with Momentum
|
| 10 |
+
- Weight Decay
|
| 11 |
+
- LSJ
|
| 12 |
+
Training Resources: 8x V100 GPUs
|
| 13 |
+
Architecture:
|
| 14 |
+
- ResNet
|
| 15 |
+
- FPN
|
| 16 |
+
Results:
|
| 17 |
+
- Task: Object Detection
|
| 18 |
+
Dataset: COCO
|
| 19 |
+
Metrics:
|
| 20 |
+
box AP: 44.7
|
| 21 |
+
- Task: Instance Segmentation
|
| 22 |
+
Dataset: COCO
|
| 23 |
+
Metrics:
|
| 24 |
+
box AP: 40.4
|
grounding-dino/mmdetection/configs/strongsort/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# StrongSORT: Make DeepSORT Great Again
|
| 2 |
+
|
| 3 |
+
## Abstract
|
| 4 |
+
|
| 5 |
+
<!-- [ABSTRACT] -->
|
| 6 |
+
|
| 7 |
+
Existing Multi-Object Tracking (MOT) methods can be roughly classified as tracking-by-detection and joint-detection-association paradigms. Although the latter has elicited more attention and demonstrates comparable performance relative to the former, we claim that the tracking-by-detection paradigm is still the optimal solution in terms of tracking accuracy. In this paper, we revisit the classic tracker DeepSORT and upgrade it from various aspects, i.e., detection, embedding and association. The resulting tracker, called StrongSORT, sets new HOTA and IDF1 records on MOT17 and MOT20. We also present two lightweight and plug-and-play algorithms to further refine the tracking results. Firstly, an appearance-free link model (AFLink) is proposed to associate short tracklets into complete trajectories. To the best of our knowledge, this is the first global link model without appearance information. Secondly, we propose Gaussian-smoothed interpolation (GSI) to compensate for missing detections. Instead of ignoring motion information like linear interpolation, GSI is based on the Gaussian process regression algorithm and can achieve more accurate localizations. Moreover, AFLink and GSI can be plugged into various trackers with a negligible extra computational cost (591.9 and 140.9 Hz, respectively, on MOT17). By integrating StrongSORT with the two algorithms, the final tracker StrongSORT++ ranks first on MOT17 and MOT20 in terms of HOTA and IDF1 metrics and surpasses the second-place one by 1.3 - 2.2. Code will be released soon.
|
| 8 |
+
|
| 9 |
+
<!-- [IMAGE] -->
|
| 10 |
+
|
| 11 |
+
<div align="center">
|
| 12 |
+
<img src="https://user-images.githubusercontent.com/99722489/185282811-ec82bdf6-8889-4f01-9c4d-a8e104f775b7.png"/>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
## Citation
|
| 16 |
+
|
| 17 |
+
<!-- [ALGORITHM] -->
|
| 18 |
+
|
| 19 |
+
```latex
|
| 20 |
+
@article{du2022strongsort,
|
| 21 |
+
title={Strongsort: Make deepsort great again},
|
| 22 |
+
author={Du, Yunhao and Song, Yang and Yang, Bo and Zhao, Yanyun},
|
| 23 |
+
journal={arXiv preprint arXiv:2202.13514},
|
| 24 |
+
year={2022}
|
| 25 |
+
}
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Results and models on MOT17
|
| 29 |
+
|
| 30 |
+
| Method | Detector | ReID | Train Set | Test Set | Public | Inf time (fps) | HOTA | MOTA | IDF1 | FP | FN | IDSw. | Config | Download |
|
| 31 |
+
| :----------: | :------: | :--: | :---------------------------: | :------------: | :----: | :------------: | :--: | :--: | :--: | :---: | :---: | :---: | :----------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 32 |
+
| StrongSORT++ | YOLOX-X | R50 | CrowdHuman + MOT17-half-train | MOT17-half-val | N | - | 70.9 | 78.4 | 83.3 | 15237 | 19035 | 582 | [config](strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py) | [detector](https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/yolox_x_crowdhuman_mot17-private-half_20220812_192036-b6c9ce9a.pth) [reid](https://download.openmmlab.com/mmtracking/mot/reid/reid_r50_6e_mot17-4bf6b63d.pth) [AFLink](https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/aflink_motchallenge_20220812_190310-a7578ad3.pth) |
|
| 33 |
+
|
| 34 |
+
## Results and models on MOT20
|
| 35 |
+
|
| 36 |
+
| Method | Detector | ReID | Train Set | Test Set | Public | Inf time (fps) | HOTA | MOTA | IDF1 | FP | FN | IDSw. | Config | Download |
|
| 37 |
+
| :----------: | :------: | :--: | :----------------------: | :--------: | :----: | :------------: | :--: | :--: | :--: | :---: | :---: | :---: | :---------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 38 |
+
| StrongSORT++ | YOLOX-X | R50 | CrowdHuman + MOT20-train | MOT20-test | N | - | 62.9 | 75.5 | 77.3 | 29043 | 96155 | 1640 | [config](strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py) | [detector](https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/yolox_x_crowdhuman_mot20-private_20220812_192123-77c014de.pth) [reid](https://download.openmmlab.com/mmtracking/mot/reid/reid_r50_6e_mot20_20210803_212426-c83b1c01.pth) [AFLink](https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/aflink_motchallenge_20220812_190310-a7578ad3.pth) |
|
| 39 |
+
|
| 40 |
+
## Get started
|
| 41 |
+
|
| 42 |
+
### 1. Development Environment Setup
|
| 43 |
+
|
| 44 |
+
Tracking Development Environment Setup can refer to this [document](../../docs/en/get_started.md).
|
| 45 |
+
|
| 46 |
+
### 2. Dataset Prepare
|
| 47 |
+
|
| 48 |
+
Tracking Dataset Prepare can refer to this [document](../../docs/en/user_guides/tracking_dataset_prepare.md).
|
| 49 |
+
|
| 50 |
+
### 3. Training
|
| 51 |
+
|
| 52 |
+
We implement StrongSORT with independent detector and ReID models.
|
| 53 |
+
Note that, due to the influence of parameters such as learning rate in default configuration file,
|
| 54 |
+
we recommend using 8 GPUs for training in order to reproduce accuracy.
|
| 55 |
+
|
| 56 |
+
You can train the detector as follows.
|
| 57 |
+
|
| 58 |
+
```shell script
|
| 59 |
+
# Training YOLOX-X on crowdhuman and mot17-half-train dataset with following command.
|
| 60 |
+
# The number after config file represents the number of GPUs used. Here we use 8 GPUs.
|
| 61 |
+
bash tools/dist_train.sh configs/det/yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py 8
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
And you can train the ReID model as follows.
|
| 65 |
+
|
| 66 |
+
```shell script
|
| 67 |
+
# Training ReID model on mot17-train80 dataset with following command.
|
| 68 |
+
# The number after config file represents the number of GPUs used. Here we use 8 GPUs.
|
| 69 |
+
bash tools/dist_train.sh configs/reid/reid_r50_8xb32-6e_mot17train80_test-mot17val20.py 8
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
If you want to know about more detailed usage of `train.py/dist_train.sh/slurm_train.sh`,
|
| 73 |
+
please refer to this [document](../../docs/en/user_guides/tracking_train_test.md).
|
| 74 |
+
|
| 75 |
+
### 4. Testing and evaluation
|
| 76 |
+
|
| 77 |
+
**2.1 Example on MOTxx-halfval dataset**
|
| 78 |
+
|
| 79 |
+
```shell script
|
| 80 |
+
# Example 1: Test on motXX-half-val set.
|
| 81 |
+
# The number after config file represents the number of GPUs used. Here we use 8 GPUs.
|
| 82 |
+
bash tools/dist_test_tracking.sh configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py 8 --detector ${CHECKPOINT_PATH} --reid ${CHECKPOINT_PATH}
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
**2.2 Example on MOTxx-test dataset**
|
| 86 |
+
|
| 87 |
+
If you want to get the results of the [MOT Challenge](https://motchallenge.net/) test set,
|
| 88 |
+
please use the following command to generate result files that can be used for submission.
|
| 89 |
+
It will be stored in `./mot_20_test_res`, you can modify the saved path in `test_evaluator` of the config.
|
| 90 |
+
|
| 91 |
+
```shell script
|
| 92 |
+
# Example 2: Test on motxx-test set
|
| 93 |
+
# The number after config file represents the number of GPUs used
|
| 94 |
+
bash tools/dist_test_tracking.sh configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py 8 --detector ${CHECKPOINT_PATH} --reid ${CHECKPOINT_PATH}
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
If you want to know about more detailed usage of `test_tracking.py/dist_test_tracking.sh/slurm_test_tracking.sh`,
|
| 98 |
+
please refer to this [document](../../docs/en/user_guides/tracking_train_test.md).
|
| 99 |
+
|
| 100 |
+
### 3.Inference
|
| 101 |
+
|
| 102 |
+
Use a single GPU to predict a video and save it as a video.
|
| 103 |
+
|
| 104 |
+
```shell
|
| 105 |
+
python demo/mot_demo.py demo/demo_mot.mp4 configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py --detector ${CHECKPOINT_FILE} --reid ${CHECKPOINT_PATH} --out mot.mp4
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
If you want to know about more detailed usage of `mot_demo.py`, please refer to this [document](../../docs/en/user_guides/tracking_inference.md).
|
grounding-dino/mmdetection/configs/strongsort/metafile.yml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Collections:
|
| 2 |
+
- Name: StrongSORT++
|
| 3 |
+
Metadata:
|
| 4 |
+
Training Techniques:
|
| 5 |
+
- SGD with Momentum
|
| 6 |
+
Training Resources: 8x V100 GPUs
|
| 7 |
+
Architecture:
|
| 8 |
+
- ResNet
|
| 9 |
+
- YOLOX
|
| 10 |
+
Paper:
|
| 11 |
+
URL: https://arxiv.org/abs/2202.13514
|
| 12 |
+
Title: "StrongSORT: Make DeepSORT Great Again"
|
| 13 |
+
README: configs/strongsort/README.md
|
| 14 |
+
|
| 15 |
+
Models:
|
| 16 |
+
- Name: strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval
|
| 17 |
+
In Collection: StrongSORT++
|
| 18 |
+
Config: configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py
|
| 19 |
+
Metadata:
|
| 20 |
+
Training Data: CrowdHuman + MOT17-half-train
|
| 21 |
+
Results:
|
| 22 |
+
- Task: Multiple Object Tracking
|
| 23 |
+
Dataset: MOT17-half-val
|
| 24 |
+
Metrics:
|
| 25 |
+
MOTA: 78.3
|
| 26 |
+
IDF1: 83.2
|
| 27 |
+
HOTA: 70.9
|
| 28 |
+
Weights:
|
| 29 |
+
- https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/yolox_x_crowdhuman_mot17-private-half_20220812_192036-b6c9ce9a.pth
|
| 30 |
+
- https://download.openmmlab.com/mmtracking/mot/reid/reid_r50_6e_mot17-4bf6b63d.pth
|
| 31 |
+
- https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/aflink_motchallenge_20220812_190310-a7578ad3.pth
|
| 32 |
+
|
| 33 |
+
- Name: strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test
|
| 34 |
+
In Collection: StrongSORT++
|
| 35 |
+
Config: configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py
|
| 36 |
+
Metadata:
|
| 37 |
+
Training Data: CrowdHuman + MOT20-train
|
| 38 |
+
Results:
|
| 39 |
+
- Task: Multiple Object Tracking
|
| 40 |
+
Dataset: MOT20-test
|
| 41 |
+
Metrics:
|
| 42 |
+
MOTA: 75.5
|
| 43 |
+
IDF1: 77.3
|
| 44 |
+
HOTA: 62.9
|
| 45 |
+
Weights:
|
| 46 |
+
- https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/yolox_x_crowdhuman_mot20-private_20220812_192123-77c014de.pth
|
| 47 |
+
- https://download.openmmlab.com/mmtracking/mot/reid/reid_r50_6e_mot20_20210803_212426-c83b1c01.pth
|
| 48 |
+
- https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/aflink_motchallenge_20220812_190310-a7578ad3.pth
|
grounding-dino/mmdetection/configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'./yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py', # noqa: E501
|
| 3 |
+
]
|
| 4 |
+
|
| 5 |
+
dataset_type = 'MOTChallengeDataset'
|
| 6 |
+
detector = _base_.model
|
| 7 |
+
detector.pop('data_preprocessor')
|
| 8 |
+
del _base_.model
|
| 9 |
+
|
| 10 |
+
model = dict(
|
| 11 |
+
type='StrongSORT',
|
| 12 |
+
data_preprocessor=dict(
|
| 13 |
+
type='TrackDataPreprocessor',
|
| 14 |
+
pad_size_divisor=32,
|
| 15 |
+
batch_augments=[
|
| 16 |
+
dict(
|
| 17 |
+
type='BatchSyncRandomResize',
|
| 18 |
+
random_size_range=(576, 1024),
|
| 19 |
+
size_divisor=32,
|
| 20 |
+
interval=10)
|
| 21 |
+
]),
|
| 22 |
+
detector=detector,
|
| 23 |
+
reid=dict(
|
| 24 |
+
type='BaseReID',
|
| 25 |
+
data_preprocessor=dict(type='mmpretrain.ClsDataPreprocessor'),
|
| 26 |
+
backbone=dict(
|
| 27 |
+
type='mmpretrain.ResNet',
|
| 28 |
+
depth=50,
|
| 29 |
+
num_stages=4,
|
| 30 |
+
out_indices=(3, ),
|
| 31 |
+
style='pytorch'),
|
| 32 |
+
neck=dict(type='GlobalAveragePooling', kernel_size=(8, 4), stride=1),
|
| 33 |
+
head=dict(
|
| 34 |
+
type='LinearReIDHead',
|
| 35 |
+
num_fcs=1,
|
| 36 |
+
in_channels=2048,
|
| 37 |
+
fc_channels=1024,
|
| 38 |
+
out_channels=128,
|
| 39 |
+
num_classes=380,
|
| 40 |
+
loss_cls=dict(type='mmpretrain.CrossEntropyLoss', loss_weight=1.0),
|
| 41 |
+
loss_triplet=dict(type='TripletLoss', margin=0.3, loss_weight=1.0),
|
| 42 |
+
norm_cfg=dict(type='BN1d'),
|
| 43 |
+
act_cfg=dict(type='ReLU'))),
|
| 44 |
+
cmc=dict(
|
| 45 |
+
type='CameraMotionCompensation',
|
| 46 |
+
warp_mode='cv2.MOTION_EUCLIDEAN',
|
| 47 |
+
num_iters=100,
|
| 48 |
+
stop_eps=0.00001),
|
| 49 |
+
tracker=dict(
|
| 50 |
+
type='StrongSORTTracker',
|
| 51 |
+
motion=dict(type='KalmanFilter', center_only=False, use_nsa=True),
|
| 52 |
+
obj_score_thr=0.6,
|
| 53 |
+
reid=dict(
|
| 54 |
+
num_samples=None,
|
| 55 |
+
img_scale=(256, 128),
|
| 56 |
+
img_norm_cfg=dict(
|
| 57 |
+
mean=[123.675, 116.28, 103.53],
|
| 58 |
+
std=[58.395, 57.12, 57.375],
|
| 59 |
+
to_rgb=True),
|
| 60 |
+
match_score_thr=0.3,
|
| 61 |
+
motion_weight=0.02,
|
| 62 |
+
),
|
| 63 |
+
match_iou_thr=0.7,
|
| 64 |
+
momentums=dict(embeds=0.1, ),
|
| 65 |
+
num_tentatives=2,
|
| 66 |
+
num_frames_retain=100),
|
| 67 |
+
postprocess_model=dict(
|
| 68 |
+
type='AppearanceFreeLink',
|
| 69 |
+
checkpoint= # noqa: E251
|
| 70 |
+
'https://download.openmmlab.com/mmtracking/mot/strongsort/mot_dataset/aflink_motchallenge_20220812_190310-a7578ad3.pth', # noqa: E501
|
| 71 |
+
temporal_threshold=(0, 30),
|
| 72 |
+
spatial_threshold=50,
|
| 73 |
+
confidence_threshold=0.95,
|
| 74 |
+
))
|
| 75 |
+
|
| 76 |
+
train_pipeline = None
|
| 77 |
+
test_pipeline = [
|
| 78 |
+
dict(
|
| 79 |
+
type='TransformBroadcaster',
|
| 80 |
+
transforms=[
|
| 81 |
+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
|
| 82 |
+
dict(type='Resize', scale=_base_.img_scale, keep_ratio=True),
|
| 83 |
+
dict(
|
| 84 |
+
type='Pad',
|
| 85 |
+
size_divisor=32,
|
| 86 |
+
pad_val=dict(img=(114.0, 114.0, 114.0))),
|
| 87 |
+
dict(type='LoadTrackAnnotations'),
|
| 88 |
+
]),
|
| 89 |
+
dict(type='PackTrackInputs')
|
| 90 |
+
]
|
| 91 |
+
|
| 92 |
+
train_dataloader = None
|
| 93 |
+
val_dataloader = dict(
|
| 94 |
+
# Now StrongSORT only support video_based sampling
|
| 95 |
+
sampler=dict(type='DefaultSampler', shuffle=False, round_up=False),
|
| 96 |
+
dataset=dict(
|
| 97 |
+
_delete_=True,
|
| 98 |
+
type=dataset_type,
|
| 99 |
+
data_root=_base_.data_root,
|
| 100 |
+
ann_file='annotations/half-val_cocoformat.json',
|
| 101 |
+
data_prefix=dict(img_path='train'),
|
| 102 |
+
# when you evaluate track performance, you need to remove metainfo
|
| 103 |
+
test_mode=True,
|
| 104 |
+
pipeline=test_pipeline))
|
| 105 |
+
test_dataloader = val_dataloader
|
| 106 |
+
|
| 107 |
+
train_cfg = None
|
| 108 |
+
optim_wrapper = None
|
| 109 |
+
|
| 110 |
+
# evaluator
|
| 111 |
+
val_evaluator = dict(
|
| 112 |
+
_delete_=True,
|
| 113 |
+
type='MOTChallengeMetric',
|
| 114 |
+
metric=['HOTA', 'CLEAR', 'Identity'],
|
| 115 |
+
# use_postprocess to support AppearanceFreeLink in val_evaluator
|
| 116 |
+
use_postprocess=True,
|
| 117 |
+
postprocess_tracklet_cfg=[
|
| 118 |
+
dict(
|
| 119 |
+
type='InterpolateTracklets',
|
| 120 |
+
min_num_frames=5,
|
| 121 |
+
max_num_frames=20,
|
| 122 |
+
use_gsi=True,
|
| 123 |
+
smooth_tau=10)
|
| 124 |
+
])
|
| 125 |
+
test_evaluator = val_evaluator
|
| 126 |
+
|
| 127 |
+
default_hooks = dict(logger=dict(type='LoggerHook', interval=1))
|
| 128 |
+
|
| 129 |
+
del _base_.param_scheduler
|
| 130 |
+
del _base_.custom_hooks
|
grounding-dino/mmdetection/configs/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'./strongsort_yolox_x_8xb4-80e_crowdhuman-mot17halftrain'
|
| 3 |
+
'_test-mot17halfval.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
img_scale = (1600, 896) # width, height
|
| 7 |
+
|
| 8 |
+
model = dict(
|
| 9 |
+
data_preprocessor=dict(
|
| 10 |
+
type='TrackDataPreprocessor',
|
| 11 |
+
pad_size_divisor=32,
|
| 12 |
+
batch_augments=[
|
| 13 |
+
dict(type='BatchSyncRandomResize', random_size_range=(640, 1152))
|
| 14 |
+
]))
|
| 15 |
+
|
| 16 |
+
test_pipeline = [
|
| 17 |
+
dict(
|
| 18 |
+
type='TransformBroadcaster',
|
| 19 |
+
transforms=[
|
| 20 |
+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
|
| 21 |
+
dict(type='Resize', scale=img_scale, keep_ratio=True),
|
| 22 |
+
dict(
|
| 23 |
+
type='Pad',
|
| 24 |
+
size_divisor=32,
|
| 25 |
+
pad_val=dict(img=(114.0, 114.0, 114.0))),
|
| 26 |
+
dict(type='LoadTrackAnnotations'),
|
| 27 |
+
]),
|
| 28 |
+
dict(type='PackTrackInputs')
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
val_dataloader = dict(
|
| 32 |
+
dataset=dict(
|
| 33 |
+
data_root='data/MOT17',
|
| 34 |
+
ann_file='annotations/train_cocoformat.json',
|
| 35 |
+
data_prefix=dict(img_path='train'),
|
| 36 |
+
pipeline=test_pipeline))
|
| 37 |
+
test_dataloader = dict(
|
| 38 |
+
dataset=dict(
|
| 39 |
+
data_root='data/MOT20',
|
| 40 |
+
ann_file='annotations/test_cocoformat.json',
|
| 41 |
+
data_prefix=dict(img_path='test'),
|
| 42 |
+
pipeline=test_pipeline))
|
| 43 |
+
|
| 44 |
+
test_evaluator = dict(format_only=True, outfile_prefix='./mot_20_test_res')
|
grounding-dino/mmdetection/configs/strongsort/yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = ['../yolox/yolox_x_8xb8-300e_coco.py']
|
| 2 |
+
|
| 3 |
+
data_root = 'data/MOT17/'
|
| 4 |
+
|
| 5 |
+
img_scale = (1440, 800) # width, height
|
| 6 |
+
batch_size = 4
|
| 7 |
+
|
| 8 |
+
# model settings
|
| 9 |
+
model = dict(
|
| 10 |
+
bbox_head=dict(num_classes=1),
|
| 11 |
+
test_cfg=dict(nms=dict(iou_threshold=0.7)),
|
| 12 |
+
init_cfg=dict(
|
| 13 |
+
type='Pretrained',
|
| 14 |
+
checkpoint= # noqa: E251
|
| 15 |
+
'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_x_8x8_300e_coco/yolox_x_8x8_300e_coco_20211126_140254-1ef88d67.pth' # noqa: E501
|
| 16 |
+
))
|
| 17 |
+
|
| 18 |
+
train_pipeline = [
|
| 19 |
+
dict(
|
| 20 |
+
type='Mosaic',
|
| 21 |
+
img_scale=img_scale,
|
| 22 |
+
pad_val=114.0,
|
| 23 |
+
bbox_clip_border=False),
|
| 24 |
+
dict(
|
| 25 |
+
type='RandomAffine',
|
| 26 |
+
scaling_ratio_range=(0.1, 2),
|
| 27 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
| 28 |
+
bbox_clip_border=False),
|
| 29 |
+
dict(
|
| 30 |
+
type='MixUp',
|
| 31 |
+
img_scale=img_scale,
|
| 32 |
+
ratio_range=(0.8, 1.6),
|
| 33 |
+
pad_val=114.0,
|
| 34 |
+
bbox_clip_border=False),
|
| 35 |
+
dict(type='YOLOXHSVRandomAug'),
|
| 36 |
+
dict(type='RandomFlip', prob=0.5),
|
| 37 |
+
dict(
|
| 38 |
+
type='Resize',
|
| 39 |
+
scale=img_scale,
|
| 40 |
+
keep_ratio=True,
|
| 41 |
+
clip_object_border=False),
|
| 42 |
+
dict(type='Pad', size_divisor=32, pad_val=dict(img=(114.0, 114.0, 114.0))),
|
| 43 |
+
dict(type='FilterAnnotations', min_gt_bbox_wh=(1, 1), keep_empty=False),
|
| 44 |
+
dict(type='PackDetInputs')
|
| 45 |
+
]
|
| 46 |
+
|
| 47 |
+
test_pipeline = [
|
| 48 |
+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
|
| 49 |
+
dict(type='Resize', scale=img_scale, keep_ratio=True),
|
| 50 |
+
dict(type='Pad', size_divisor=32, pad_val=dict(img=(114.0, 114.0, 114.0))),
|
| 51 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 52 |
+
dict(
|
| 53 |
+
type='PackDetInputs',
|
| 54 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
| 55 |
+
'scale_factor'))
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
train_dataloader = dict(
|
| 59 |
+
_delete_=True,
|
| 60 |
+
batch_size=batch_size,
|
| 61 |
+
num_workers=4,
|
| 62 |
+
persistent_workers=True,
|
| 63 |
+
pin_memory=True,
|
| 64 |
+
sampler=dict(type='DefaultSampler', shuffle=True),
|
| 65 |
+
dataset=dict(
|
| 66 |
+
type='MultiImageMixDataset',
|
| 67 |
+
dataset=dict(
|
| 68 |
+
type='ConcatDataset',
|
| 69 |
+
datasets=[
|
| 70 |
+
dict(
|
| 71 |
+
type='CocoDataset',
|
| 72 |
+
data_root=data_root,
|
| 73 |
+
ann_file='annotations/half-train_cocoformat.json',
|
| 74 |
+
data_prefix=dict(img='train'),
|
| 75 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 76 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 77 |
+
pipeline=[
|
| 78 |
+
dict(
|
| 79 |
+
type='LoadImageFromFile',
|
| 80 |
+
backend_args=_base_.backend_args),
|
| 81 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 82 |
+
]),
|
| 83 |
+
dict(
|
| 84 |
+
type='CocoDataset',
|
| 85 |
+
data_root='data/crowdhuman',
|
| 86 |
+
ann_file='annotations/crowdhuman_train.json',
|
| 87 |
+
data_prefix=dict(img='train'),
|
| 88 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 89 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 90 |
+
pipeline=[
|
| 91 |
+
dict(
|
| 92 |
+
type='LoadImageFromFile',
|
| 93 |
+
backend_args=_base_.backend_args),
|
| 94 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 95 |
+
]),
|
| 96 |
+
dict(
|
| 97 |
+
type='CocoDataset',
|
| 98 |
+
data_root='data/crowdhuman',
|
| 99 |
+
ann_file='annotations/crowdhuman_val.json',
|
| 100 |
+
data_prefix=dict(img='val'),
|
| 101 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 102 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 103 |
+
pipeline=[
|
| 104 |
+
dict(
|
| 105 |
+
type='LoadImageFromFile',
|
| 106 |
+
backend_args=_base_.backend_args),
|
| 107 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 108 |
+
]),
|
| 109 |
+
]),
|
| 110 |
+
pipeline=train_pipeline))
|
| 111 |
+
|
| 112 |
+
val_dataloader = dict(
|
| 113 |
+
batch_size=1,
|
| 114 |
+
num_workers=2,
|
| 115 |
+
dataset=dict(
|
| 116 |
+
data_root=data_root,
|
| 117 |
+
ann_file='annotations/half-val_cocoformat.json',
|
| 118 |
+
data_prefix=dict(img='train'),
|
| 119 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 120 |
+
pipeline=test_pipeline))
|
| 121 |
+
test_dataloader = val_dataloader
|
| 122 |
+
|
| 123 |
+
# training settings
|
| 124 |
+
max_epochs = 80
|
| 125 |
+
num_last_epochs = 10
|
| 126 |
+
interval = 5
|
| 127 |
+
|
| 128 |
+
train_cfg = dict(max_epochs=max_epochs, val_begin=75, val_interval=1)
|
| 129 |
+
|
| 130 |
+
# optimizer
|
| 131 |
+
# default 8 gpu
|
| 132 |
+
base_lr = 0.001 / 8 * batch_size
|
| 133 |
+
optim_wrapper = dict(optimizer=dict(lr=base_lr))
|
| 134 |
+
|
| 135 |
+
# learning rate
|
| 136 |
+
param_scheduler = [
|
| 137 |
+
dict(
|
| 138 |
+
type='QuadraticWarmupLR',
|
| 139 |
+
by_epoch=True,
|
| 140 |
+
begin=0,
|
| 141 |
+
end=1,
|
| 142 |
+
convert_to_iter_based=True),
|
| 143 |
+
dict(
|
| 144 |
+
type='CosineAnnealingLR',
|
| 145 |
+
eta_min=base_lr * 0.05,
|
| 146 |
+
begin=1,
|
| 147 |
+
T_max=max_epochs - num_last_epochs,
|
| 148 |
+
end=max_epochs - num_last_epochs,
|
| 149 |
+
by_epoch=True,
|
| 150 |
+
convert_to_iter_based=True),
|
| 151 |
+
dict(
|
| 152 |
+
type='ConstantLR',
|
| 153 |
+
by_epoch=True,
|
| 154 |
+
factor=1,
|
| 155 |
+
begin=max_epochs - num_last_epochs,
|
| 156 |
+
end=max_epochs,
|
| 157 |
+
)
|
| 158 |
+
]
|
| 159 |
+
|
| 160 |
+
default_hooks = dict(
|
| 161 |
+
checkpoint=dict(
|
| 162 |
+
interval=1,
|
| 163 |
+
max_keep_ckpts=5 # only keep latest 5 checkpoints
|
| 164 |
+
))
|
| 165 |
+
|
| 166 |
+
custom_hooks = [
|
| 167 |
+
dict(
|
| 168 |
+
type='YOLOXModeSwitchHook',
|
| 169 |
+
num_last_epochs=num_last_epochs,
|
| 170 |
+
priority=48),
|
| 171 |
+
dict(type='SyncNormHook', priority=48),
|
| 172 |
+
dict(
|
| 173 |
+
type='EMAHook',
|
| 174 |
+
ema_type='ExpMomentumEMA',
|
| 175 |
+
momentum=0.0001,
|
| 176 |
+
update_buffers=True,
|
| 177 |
+
priority=49)
|
| 178 |
+
]
|
| 179 |
+
|
| 180 |
+
# evaluator
|
| 181 |
+
val_evaluator = dict(
|
| 182 |
+
ann_file=data_root + 'annotations/half-val_cocoformat.json',
|
| 183 |
+
format_only=False)
|
| 184 |
+
test_evaluator = val_evaluator
|
| 185 |
+
|
| 186 |
+
del _base_.tta_model
|
| 187 |
+
del _base_.tta_pipeline
|
| 188 |
+
del _base_.train_dataset
|
grounding-dino/mmdetection/configs/strongsort/yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = ['./yolox_x_8xb4-80e_crowdhuman-mot17halftrain_test-mot17halfval.py']
|
| 2 |
+
|
| 3 |
+
data_root = 'data/MOT20/'
|
| 4 |
+
|
| 5 |
+
img_scale = (1600, 896) # width, height
|
| 6 |
+
|
| 7 |
+
# model settings
|
| 8 |
+
model = dict(
|
| 9 |
+
data_preprocessor=dict(batch_augments=[
|
| 10 |
+
dict(type='BatchSyncRandomResize', random_size_range=(640, 1152))
|
| 11 |
+
]))
|
| 12 |
+
|
| 13 |
+
train_pipeline = [
|
| 14 |
+
dict(
|
| 15 |
+
type='Mosaic',
|
| 16 |
+
img_scale=img_scale,
|
| 17 |
+
pad_val=114.0,
|
| 18 |
+
bbox_clip_border=True),
|
| 19 |
+
dict(
|
| 20 |
+
type='RandomAffine',
|
| 21 |
+
scaling_ratio_range=(0.1, 2),
|
| 22 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
| 23 |
+
bbox_clip_border=True),
|
| 24 |
+
dict(
|
| 25 |
+
type='MixUp',
|
| 26 |
+
img_scale=img_scale,
|
| 27 |
+
ratio_range=(0.8, 1.6),
|
| 28 |
+
pad_val=114.0,
|
| 29 |
+
bbox_clip_border=True),
|
| 30 |
+
dict(type='YOLOXHSVRandomAug'),
|
| 31 |
+
dict(type='RandomFlip', prob=0.5),
|
| 32 |
+
dict(
|
| 33 |
+
type='Resize',
|
| 34 |
+
scale=img_scale,
|
| 35 |
+
keep_ratio=True,
|
| 36 |
+
clip_object_border=True),
|
| 37 |
+
dict(type='Pad', size_divisor=32, pad_val=dict(img=(114.0, 114.0, 114.0))),
|
| 38 |
+
dict(type='FilterAnnotations', min_gt_bbox_wh=(1, 1), keep_empty=False),
|
| 39 |
+
dict(type='PackDetInputs')
|
| 40 |
+
]
|
| 41 |
+
|
| 42 |
+
test_pipeline = [
|
| 43 |
+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
|
| 44 |
+
dict(type='Resize', scale=img_scale, keep_ratio=True),
|
| 45 |
+
dict(type='Pad', size_divisor=32, pad_val=dict(img=(114.0, 114.0, 114.0))),
|
| 46 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 47 |
+
dict(
|
| 48 |
+
type='PackDetInputs',
|
| 49 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
| 50 |
+
'scale_factor'))
|
| 51 |
+
]
|
| 52 |
+
|
| 53 |
+
train_dataloader = dict(
|
| 54 |
+
dataset=dict(
|
| 55 |
+
type='MultiImageMixDataset',
|
| 56 |
+
dataset=dict(
|
| 57 |
+
type='ConcatDataset',
|
| 58 |
+
datasets=[
|
| 59 |
+
dict(
|
| 60 |
+
type='CocoDataset',
|
| 61 |
+
data_root=data_root,
|
| 62 |
+
ann_file='annotations/train_cocoformat.json',
|
| 63 |
+
data_prefix=dict(img='train'),
|
| 64 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 65 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 66 |
+
pipeline=[
|
| 67 |
+
dict(
|
| 68 |
+
type='LoadImageFromFile',
|
| 69 |
+
backend_args=_base_.backend_args),
|
| 70 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 71 |
+
]),
|
| 72 |
+
dict(
|
| 73 |
+
type='CocoDataset',
|
| 74 |
+
data_root='data/crowdhuman',
|
| 75 |
+
ann_file='annotations/crowdhuman_train.json',
|
| 76 |
+
data_prefix=dict(img='train'),
|
| 77 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 78 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 79 |
+
pipeline=[
|
| 80 |
+
dict(
|
| 81 |
+
type='LoadImageFromFile',
|
| 82 |
+
backend_args=_base_.backend_args),
|
| 83 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 84 |
+
]),
|
| 85 |
+
dict(
|
| 86 |
+
type='CocoDataset',
|
| 87 |
+
data_root='data/crowdhuman',
|
| 88 |
+
ann_file='annotations/crowdhuman_val.json',
|
| 89 |
+
data_prefix=dict(img='val'),
|
| 90 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 91 |
+
metainfo=dict(classes=('pedestrian', )),
|
| 92 |
+
pipeline=[
|
| 93 |
+
dict(
|
| 94 |
+
type='LoadImageFromFile',
|
| 95 |
+
backend_args=_base_.backend_args),
|
| 96 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 97 |
+
]),
|
| 98 |
+
]),
|
| 99 |
+
pipeline=train_pipeline))
|
| 100 |
+
|
| 101 |
+
val_dataloader = dict(
|
| 102 |
+
dataset=dict(
|
| 103 |
+
data_root='data/MOT17', ann_file='annotations/train_cocoformat.json'))
|
| 104 |
+
test_dataloader = val_dataloader
|
| 105 |
+
|
| 106 |
+
# evaluator
|
| 107 |
+
val_evaluator = dict(ann_file='data/MOT17/annotations/train_cocoformat.json')
|
| 108 |
+
test_evaluator = val_evaluator
|
grounding-dino/mmdetection/configs/swin/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Swin
|
| 2 |
+
|
| 3 |
+
> [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030)
|
| 4 |
+
|
| 5 |
+
<!-- [BACKBONE] -->
|
| 6 |
+
|
| 7 |
+
## Abstract
|
| 8 |
+
|
| 9 |
+
This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone for computer vision. Challenges in adapting Transformer from language to vision arise from differences between the two domains, such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text. To address these differences, we propose a hierarchical Transformer whose representation is computed with Shifted windows. The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping local windows while also allowing for cross-window connection. This hierarchical architecture has the flexibility to model at various scales and has linear computational complexity with respect to image size. These qualities of Swin Transformer make it compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO test-dev) and semantic segmentation (53.5 mIoU on ADE20K val). Its performance surpasses the previous state-of-the-art by a large margin of +2.7 box AP and +2.6 mask AP on COCO, and +3.2 mIoU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones. The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures.
|
| 10 |
+
|
| 11 |
+
<div align=center>
|
| 12 |
+
<img src="https://user-images.githubusercontent.com/40661020/143999551-6a527048-de38-485c-a1b6-3133ffa5bfaa.png"/>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
## Results and Models
|
| 16 |
+
|
| 17 |
+
### Mask R-CNN
|
| 18 |
+
|
| 19 |
+
| Backbone | Pretrain | Lr schd | Multi-scale crop | FP16 | Mem (GB) | Inf time (fps) | box AP | mask AP | Config | Download |
|
| 20 |
+
| :------: | :---------: | :-----: | :--------------: | :--: | :------: | :------------: | :----: | :-----: | :-----------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 21 |
+
| Swin-T | ImageNet-1K | 1x | no | no | 7.6 | | 42.7 | 39.3 | [config](./mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_1x_coco/mask_rcnn_swin-t-p4-w7_fpn_1x_coco_20210902_120937-9d6b7cfa.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_1x_coco/mask_rcnn_swin-t-p4-w7_fpn_1x_coco_20210902_120937.log.json) |
|
| 22 |
+
| Swin-T | ImageNet-1K | 3x | yes | no | 10.2 | | 46.0 | 41.6 | [config](./mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco/mask_rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco_20210906_131725-bacf6f7b.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco/mask_rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco_20210906_131725.log.json) |
|
| 23 |
+
| Swin-T | ImageNet-1K | 3x | yes | yes | 7.8 | | 46.0 | 41.7 | [config](./mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_fp16_ms-crop-3x_coco/mask_rcnn_swin-t-p4-w7_fpn_fp16_ms-crop-3x_coco_20210908_165006-90a4008c.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_fp16_ms-crop-3x_coco/mask_rcnn_swin-t-p4-w7_fpn_fp16_ms-crop-3x_coco_20210908_165006.log.json) |
|
| 24 |
+
| Swin-S | ImageNet-1K | 3x | yes | yes | 11.9 | | 48.2 | 43.2 | [config](./mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-s-p4-w7_fpn_fp16_ms-crop-3x_coco/mask_rcnn_swin-s-p4-w7_fpn_fp16_ms-crop-3x_coco_20210903_104808-b92c91f1.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-s-p4-w7_fpn_fp16_ms-crop-3x_coco/mask_rcnn_swin-s-p4-w7_fpn_fp16_ms-crop-3x_coco_20210903_104808.log.json) |
|
| 25 |
+
|
| 26 |
+
### Notice
|
| 27 |
+
|
| 28 |
+
Please follow the example
|
| 29 |
+
of `retinanet_swin-t-p4-w7_fpn_1x_coco.py` when you want to combine Swin Transformer with
|
| 30 |
+
the one-stage detector. Because there is a layer norm at the outs of Swin Transformer, you must set `start_level` as 0 in FPN, so we have to set the `out_indices` of backbone as `[1,2,3]`.
|
| 31 |
+
|
| 32 |
+
## Citation
|
| 33 |
+
|
| 34 |
+
```latex
|
| 35 |
+
@article{liu2021Swin,
|
| 36 |
+
title={Swin Transformer: Hierarchical Vision Transformer using Shifted Windows},
|
| 37 |
+
author={Liu, Ze and Lin, Yutong and Cao, Yue and Hu, Han and Wei, Yixuan and Zhang, Zheng and Lin, Stephen and Guo, Baining},
|
| 38 |
+
journal={arXiv preprint arXiv:2103.14030},
|
| 39 |
+
year={2021}
|
| 40 |
+
}
|
| 41 |
+
```
|
grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py'
|
| 2 |
+
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_small_patch4_window7_224.pth' # noqa
|
| 3 |
+
model = dict(
|
| 4 |
+
backbone=dict(
|
| 5 |
+
depths=[2, 2, 18, 2],
|
| 6 |
+
init_cfg=dict(type='Pretrained', checkpoint=pretrained)))
|
grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/mask-rcnn_r50_fpn.py',
|
| 3 |
+
'../_base_/datasets/coco_instance.py',
|
| 4 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 5 |
+
]
|
| 6 |
+
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
|
| 7 |
+
model = dict(
|
| 8 |
+
type='MaskRCNN',
|
| 9 |
+
backbone=dict(
|
| 10 |
+
_delete_=True,
|
| 11 |
+
type='SwinTransformer',
|
| 12 |
+
embed_dims=96,
|
| 13 |
+
depths=[2, 2, 6, 2],
|
| 14 |
+
num_heads=[3, 6, 12, 24],
|
| 15 |
+
window_size=7,
|
| 16 |
+
mlp_ratio=4,
|
| 17 |
+
qkv_bias=True,
|
| 18 |
+
qk_scale=None,
|
| 19 |
+
drop_rate=0.,
|
| 20 |
+
attn_drop_rate=0.,
|
| 21 |
+
drop_path_rate=0.2,
|
| 22 |
+
patch_norm=True,
|
| 23 |
+
out_indices=(0, 1, 2, 3),
|
| 24 |
+
with_cp=False,
|
| 25 |
+
convert_weights=True,
|
| 26 |
+
init_cfg=dict(type='Pretrained', checkpoint=pretrained)),
|
| 27 |
+
neck=dict(in_channels=[96, 192, 384, 768]))
|
| 28 |
+
|
| 29 |
+
max_epochs = 12
|
| 30 |
+
train_cfg = dict(max_epochs=max_epochs)
|
| 31 |
+
|
| 32 |
+
# learning rate
|
| 33 |
+
param_scheduler = [
|
| 34 |
+
dict(
|
| 35 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0,
|
| 36 |
+
end=1000),
|
| 37 |
+
dict(
|
| 38 |
+
type='MultiStepLR',
|
| 39 |
+
begin=0,
|
| 40 |
+
end=max_epochs,
|
| 41 |
+
by_epoch=True,
|
| 42 |
+
milestones=[8, 11],
|
| 43 |
+
gamma=0.1)
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
# optimizer
|
| 47 |
+
optim_wrapper = dict(
|
| 48 |
+
type='OptimWrapper',
|
| 49 |
+
paramwise_cfg=dict(
|
| 50 |
+
custom_keys={
|
| 51 |
+
'absolute_pos_embed': dict(decay_mult=0.),
|
| 52 |
+
'relative_position_bias_table': dict(decay_mult=0.),
|
| 53 |
+
'norm': dict(decay_mult=0.)
|
| 54 |
+
}),
|
| 55 |
+
optimizer=dict(
|
| 56 |
+
_delete_=True,
|
| 57 |
+
type='AdamW',
|
| 58 |
+
lr=0.0001,
|
| 59 |
+
betas=(0.9, 0.999),
|
| 60 |
+
weight_decay=0.05))
|
grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py'
|
| 2 |
+
# Enable automatic-mixed-precision training with AmpOptimWrapper.
|
| 3 |
+
optim_wrapper = dict(type='AmpOptimWrapper')
|
grounding-dino/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/mask-rcnn_r50_fpn.py',
|
| 3 |
+
'../_base_/datasets/coco_instance.py',
|
| 4 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 5 |
+
]
|
| 6 |
+
|
| 7 |
+
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
|
| 8 |
+
|
| 9 |
+
model = dict(
|
| 10 |
+
type='MaskRCNN',
|
| 11 |
+
backbone=dict(
|
| 12 |
+
_delete_=True,
|
| 13 |
+
type='SwinTransformer',
|
| 14 |
+
embed_dims=96,
|
| 15 |
+
depths=[2, 2, 6, 2],
|
| 16 |
+
num_heads=[3, 6, 12, 24],
|
| 17 |
+
window_size=7,
|
| 18 |
+
mlp_ratio=4,
|
| 19 |
+
qkv_bias=True,
|
| 20 |
+
qk_scale=None,
|
| 21 |
+
drop_rate=0.,
|
| 22 |
+
attn_drop_rate=0.,
|
| 23 |
+
drop_path_rate=0.2,
|
| 24 |
+
patch_norm=True,
|
| 25 |
+
out_indices=(0, 1, 2, 3),
|
| 26 |
+
with_cp=False,
|
| 27 |
+
convert_weights=True,
|
| 28 |
+
init_cfg=dict(type='Pretrained', checkpoint=pretrained)),
|
| 29 |
+
neck=dict(in_channels=[96, 192, 384, 768]))
|
| 30 |
+
|
| 31 |
+
# augmentation strategy originates from DETR / Sparse RCNN
|
| 32 |
+
train_pipeline = [
|
| 33 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 34 |
+
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
| 35 |
+
dict(type='RandomFlip', prob=0.5),
|
| 36 |
+
dict(
|
| 37 |
+
type='RandomChoice',
|
| 38 |
+
transforms=[[
|
| 39 |
+
dict(
|
| 40 |
+
type='RandomChoiceResize',
|
| 41 |
+
scales=[(480, 1333), (512, 1333), (544, 1333), (576, 1333),
|
| 42 |
+
(608, 1333), (640, 1333), (672, 1333), (704, 1333),
|
| 43 |
+
(736, 1333), (768, 1333), (800, 1333)],
|
| 44 |
+
keep_ratio=True)
|
| 45 |
+
],
|
| 46 |
+
[
|
| 47 |
+
dict(
|
| 48 |
+
type='RandomChoiceResize',
|
| 49 |
+
scales=[(400, 1333), (500, 1333), (600, 1333)],
|
| 50 |
+
keep_ratio=True),
|
| 51 |
+
dict(
|
| 52 |
+
type='RandomCrop',
|
| 53 |
+
crop_type='absolute_range',
|
| 54 |
+
crop_size=(384, 600),
|
| 55 |
+
allow_negative_crop=True),
|
| 56 |
+
dict(
|
| 57 |
+
type='RandomChoiceResize',
|
| 58 |
+
scales=[(480, 1333), (512, 1333), (544, 1333),
|
| 59 |
+
(576, 1333), (608, 1333), (640, 1333),
|
| 60 |
+
(672, 1333), (704, 1333), (736, 1333),
|
| 61 |
+
(768, 1333), (800, 1333)],
|
| 62 |
+
keep_ratio=True)
|
| 63 |
+
]]),
|
| 64 |
+
dict(type='PackDetInputs')
|
| 65 |
+
]
|
| 66 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
| 67 |
+
|
| 68 |
+
max_epochs = 36
|
| 69 |
+
train_cfg = dict(max_epochs=max_epochs)
|
| 70 |
+
|
| 71 |
+
# learning rate
|
| 72 |
+
param_scheduler = [
|
| 73 |
+
dict(
|
| 74 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0,
|
| 75 |
+
end=1000),
|
| 76 |
+
dict(
|
| 77 |
+
type='MultiStepLR',
|
| 78 |
+
begin=0,
|
| 79 |
+
end=max_epochs,
|
| 80 |
+
by_epoch=True,
|
| 81 |
+
milestones=[27, 33],
|
| 82 |
+
gamma=0.1)
|
| 83 |
+
]
|
| 84 |
+
|
| 85 |
+
# optimizer
|
| 86 |
+
optim_wrapper = dict(
|
| 87 |
+
type='OptimWrapper',
|
| 88 |
+
paramwise_cfg=dict(
|
| 89 |
+
custom_keys={
|
| 90 |
+
'absolute_pos_embed': dict(decay_mult=0.),
|
| 91 |
+
'relative_position_bias_table': dict(decay_mult=0.),
|
| 92 |
+
'norm': dict(decay_mult=0.)
|
| 93 |
+
}),
|
| 94 |
+
optimizer=dict(
|
| 95 |
+
_delete_=True,
|
| 96 |
+
type='AdamW',
|
| 97 |
+
lr=0.0001,
|
| 98 |
+
betas=(0.9, 0.999),
|
| 99 |
+
weight_decay=0.05))
|
grounding-dino/mmdetection/configs/swin/metafile.yml
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Models:
|
| 2 |
+
- Name: mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco
|
| 3 |
+
In Collection: Mask R-CNN
|
| 4 |
+
Config: configs/swin/mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco.py
|
| 5 |
+
Metadata:
|
| 6 |
+
Training Memory (GB): 11.9
|
| 7 |
+
Epochs: 36
|
| 8 |
+
Training Data: COCO
|
| 9 |
+
Training Techniques:
|
| 10 |
+
- AdamW
|
| 11 |
+
Training Resources: 8x V100 GPUs
|
| 12 |
+
Architecture:
|
| 13 |
+
- Swin Transformer
|
| 14 |
+
Results:
|
| 15 |
+
- Task: Object Detection
|
| 16 |
+
Dataset: COCO
|
| 17 |
+
Metrics:
|
| 18 |
+
box AP: 48.2
|
| 19 |
+
- Task: Instance Segmentation
|
| 20 |
+
Dataset: COCO
|
| 21 |
+
Metrics:
|
| 22 |
+
mask AP: 43.2
|
| 23 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-s-p4-w7_fpn_fp16_ms-crop-3x_coco/mask_rcnn_swin-s-p4-w7_fpn_fp16_ms-crop-3x_coco_20210903_104808-b92c91f1.pth
|
| 24 |
+
Paper:
|
| 25 |
+
URL: https://arxiv.org/abs/2107.08430
|
| 26 |
+
Title: 'Swin Transformer: Hierarchical Vision Transformer using Shifted Windows'
|
| 27 |
+
README: configs/swin/README.md
|
| 28 |
+
Code:
|
| 29 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.16.0/mmdet/models/backbones/swin.py#L465
|
| 30 |
+
Version: v2.16.0
|
| 31 |
+
|
| 32 |
+
- Name: mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco
|
| 33 |
+
In Collection: Mask R-CNN
|
| 34 |
+
Config: configs/swin/mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py
|
| 35 |
+
Metadata:
|
| 36 |
+
Training Memory (GB): 10.2
|
| 37 |
+
Epochs: 36
|
| 38 |
+
Training Data: COCO
|
| 39 |
+
Training Techniques:
|
| 40 |
+
- AdamW
|
| 41 |
+
Training Resources: 8x V100 GPUs
|
| 42 |
+
Architecture:
|
| 43 |
+
- Swin Transformer
|
| 44 |
+
Results:
|
| 45 |
+
- Task: Object Detection
|
| 46 |
+
Dataset: COCO
|
| 47 |
+
Metrics:
|
| 48 |
+
box AP: 46.0
|
| 49 |
+
- Task: Instance Segmentation
|
| 50 |
+
Dataset: COCO
|
| 51 |
+
Metrics:
|
| 52 |
+
mask AP: 41.6
|
| 53 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco/mask_rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco_20210906_131725-bacf6f7b.pth
|
| 54 |
+
Paper:
|
| 55 |
+
URL: https://arxiv.org/abs/2107.08430
|
| 56 |
+
Title: 'Swin Transformer: Hierarchical Vision Transformer using Shifted Windows'
|
| 57 |
+
README: configs/swin/README.md
|
| 58 |
+
Code:
|
| 59 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.16.0/mmdet/models/backbones/swin.py#L465
|
| 60 |
+
Version: v2.16.0
|
| 61 |
+
|
| 62 |
+
- Name: mask-rcnn_swin-t-p4-w7_fpn_1x_coco
|
| 63 |
+
In Collection: Mask R-CNN
|
| 64 |
+
Config: configs/swin/mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py
|
| 65 |
+
Metadata:
|
| 66 |
+
Training Memory (GB): 7.6
|
| 67 |
+
Epochs: 12
|
| 68 |
+
Training Data: COCO
|
| 69 |
+
Training Techniques:
|
| 70 |
+
- AdamW
|
| 71 |
+
Training Resources: 8x V100 GPUs
|
| 72 |
+
Architecture:
|
| 73 |
+
- Swin Transformer
|
| 74 |
+
Results:
|
| 75 |
+
- Task: Object Detection
|
| 76 |
+
Dataset: COCO
|
| 77 |
+
Metrics:
|
| 78 |
+
box AP: 42.7
|
| 79 |
+
- Task: Instance Segmentation
|
| 80 |
+
Dataset: COCO
|
| 81 |
+
Metrics:
|
| 82 |
+
mask AP: 39.3
|
| 83 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_1x_coco/mask_rcnn_swin-t-p4-w7_fpn_1x_coco_20210902_120937-9d6b7cfa.pth
|
| 84 |
+
Paper:
|
| 85 |
+
URL: https://arxiv.org/abs/2107.08430
|
| 86 |
+
Title: 'Swin Transformer: Hierarchical Vision Transformer using Shifted Windows'
|
| 87 |
+
README: configs/swin/README.md
|
| 88 |
+
Code:
|
| 89 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.16.0/mmdet/models/backbones/swin.py#L465
|
| 90 |
+
Version: v2.16.0
|
| 91 |
+
|
| 92 |
+
- Name: mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco
|
| 93 |
+
In Collection: Mask R-CNN
|
| 94 |
+
Config: configs/swin/mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py
|
| 95 |
+
Metadata:
|
| 96 |
+
Training Memory (GB): 7.8
|
| 97 |
+
Epochs: 36
|
| 98 |
+
Training Data: COCO
|
| 99 |
+
Training Techniques:
|
| 100 |
+
- AdamW
|
| 101 |
+
Training Resources: 8x V100 GPUs
|
| 102 |
+
Architecture:
|
| 103 |
+
- Swin Transformer
|
| 104 |
+
Results:
|
| 105 |
+
- Task: Object Detection
|
| 106 |
+
Dataset: COCO
|
| 107 |
+
Metrics:
|
| 108 |
+
box AP: 46.0
|
| 109 |
+
- Task: Instance Segmentation
|
| 110 |
+
Dataset: COCO
|
| 111 |
+
Metrics:
|
| 112 |
+
mask AP: 41.7
|
| 113 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/swin/mask_rcnn_swin-t-p4-w7_fpn_fp16_ms-crop-3x_coco/mask_rcnn_swin-t-p4-w7_fpn_fp16_ms-crop-3x_coco_20210908_165006-90a4008c.pth
|
| 114 |
+
Paper:
|
| 115 |
+
URL: https://arxiv.org/abs/2107.08430
|
| 116 |
+
Title: 'Swin Transformer: Hierarchical Vision Transformer using Shifted Windows'
|
| 117 |
+
README: configs/swin/README.md
|
| 118 |
+
Code:
|
| 119 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.16.0/mmdet/models/backbones/swin.py#L465
|
| 120 |
+
Version: v2.16.0
|
grounding-dino/mmdetection/configs/swin/retinanet_swin-t-p4-w7_fpn_1x_coco.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/retinanet_r50_fpn.py',
|
| 3 |
+
'../_base_/datasets/coco_detection.py',
|
| 4 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 5 |
+
]
|
| 6 |
+
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
|
| 7 |
+
model = dict(
|
| 8 |
+
backbone=dict(
|
| 9 |
+
_delete_=True,
|
| 10 |
+
type='SwinTransformer',
|
| 11 |
+
embed_dims=96,
|
| 12 |
+
depths=[2, 2, 6, 2],
|
| 13 |
+
num_heads=[3, 6, 12, 24],
|
| 14 |
+
window_size=7,
|
| 15 |
+
mlp_ratio=4,
|
| 16 |
+
qkv_bias=True,
|
| 17 |
+
qk_scale=None,
|
| 18 |
+
drop_rate=0.,
|
| 19 |
+
attn_drop_rate=0.,
|
| 20 |
+
drop_path_rate=0.2,
|
| 21 |
+
patch_norm=True,
|
| 22 |
+
out_indices=(1, 2, 3),
|
| 23 |
+
# Please only add indices that would be used
|
| 24 |
+
# in FPN, otherwise some parameter will not be used
|
| 25 |
+
with_cp=False,
|
| 26 |
+
convert_weights=True,
|
| 27 |
+
init_cfg=dict(type='Pretrained', checkpoint=pretrained)),
|
| 28 |
+
neck=dict(in_channels=[192, 384, 768], start_level=0, num_outs=5))
|
| 29 |
+
|
| 30 |
+
# optimizer
|
| 31 |
+
optim_wrapper = dict(optimizer=dict(lr=0.01))
|
grounding-dino/mmdetection/configs/timm_example/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Timm Example
|
| 2 |
+
|
| 3 |
+
> [PyTorch Image Models](https://github.com/rwightman/pytorch-image-models)
|
| 4 |
+
|
| 5 |
+
<!-- [OTHERS] -->
|
| 6 |
+
|
| 7 |
+
## Abstract
|
| 8 |
+
|
| 9 |
+
Py**T**orch **Im**age **M**odels (`timm`) is a collection of image models, layers, utilities, optimizers, schedulers, data-loaders / augmentations, and reference training / validation scripts that aim to pull together a wide variety of SOTA models with ability to reproduce ImageNet training results.
|
| 10 |
+
|
| 11 |
+
<!--
|
| 12 |
+
<div align=center>
|
| 13 |
+
<img src="" height="400" />
|
| 14 |
+
</div>
|
| 15 |
+
-->
|
| 16 |
+
|
| 17 |
+
## Results and Models
|
| 18 |
+
|
| 19 |
+
### RetinaNet
|
| 20 |
+
|
| 21 |
+
| Backbone | Style | Lr schd | Mem (GB) | Inf time (fps) | box AP | Config | Download |
|
| 22 |
+
| :-------------: | :-----: | :-----: | :------: | :------------: | :----: | :-------------------------------------------------------: | :------: |
|
| 23 |
+
| R-50 | pytorch | 1x | | | | [config](./retinanet_timm-tv-resnet50_fpn_1x_coco.py) | |
|
| 24 |
+
| EfficientNet-B1 | - | 1x | | | | [config](./retinanet_timm-efficientnet-b1_fpn_1x_coco.py) | |
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
|
| 28 |
+
### Install additional requirements
|
| 29 |
+
|
| 30 |
+
MMDetection supports timm backbones via `TIMMBackbone`, a wrapper class in MMPretrain.
|
| 31 |
+
Thus, you need to install `mmpretrain` in addition to timm.
|
| 32 |
+
If you have already installed requirements for mmdet, run
|
| 33 |
+
|
| 34 |
+
```shell
|
| 35 |
+
pip install 'dataclasses; python_version<"3.7"'
|
| 36 |
+
pip install timm
|
| 37 |
+
pip install mmpretrain
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
See [this document](https://mmpretrain.readthedocs.io/en/latest/get_started.html#installation) for the details of MMPretrain installation.
|
| 41 |
+
|
| 42 |
+
### Edit config
|
| 43 |
+
|
| 44 |
+
- See example configs for basic usage.
|
| 45 |
+
- See the documents of [timm feature extraction](https://rwightman.github.io/pytorch-image-models/feature_extraction/#multi-scale-feature-maps-feature-pyramid) and [TIMMBackbone](https://mmpretrain.readthedocs.io/en/latest/api/generated/mmpretrain.models.backbones.TIMMBackbone.html#mmpretrain.models.backbones.TIMMBackbone) for details.
|
| 46 |
+
- Which feature map is output depends on the backbone.
|
| 47 |
+
Please check `backbone out_channels` and `backbone out_strides` in your log, and modify `model.neck.in_channels` and `model.backbone.out_indices` if necessary.
|
| 48 |
+
- If you use Vision Transformer models that do not support `features_only=True`, add `custom_hooks = []` to your config to disable `NumClassCheckHook`.
|
| 49 |
+
|
| 50 |
+
## Citation
|
| 51 |
+
|
| 52 |
+
```latex
|
| 53 |
+
@misc{rw2019timm,
|
| 54 |
+
author = {Ross Wightman},
|
| 55 |
+
title = {PyTorch Image Models},
|
| 56 |
+
year = {2019},
|
| 57 |
+
publisher = {GitHub},
|
| 58 |
+
journal = {GitHub repository},
|
| 59 |
+
doi = {10.5281/zenodo.4414861},
|
| 60 |
+
howpublished = {\url{https://github.com/rwightman/pytorch-image-models}}
|
| 61 |
+
}
|
| 62 |
+
```
|
grounding-dino/mmdetection/configs/timm_example/retinanet_timm-efficientnet-b1_fpn_1x_coco.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/retinanet_r50_fpn.py',
|
| 3 |
+
'../_base_/datasets/coco_detection.py',
|
| 4 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 5 |
+
]
|
| 6 |
+
|
| 7 |
+
# please install mmpretrain
|
| 8 |
+
# import mmpretrain.models to trigger register_module in mmpretrain
|
| 9 |
+
custom_imports = dict(
|
| 10 |
+
imports=['mmpretrain.models'], allow_failed_imports=False)
|
| 11 |
+
|
| 12 |
+
model = dict(
|
| 13 |
+
backbone=dict(
|
| 14 |
+
_delete_=True,
|
| 15 |
+
type='mmpretrain.TIMMBackbone',
|
| 16 |
+
model_name='efficientnet_b1',
|
| 17 |
+
features_only=True,
|
| 18 |
+
pretrained=True,
|
| 19 |
+
out_indices=(1, 2, 3, 4)),
|
| 20 |
+
neck=dict(in_channels=[24, 40, 112, 320]))
|
| 21 |
+
|
| 22 |
+
# optimizer
|
| 23 |
+
optim_wrapper = dict(optimizer=dict(lr=0.01))
|
grounding-dino/mmdetection/configs/timm_example/retinanet_timm-tv-resnet50_fpn_1x_coco.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/models/retinanet_r50_fpn.py',
|
| 3 |
+
'../_base_/datasets/coco_detection.py',
|
| 4 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 5 |
+
]
|
| 6 |
+
|
| 7 |
+
# please install mmpretrain
|
| 8 |
+
# import mmpretrain.models to trigger register_module in mmpretrain
|
| 9 |
+
custom_imports = dict(
|
| 10 |
+
imports=['mmpretrain.models'], allow_failed_imports=False)
|
| 11 |
+
|
| 12 |
+
model = dict(
|
| 13 |
+
backbone=dict(
|
| 14 |
+
_delete_=True,
|
| 15 |
+
type='mmpretrain.TIMMBackbone',
|
| 16 |
+
model_name='tv_resnet50', # ResNet-50 with torchvision weights
|
| 17 |
+
features_only=True,
|
| 18 |
+
pretrained=True,
|
| 19 |
+
out_indices=(1, 2, 3, 4)))
|
| 20 |
+
|
| 21 |
+
# optimizer
|
| 22 |
+
optim_wrapper = dict(optimizer=dict(lr=0.01))
|
grounding-dino/mmdetection/configs/tood/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOOD
|
| 2 |
+
|
| 3 |
+
> [TOOD: Task-aligned One-stage Object Detection](https://arxiv.org/abs/2108.07755)
|
| 4 |
+
|
| 5 |
+
<!-- [ALGORITHM] -->
|
| 6 |
+
|
| 7 |
+
## Abstract
|
| 8 |
+
|
| 9 |
+
One-stage object detection is commonly implemented by optimizing two sub-tasks: object classification and localization, using heads with two parallel branches, which might lead to a certain level of spatial misalignment in predictions between the two tasks. In this work, we propose a Task-aligned One-stage Object Detection (TOOD) that explicitly aligns the two tasks in a learning-based manner. First, we design a novel Task-aligned Head (T-Head) which offers a better balance between learning task-interactive and task-specific features, as well as a greater flexibility to learn the alignment via a task-aligned predictor. Second, we propose Task Alignment Learning (TAL) to explicitly pull closer (or even unify) the optimal anchors for the two tasks during training via a designed sample assignment scheme and a task-aligned loss. Extensive experiments are conducted on MS-COCO, where TOOD achieves a 51.1 AP at single-model single-scale testing. This surpasses the recent one-stage detectors by a large margin, such as ATSS (47.7 AP), GFL (48.2 AP), and PAA (49.0 AP), with fewer parameters and FLOPs. Qualitative results also demonstrate the effectiveness of TOOD for better aligning the tasks of object classification and localization.
|
| 10 |
+
|
| 11 |
+
<div align=center>
|
| 12 |
+
<img src="https://user-images.githubusercontent.com/12907710/145400075-e08191f5-8afa-4335-9b3b-27926fc9a26e.png"/>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
## Results and Models
|
| 16 |
+
|
| 17 |
+
| Backbone | Style | Anchor Type | Lr schd | Multi-scale Training | Mem (GB) | Inf time (fps) | box AP | Config | Download |
|
| 18 |
+
| :---------------: | :-----: | :----------: | :-----: | :------------------: | :------: | :------------: | :----: | :-------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| 19 |
+
| R-50 | pytorch | Anchor-free | 1x | N | 4.1 | | 42.4 | [config](./tood_r50_fpn_1x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_1x_coco/tood_r50_fpn_1x_coco_20211210_103425-20e20746.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_1x_coco/tood_r50_fpn_1x_coco_20211210_103425.log) |
|
| 20 |
+
| R-50 | pytorch | Anchor-based | 1x | N | 4.1 | | 42.4 | [config](./tood_r50_fpn_anchor-based_1x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_anchor_based_1x_coco/tood_r50_fpn_anchor_based_1x_coco_20211214_100105-b776c134.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_anchor_based_1x_coco/tood_r50_fpn_anchor_based_1x_coco_20211214_100105.log) |
|
| 21 |
+
| R-50 | pytorch | Anchor-free | 2x | Y | 4.1 | | 44.5 | [config](./tood_r50_fpn_ms-2x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_mstrain_2x_coco/tood_r50_fpn_mstrain_2x_coco_20211210_144231-3b23174c.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_mstrain_2x_coco/tood_r50_fpn_mstrain_2x_coco_20211210_144231.log) |
|
| 22 |
+
| R-101 | pytorch | Anchor-free | 2x | Y | 6.0 | | 46.1 | [config](./tood_r101_fpn_ms-2x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r101_fpn_mstrain_2x_coco/tood_r101_fpn_mstrain_2x_coco_20211210_144232-a18f53c8.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r101_fpn_mstrain_2x_coco/tood_r101_fpn_mstrain_2x_coco_20211210_144232.log) |
|
| 23 |
+
| R-101-dcnv2 | pytorch | Anchor-free | 2x | Y | 6.2 | | 49.3 | [config](./tood_r101-dconv-c3-c5_fpn_ms-2x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r101_fpn_dconv_c3-c5_mstrain_2x_coco/tood_r101_fpn_dconv_c3-c5_mstrain_2x_coco_20211210_213728-4a824142.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r101_fpn_dconv_c3-c5_mstrain_2x_coco/tood_r101_fpn_dconv_c3-c5_mstrain_2x_coco_20211210_213728.log) |
|
| 24 |
+
| X-101-64x4d | pytorch | Anchor-free | 2x | Y | 10.2 | | 47.6 | [config](./tood_x101-64x4d_fpn_ms-2x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_x101_64x4d_fpn_mstrain_2x_coco/tood_x101_64x4d_fpn_mstrain_2x_coco_20211211_003519-a4f36113.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/tood/tood_x101_64x4d_fpn_mstrain_2x_coco/tood_x101_64x4d_fpn_mstrain_2x_coco_20211211_003519.log) |
|
| 25 |
+
| X-101-64x4d-dcnv2 | pytorch | Anchor-free | 2x | Y | | | | [config](./tood_x101-64x4d-dconv-c4-c5_fpn_ms-2x_coco.py) | [model](<>) \| [log](<>) |
|
| 26 |
+
|
| 27 |
+
\[1\] *1x and 2x mean the model is trained for 90K and 180K iterations, respectively.* \
|
| 28 |
+
\[2\] *All results are obtained with a single model and without any test time data augmentation such as multi-scale, flipping and etc..* \
|
| 29 |
+
\[3\] *`dcnv2` denotes deformable convolutional networks v2.* \\
|
| 30 |
+
|
| 31 |
+
## Citation
|
| 32 |
+
|
| 33 |
+
```latex
|
| 34 |
+
@inproceedings{feng2021tood,
|
| 35 |
+
title={TOOD: Task-aligned One-stage Object Detection},
|
| 36 |
+
author={Feng, Chengjian and Zhong, Yujie and Gao, Yu and Scott, Matthew R and Huang, Weilin},
|
| 37 |
+
booktitle={ICCV},
|
| 38 |
+
year={2021}
|
| 39 |
+
}
|
| 40 |
+
```
|
grounding-dino/mmdetection/configs/tood/metafile.yml
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Collections:
|
| 2 |
+
- Name: TOOD
|
| 3 |
+
Metadata:
|
| 4 |
+
Training Data: COCO
|
| 5 |
+
Training Techniques:
|
| 6 |
+
- SGD
|
| 7 |
+
Training Resources: 8x V100 GPUs
|
| 8 |
+
Architecture:
|
| 9 |
+
- TOOD
|
| 10 |
+
Paper:
|
| 11 |
+
URL: https://arxiv.org/abs/2108.07755
|
| 12 |
+
Title: 'TOOD: Task-aligned One-stage Object Detection'
|
| 13 |
+
README: configs/tood/README.md
|
| 14 |
+
Code:
|
| 15 |
+
URL: https://github.com/open-mmlab/mmdetection/blob/v2.20.0/mmdet/models/detectors/tood.py#L7
|
| 16 |
+
Version: v2.20.0
|
| 17 |
+
|
| 18 |
+
Models:
|
| 19 |
+
- Name: tood_r101_fpn_ms-2x_coco
|
| 20 |
+
In Collection: TOOD
|
| 21 |
+
Config: configs/tood/tood_r101_fpn_ms-2x_coco.py
|
| 22 |
+
Metadata:
|
| 23 |
+
Training Memory (GB): 6.0
|
| 24 |
+
Epochs: 24
|
| 25 |
+
Results:
|
| 26 |
+
- Task: Object Detection
|
| 27 |
+
Dataset: COCO
|
| 28 |
+
Metrics:
|
| 29 |
+
box AP: 46.1
|
| 30 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r101_fpn_mstrain_2x_coco/tood_r101_fpn_mstrain_2x_coco_20211210_144232-a18f53c8.pth
|
| 31 |
+
|
| 32 |
+
- Name: tood_x101-64x4d_fpn_ms-2x_coco
|
| 33 |
+
In Collection: TOOD
|
| 34 |
+
Config: configs/tood/tood_x101-64x4d_fpn_ms-2x_coco.py
|
| 35 |
+
Metadata:
|
| 36 |
+
Training Memory (GB): 10.2
|
| 37 |
+
Epochs: 24
|
| 38 |
+
Results:
|
| 39 |
+
- Task: Object Detection
|
| 40 |
+
Dataset: COCO
|
| 41 |
+
Metrics:
|
| 42 |
+
box AP: 47.6
|
| 43 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/tood/tood_x101_64x4d_fpn_mstrain_2x_coco/tood_x101_64x4d_fpn_mstrain_2x_coco_20211211_003519-a4f36113.pth
|
| 44 |
+
|
| 45 |
+
- Name: tood_r101-dconv-c3-c5_fpn_ms-2x_coco
|
| 46 |
+
In Collection: TOOD
|
| 47 |
+
Config: configs/tood/tood_r101-dconv-c3-c5_fpn_ms-2x_coco.py
|
| 48 |
+
Metadata:
|
| 49 |
+
Training Memory (GB): 6.2
|
| 50 |
+
Epochs: 24
|
| 51 |
+
Results:
|
| 52 |
+
- Task: Object Detection
|
| 53 |
+
Dataset: COCO
|
| 54 |
+
Metrics:
|
| 55 |
+
box AP: 49.3
|
| 56 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r101_fpn_dconv_c3-c5_mstrain_2x_coco/tood_r101_fpn_dconv_c3-c5_mstrain_2x_coco_20211210_213728-4a824142.pth
|
| 57 |
+
|
| 58 |
+
- Name: tood_r50_fpn_anchor-based_1x_coco
|
| 59 |
+
In Collection: TOOD
|
| 60 |
+
Config: configs/tood/tood_r50_fpn_anchor-based_1x_coco.py
|
| 61 |
+
Metadata:
|
| 62 |
+
Training Memory (GB): 4.1
|
| 63 |
+
Epochs: 12
|
| 64 |
+
Results:
|
| 65 |
+
- Task: Object Detection
|
| 66 |
+
Dataset: COCO
|
| 67 |
+
Metrics:
|
| 68 |
+
box AP: 42.4
|
| 69 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_anchor_based_1x_coco/tood_r50_fpn_anchor_based_1x_coco_20211214_100105-b776c134.pth
|
| 70 |
+
|
| 71 |
+
- Name: tood_r50_fpn_1x_coco
|
| 72 |
+
In Collection: TOOD
|
| 73 |
+
Config: configs/tood/tood_r50_fpn_1x_coco.py
|
| 74 |
+
Metadata:
|
| 75 |
+
Training Memory (GB): 4.1
|
| 76 |
+
Epochs: 12
|
| 77 |
+
Results:
|
| 78 |
+
- Task: Object Detection
|
| 79 |
+
Dataset: COCO
|
| 80 |
+
Metrics:
|
| 81 |
+
box AP: 42.4
|
| 82 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_1x_coco/tood_r50_fpn_1x_coco_20211210_103425-20e20746.pth
|
| 83 |
+
|
| 84 |
+
- Name: tood_r50_fpn_ms-2x_coco
|
| 85 |
+
In Collection: TOOD
|
| 86 |
+
Config: configs/tood/tood_r50_fpn_ms-2x_coco.py
|
| 87 |
+
Metadata:
|
| 88 |
+
Training Memory (GB): 4.1
|
| 89 |
+
Epochs: 24
|
| 90 |
+
Results:
|
| 91 |
+
- Task: Object Detection
|
| 92 |
+
Dataset: COCO
|
| 93 |
+
Metrics:
|
| 94 |
+
box AP: 44.5
|
| 95 |
+
Weights: https://download.openmmlab.com/mmdetection/v2.0/tood/tood_r50_fpn_mstrain_2x_coco/tood_r50_fpn_mstrain_2x_coco_20211210_144231-3b23174c.pth
|
grounding-dino/mmdetection/configs/tood/tood_r101-dconv-c3-c5_fpn_ms-2x_coco.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './tood_r101_fpn_ms-2x_coco.py'
|
| 2 |
+
|
| 3 |
+
model = dict(
|
| 4 |
+
backbone=dict(
|
| 5 |
+
dcn=dict(type='DCNv2', deformable_groups=1, fallback_on_stride=False),
|
| 6 |
+
stage_with_dcn=(False, True, True, True)),
|
| 7 |
+
bbox_head=dict(num_dcn=2))
|
grounding-dino/mmdetection/configs/tood/tood_r101_fpn_ms-2x_coco.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './tood_r50_fpn_ms-2x_coco.py'
|
| 2 |
+
|
| 3 |
+
model = dict(
|
| 4 |
+
backbone=dict(
|
| 5 |
+
depth=101,
|
| 6 |
+
init_cfg=dict(type='Pretrained',
|
| 7 |
+
checkpoint='torchvision://resnet101')))
|
grounding-dino/mmdetection/configs/tood/tood_r50_fpn_1x_coco.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = [
|
| 2 |
+
'../_base_/datasets/coco_detection.py',
|
| 3 |
+
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
| 4 |
+
]
|
| 5 |
+
|
| 6 |
+
# model settings
|
| 7 |
+
model = dict(
|
| 8 |
+
type='TOOD',
|
| 9 |
+
data_preprocessor=dict(
|
| 10 |
+
type='DetDataPreprocessor',
|
| 11 |
+
mean=[123.675, 116.28, 103.53],
|
| 12 |
+
std=[58.395, 57.12, 57.375],
|
| 13 |
+
bgr_to_rgb=True,
|
| 14 |
+
pad_size_divisor=32),
|
| 15 |
+
backbone=dict(
|
| 16 |
+
type='ResNet',
|
| 17 |
+
depth=50,
|
| 18 |
+
num_stages=4,
|
| 19 |
+
out_indices=(0, 1, 2, 3),
|
| 20 |
+
frozen_stages=1,
|
| 21 |
+
norm_cfg=dict(type='BN', requires_grad=True),
|
| 22 |
+
norm_eval=True,
|
| 23 |
+
style='pytorch',
|
| 24 |
+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
|
| 25 |
+
neck=dict(
|
| 26 |
+
type='FPN',
|
| 27 |
+
in_channels=[256, 512, 1024, 2048],
|
| 28 |
+
out_channels=256,
|
| 29 |
+
start_level=1,
|
| 30 |
+
add_extra_convs='on_output',
|
| 31 |
+
num_outs=5),
|
| 32 |
+
bbox_head=dict(
|
| 33 |
+
type='TOODHead',
|
| 34 |
+
num_classes=80,
|
| 35 |
+
in_channels=256,
|
| 36 |
+
stacked_convs=6,
|
| 37 |
+
feat_channels=256,
|
| 38 |
+
anchor_type='anchor_free',
|
| 39 |
+
anchor_generator=dict(
|
| 40 |
+
type='AnchorGenerator',
|
| 41 |
+
ratios=[1.0],
|
| 42 |
+
octave_base_scale=8,
|
| 43 |
+
scales_per_octave=1,
|
| 44 |
+
strides=[8, 16, 32, 64, 128]),
|
| 45 |
+
bbox_coder=dict(
|
| 46 |
+
type='DeltaXYWHBBoxCoder',
|
| 47 |
+
target_means=[.0, .0, .0, .0],
|
| 48 |
+
target_stds=[0.1, 0.1, 0.2, 0.2]),
|
| 49 |
+
initial_loss_cls=dict(
|
| 50 |
+
type='FocalLoss',
|
| 51 |
+
use_sigmoid=True,
|
| 52 |
+
activated=True, # use probability instead of logit as input
|
| 53 |
+
gamma=2.0,
|
| 54 |
+
alpha=0.25,
|
| 55 |
+
loss_weight=1.0),
|
| 56 |
+
loss_cls=dict(
|
| 57 |
+
type='QualityFocalLoss',
|
| 58 |
+
use_sigmoid=True,
|
| 59 |
+
activated=True, # use probability instead of logit as input
|
| 60 |
+
beta=2.0,
|
| 61 |
+
loss_weight=1.0),
|
| 62 |
+
loss_bbox=dict(type='GIoULoss', loss_weight=2.0)),
|
| 63 |
+
train_cfg=dict(
|
| 64 |
+
initial_epoch=4,
|
| 65 |
+
initial_assigner=dict(type='ATSSAssigner', topk=9),
|
| 66 |
+
assigner=dict(type='TaskAlignedAssigner', topk=13),
|
| 67 |
+
alpha=1,
|
| 68 |
+
beta=6,
|
| 69 |
+
allowed_border=-1,
|
| 70 |
+
pos_weight=-1,
|
| 71 |
+
debug=False),
|
| 72 |
+
test_cfg=dict(
|
| 73 |
+
nms_pre=1000,
|
| 74 |
+
min_bbox_size=0,
|
| 75 |
+
score_thr=0.05,
|
| 76 |
+
nms=dict(type='nms', iou_threshold=0.6),
|
| 77 |
+
max_per_img=100))
|
| 78 |
+
# optimizer
|
| 79 |
+
optim_wrapper = dict(
|
| 80 |
+
optimizer=dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001))
|
grounding-dino/mmdetection/configs/tood/tood_r50_fpn_anchor-based_1x_coco.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './tood_r50_fpn_1x_coco.py'
|
| 2 |
+
model = dict(bbox_head=dict(anchor_type='anchor_based'))
|
grounding-dino/mmdetection/configs/tood/tood_r50_fpn_ms-2x_coco.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './tood_r50_fpn_1x_coco.py'
|
| 2 |
+
max_epochs = 24
|
| 3 |
+
|
| 4 |
+
# learning rate
|
| 5 |
+
param_scheduler = [
|
| 6 |
+
dict(
|
| 7 |
+
type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
|
| 8 |
+
dict(
|
| 9 |
+
type='MultiStepLR',
|
| 10 |
+
begin=0,
|
| 11 |
+
end=max_epochs,
|
| 12 |
+
by_epoch=True,
|
| 13 |
+
milestones=[16, 22],
|
| 14 |
+
gamma=0.1)
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
# training schedule for 2x
|
| 18 |
+
train_cfg = dict(max_epochs=max_epochs)
|
| 19 |
+
|
| 20 |
+
# multi-scale training
|
| 21 |
+
train_pipeline = [
|
| 22 |
+
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
|
| 23 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 24 |
+
dict(
|
| 25 |
+
type='RandomResize', scale=[(1333, 480), (1333, 800)],
|
| 26 |
+
keep_ratio=True),
|
| 27 |
+
dict(type='RandomFlip', prob=0.5),
|
| 28 |
+
dict(type='PackDetInputs')
|
| 29 |
+
]
|
| 30 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
grounding-dino/mmdetection/configs/tood/tood_x101-64x4d-dconv-c4-c5_fpn_ms-2x_coco.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = './tood_x101-64x4d_fpn_ms-2x_coco.py'
|
| 2 |
+
model = dict(
|
| 3 |
+
backbone=dict(
|
| 4 |
+
dcn=dict(type='DCNv2', deformable_groups=1, fallback_on_stride=False),
|
| 5 |
+
stage_with_dcn=(False, False, True, True),
|
| 6 |
+
),
|
| 7 |
+
bbox_head=dict(num_dcn=2))
|