diff --git a/configs/sniper/README.md b/configs/sniper/README.md index 43dd8491bd2814256ea4131747433bd7edde71a8..cda33e28d04a84044e64d102ff1e808217c7088a 100644 --- a/configs/sniper/README.md +++ b/configs/sniper/README.md @@ -6,8 +6,9 @@ English | [简体中文](README_cn.md) | Sniper | GPU number | images/GPU | Model | Dataset | Schedulers | Box AP | Download | Config | | :---------------- | :-------------------: | :------------------: | :-----: | :-----: | :------------: | :-----: | :-----------------------------------------------------: | :-----: | -| w/o | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 23.3 | [Download Link](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_visdrone.pdparams ) | [Config](https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.3/configs/sniper/faster_rcnn_r50_fpn_1x_sniper_coco.yml) | -| w/ | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 29.7 | [Download Link](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_sniper_visdrone.pdparams) | [Config](https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.3/configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml) | +| w/o | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 23.3 | [Download Link](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_visdrone.pdparams ) | [config](./faster_rcnn_r50_fpn_1x_visdrone.yml) | +| w/ | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 29.7 | [Download Link](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_sniper_visdrone.pdparams) | [config](./faster_rcnn_r50_fpn_1x_sniper_visdrone.yml) | + ### Note > Here, we use VisDrone dataset, and to detect 9 objects including `person, bicycles, car, van, truck, tricyle, awning-tricyle, bus, motor`. @@ -21,18 +22,18 @@ python tools/sniper_params_stats.py FasterRCNN annotations/instances_train2017.j ``` b. optional: trian detector to get negative proposals. ```bash -python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml --save_proposals --proposals_path=./proposals.json &>sniper.log 2>&1 & +python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml --save_proposals --proposals_path=./proposals.json &>sniper.log 2>&1 & ``` c. train models ```bash -python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml --eval &>sniper.log 2>&1 & +python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml --eval &>sniper.log 2>&1 & ``` ### 2. Evaluation Evaluating SNIPER on custom dataset in single GPU with following commands: ```bash # use saved checkpoint in training -CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml -o weights=output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml -o weights=output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final ``` ### 3. Inference @@ -40,10 +41,10 @@ Inference images in single GPU with following commands, use `--infer_img` to inf ```bash # inference single image -CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml -o weights=output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final --infer_img=demo/P0861__1.0__1154___824.png +CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml -o weights=output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final --infer_img=demo/P0861__1.0__1154___824.png # inference all images in the directory -CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml -o weights=output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final --infer_dir=demo +CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml -o weights=output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final --infer_dir=demo ``` ## Citations diff --git a/configs/sniper/README_cn.md b/configs/sniper/README_cn.md index bc13838f3a5ce7642fce8db52efb18a49f64e2ef..ed96600a581480ba4974416ad4aea5fcc1b8dc63 100644 --- a/configs/sniper/README_cn.md +++ b/configs/sniper/README_cn.md @@ -5,8 +5,8 @@ ## 模型库 | 有无sniper | GPU个数 | 每张GPU图片个数 | 骨架网络 | 数据集 | 学习率策略 | Box AP | 模型下载 | 配置文件 | | :---------------- | :-------------------: | :------------------: | :-----: | :-----: | :------------: | :-----: | :-----------------------------------------------------: | :-----: | -| w/o sniper | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 23.3 | [下载链接](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_visdrone.pdparams ) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.3/configs/sniper/faster_rcnn_r50_fpn_1x_sniper_coco.yml) | -| w sniper | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 29.7 | [下载链接](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_sniper_visdrone.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.3/configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml) | +| w/o sniper | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 23.3 | [下载链接](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_visdrone.pdparams ) | [配置文件](./faster_rcnn_r50_fpn_1x_visdrone.yml) | +| w sniper | 4 | 1 | ResNet-r50-FPN | [VisDrone](https://github.com/VisDrone/VisDrone-Dataset) | 1x | 29.7 | [下载链接](https://bj.bcebos.com/v1/paddledet/models/faster_rcnn_r50_fpn_1x_sniper_visdrone.pdparams) | [配置文件](./faster_rcnn_r50_fpn_1x_sniper_visdrone.yml) | ### 注意 @@ -21,18 +21,18 @@ python tools/sniper_params_stats.py FasterRCNN annotations/instances_train2017.j ``` b. 可选:训练检测器,生成负样本 ```bash -python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml --save_proposals --proposals_path=./proposals.json &>sniper.log 2>&1 & +python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml --save_proposals --proposals_path=./proposals.json &>sniper.log 2>&1 & ``` c. 训练模型 ```bash -python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml --eval &>sniper.log 2>&1 & +python -m paddle.distributed.launch --log_dir=./sniper/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml --eval &>sniper.log 2>&1 & ``` ### 2. 评估 使用单GPU通过如下命令一键式评估模型在COCO val2017数据集效果 ```bash # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml -o weights=output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml -o weights=output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final ``` ### 3. 推理 @@ -40,10 +40,10 @@ CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/sniper/faster_rcnn_r50_fp ```bash # 推理单张图像 -CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml -o weights=output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final --infer_img=demo/P0861__1.0__1154___824.png +CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml -o weights=output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final --infer_img=demo/P0861__1.0__1154___824.png # 推理目录下所有图像 -CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml -o weights=output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final --infer_dir=demo +CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml -o weights=output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final --infer_dir=demo ``` ## Citations diff --git a/configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml b/configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml index aaf22e12659ed4928fc6d7941c8b3d966ab0d82f..1b43e4049fbf6a0ab3842cd2931f30a415e0aa57 100644 --- a/configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml +++ b/configs/sniper/faster_rcnn_r50_fpn_1x_sniper_visdrone.yml @@ -5,7 +5,27 @@ _BASE_: [ '../faster_rcnn/_base_/optimizer_1x.yml', '_base_/faster_fpn_reader.yml', ] -weights: output/faster_rcnn_r50_1x_visdrone_coco/model_final +weights: output/faster_rcnn_r50_fpn_1x_sniper_visdrone/model_final find_unused_parameters: true + +metric: COCO +num_classes: 9 + +TrainDataset: + !COCODataSet + image_dir: train + anno_path: annotations/train.json + dataset_dir: dataset/VisDrone2019_coco + data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd'] + +EvalDataset: + !COCODataSet + image_dir: val + anno_path: annotations/val.json + dataset_dir: dataset/VisDrone2019_coco + +TestDataset: + !ImageFolder + anno_path: annotations/val.json diff --git a/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_visdrone.yml b/configs/sniper/faster_rcnn_r50_fpn_1x_visdrone.yml similarity index 89% rename from configs/faster_rcnn/faster_rcnn_r50_fpn_1x_visdrone.yml rename to configs/sniper/faster_rcnn_r50_fpn_1x_visdrone.yml index e6f5abedb57c2bf30af264486889f69c47f36a73..583f403a2cf04be4d0ca29327ff0302715b1f262 100644 --- a/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_visdrone.yml +++ b/configs/sniper/faster_rcnn_r50_fpn_1x_visdrone.yml @@ -5,7 +5,7 @@ _BASE_: [ '_base_/faster_rcnn_r50_fpn.yml', '_base_/faster_fpn_reader.yml', ] -weights: output/faster_rcnn_r50_fpn_1x_coco_visdrone/model_final +weights: output/faster_rcnn_r50_fpn_1x_visdrone/model_final metric: COCO diff --git a/configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml b/configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml deleted file mode 100644 index daebb5154525a4c04d4e42073ba7e2d6140215db..0000000000000000000000000000000000000000 --- a/configs/sniper/faster_rcnn_r50_fpn_2x_sniper_coco.yml +++ /dev/null @@ -1,15 +0,0 @@ -_BASE_: [ - 'faster_rcnn_r50_fpn_1x_sniper_coco.yml', -] -weights: output/faster_rcnn_r50_fpn_2x_sniper_coco/model_final - -epoch: 24 -LearningRate: - base_lr: 0.01 - schedulers: - - !PiecewiseDecay - gamma: 0.1 - milestones: [16, 22] - - !LinearWarmup - start_factor: 0.1 - steps: 1000 diff --git a/configs/sniper/faster_rcnn_r50_vd_1x_coco_sniper.yml b/configs/sniper/faster_rcnn_r50_vd_1x_coco_sniper.yml deleted file mode 100644 index fbf674dc72dfc479bc4fd8a31beed0edb67f4818..0000000000000000000000000000000000000000 --- a/configs/sniper/faster_rcnn_r50_vd_1x_coco_sniper.yml +++ /dev/null @@ -1,19 +0,0 @@ -_BASE_: [ - '../datasets/sniper_coco_detection.yml', - '../runtime.yml', - '../faster_rcnn/_base_/optimizer_1x.yml', - '../faster_rcnn/_base_/faster_rcnn_r50.yml', - '_base_/faster_reader.yml', -] - -pretrain_weights: https://paddledet.bj.bcebos.com/models/faster_rcnn_r50_vd_1x_coco.pdparams -weights: output/faster_rcnn_r50_vd_1x_coco/model_final - -ResNet: - # index 0 stands for res2 - depth: 50 - variant: d - norm_type: bn - freeze_at: 0 - return_idx: [2] - num_stages: 3 diff --git a/configs/sniper/faster_rcnn_r50_vd_fpn_2x_sniper_coco.yml b/configs/sniper/faster_rcnn_r50_vd_fpn_2x_sniper_coco.yml deleted file mode 100644 index 3667319cef8c1e1529d447b01c8d8ba7ca8b4168..0000000000000000000000000000000000000000 --- a/configs/sniper/faster_rcnn_r50_vd_fpn_2x_sniper_coco.yml +++ /dev/null @@ -1,25 +0,0 @@ -_BASE_: [ - 'faster_rcnn_r50_fpn_1x_sniper_coco.yml', -] -pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_pretrained.pdparams -weights: output/faster_rcnn_r50_vd_fpn_2x_sniper_coco/model_final - -ResNet: - # index 0 stands for res2 - depth: 50 - variant: d - norm_type: bn - freeze_at: 0 - return_idx: [0,1,2,3] - num_stages: 4 - -epoch: 24 -LearningRate: - base_lr: 0.01 - schedulers: - - !PiecewiseDecay - gamma: 0.1 - milestones: [16, 22] - - !LinearWarmup - start_factor: 0.1 - steps: 1000 diff --git a/configs/sniper/ppyolo_r50vd_dcn_1x_sniper.yml b/configs/sniper/ppyolo_r50vd_dcn_1x_sniper.yml deleted file mode 100644 index da634b2b1fb4339a4d457cd7d12df8b0fb21af91..0000000000000000000000000000000000000000 --- a/configs/sniper/ppyolo_r50vd_dcn_1x_sniper.yml +++ /dev/null @@ -1,32 +0,0 @@ -_BASE_: [ - '../datasets/sniper_coco_detection.yml', - '../runtime.yml', - '../ppyolo/_base_/ppyolo_r50vd_dcn.yml', - '../ppyolo/_base_/optimizer_1x.yml', - './_base_/ppyolo_reader.yml', -] - -snapshot_epoch: 8 -use_ema: true -weights: output/ppyolo_r50vd_dcn_1x_minicoco/model_final - - -LearningRate: - base_lr: 0.005 - schedulers: - - !PiecewiseDecay - gamma: 0.1 - milestones: - - 153 - - 173 - - !LinearWarmup - start_factor: 0. - steps: 4000 - -OptimizerBuilder: - optimizer: - momentum: 0.9 - type: Momentum - regularizer: - factor: 0.0005 - type: L2 diff --git a/configs/sniper/ppyolo_r50vd_dcn_1x_sniper_visdrone.yml b/configs/sniper/ppyolo_r50vd_dcn_1x_sniper_visdrone.yml index 58cce35056a4de23370f0e2f80ddabf410c262af..215a79388a7a690c96b95a8cafd1852631a29ab7 100644 --- a/configs/sniper/ppyolo_r50vd_dcn_1x_sniper_visdrone.yml +++ b/configs/sniper/ppyolo_r50vd_dcn_1x_sniper_visdrone.yml @@ -8,7 +8,7 @@ _BASE_: [ snapshot_epoch: 8 use_ema: true -weights: output/ppyolo_r50vd_dcn_1x_visdrone/model_final +weights: output/ppyolo_r50vd_dcn_1x_sniper_visdrone/model_final @@ -31,3 +31,26 @@ OptimizerBuilder: regularizer: factor: 0.0005 type: L2 + + + + +metric: COCO +num_classes: 9 + +TrainDataset: + !COCODataSet + image_dir: train + anno_path: annotations/train.json + dataset_dir: dataset/VisDrone2019_coco + data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd'] + +EvalDataset: + !COCODataSet + image_dir: val + anno_path: annotations/val.json + dataset_dir: dataset/VisDrone2019_coco + +TestDataset: + !ImageFolder + anno_path: annotations/val.json diff --git a/configs/ppyolo/ppyolo_r50vd_dcn_1x_visdrone.yml b/configs/sniper/ppyolo_r50vd_dcn_1x_visdrone.yml similarity index 90% rename from configs/ppyolo/ppyolo_r50vd_dcn_1x_visdrone.yml rename to configs/sniper/ppyolo_r50vd_dcn_1x_visdrone.yml index 0f02b35a0c02a6f1f0789a65b8d867a314d89e3d..ea9ca58d6bbe2db1e08ca93bad95ec7e2f4fbca2 100644 --- a/configs/ppyolo/ppyolo_r50vd_dcn_1x_visdrone.yml +++ b/configs/sniper/ppyolo_r50vd_dcn_1x_visdrone.yml @@ -8,7 +8,7 @@ _BASE_: [ snapshot_epoch: 8 use_ema: true -weights: output/ppyolo_r50vd_dcn_1x_visdrone_coco/model_final +weights: output/ppyolo_r50vd_dcn_1x_visdrone/model_final epoch: 192 @@ -51,4 +51,4 @@ EvalDataset: TestDataset: !ImageFolder - anno_path: annotations/val.json \ No newline at end of file + anno_path: annotations/val.json