diff --git a/configs/picodet/README.md b/configs/picodet/README.md index 9b6f5919460c94eb201e004bb03766844f997222..aa8f2f8b0a905a6bd4dbfa8fa5accd0ee67920e4 100644 --- a/configs/picodet/README.md +++ b/configs/picodet/README.md @@ -271,6 +271,8 @@ python tools/post_quant.py -c configs/picodet/picodet_s_320_coco.yml \ - **Pedestrian detection:** model zoo of `PicoDet-S-Pedestrian` please refer to [PP-TinyPose](https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.3/configs/keypoint/tiny_pose#%E8%A1%8C%E4%BA%BA%E6%A3%80%E6%B5%8B%E6%A8%A1%E5%9E%8B) +- **Mainbody detection:** model zoo of `PicoDet-L-Mainbody` please refer to [mainbody detection](./application/mainbody_detection/README.md) + ## FAQ
diff --git a/configs/picodet/_base_/optimizer_100e.yml b/configs/picodet/_base_/optimizer_100e.yml new file mode 100644 index 0000000000000000000000000000000000000000..8adda6a64f2854a6cc158da247178291af5cca1c --- /dev/null +++ b/configs/picodet/_base_/optimizer_100e.yml @@ -0,0 +1,18 @@ +epoch: 100 + +LearningRate: + base_lr: 0.4 + schedulers: + - !CosineDecay + max_epochs: 100 + - !LinearWarmup + start_factor: 0.1 + steps: 300 + +OptimizerBuilder: + optimizer: + momentum: 0.9 + type: Momentum + regularizer: + factor: 0.00004 + type: L2 diff --git a/configs/picodet/application/mainbody_detection/README.md b/configs/picodet/application/mainbody_detection/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d6d10cca1931cf008c2df2103fecffeae8b5b49c --- /dev/null +++ b/configs/picodet/application/mainbody_detection/README.md @@ -0,0 +1,39 @@ +# 更多应用 + + +## 1. 主体检测任务 + +主体检测技术是目前应用非常广泛的一种检测技术,它指的是检测出图片中一个或者多个主体的坐标位置,然后将图像中的对应区域裁剪下来,进行识别,从而完成整个识别过程。主体检测是识别任务的前序步骤,可以有效提升识别精度。 + +主体检测是图像识别的前序步骤,被用于PaddleClas的PP-ShiTu图像识别系统中。PP-ShiTu中使用的主体检测模型基于PP-PicoDet。更多关于PP-ShiTu的介绍与使用可以参考:[PP-ShiTu](https://github.com/PaddlePaddle/PaddleClas)。 + + +### 1.1 数据集 + +PP-ShiTu图像识别任务中,训练主体检测模型时主要用到了以下几个数据集。 + +| 数据集 | 数据量 | 主体检测任务中使用的数据量 | 场景 | 数据集地址 | +| :------------: | :-------------: | :-------: | :-------: | :--------: | +| Objects365 | 170W | 6k | 通用场景 | [地址](https://www.objects365.org/overview.html) | +| COCO2017 | 12W | 5k | 通用场景 | [地址](https://cocodataset.org/) | +| iCartoonFace | 2k | 2k | 动漫人脸检测 | [地址](https://github.com/luxiangju-PersonAI/iCartoonFace) | +| LogoDet-3k | 3k | 2k | Logo检测 | [地址](https://github.com/Wangjing1551/LogoDet-3K-Dataset) | +| RPC | 3k | 3k | 商品检测 | [地址](https://rpc-dataset.github.io/) | + +在实际训练的过程中,将所有数据集混合在一起。由于是主体检测,这里将所有标注出的检测框对应的类别都修改为 `前景` 的类别,最终融合的数据集中只包含 1 个类别,即前景,数据集定义配置可以参考[mainbody_detection.yml](./mainbody_detection.yml)。 + + +### 1.2 模型库 + +| 模型 | 图像输入尺寸 | mAPval
0.5:0.95 | mAPval
0.5 | 下载地址 | config | +| :-------- | :--------: | :---------------------: | :----------------: | :----------------: | :---------------: | +| PicoDet-LCNet_x2_5 | 640*640 | 41.5 | 62.0 | [trained model](https://paddledet.bj.bcebos.com/models/picodet_lcnet_x2_5_640_mainbody.pdparams) | [inference model](https://paddledet.bj.bcebos.com/models/picodet_lcnet_x2_5_640_mainbody_infer.tar) | [log](https://paddledet.bj.bcebos.com/logs/train_picodet_lcnet_x2_5_640_mainbody.log) | [config](./picodet_lcnet_2_5x_640_mainbody.yml) | + +### 1.3 快速体验 + +```shell +python tools/infer.py -c configs/picodet/application/mainbody_detection/picodet_lcnet_x2_5_640_mainbody.yml \ + -o weights=https://paddledet.bj.bcebos.com/models/picodet_lcnet_x2_5_640_mainbody.pdparams +``` + +- 注意:测试时TestDataset中的anno_path需要指定json标注文件,可视化的类别标签才正确。 diff --git a/configs/picodet/application/mainbody_detection/picodet_lcnet_x2_5_640_mainbody.yml b/configs/picodet/application/mainbody_detection/picodet_lcnet_x2_5_640_mainbody.yml new file mode 100644 index 0000000000000000000000000000000000000000..a839373a4f9a356042270953a5e7023581dcf09c --- /dev/null +++ b/configs/picodet/application/mainbody_detection/picodet_lcnet_x2_5_640_mainbody.yml @@ -0,0 +1,42 @@ +_BASE_: [ + '../../../runtime.yml', + '../../_base_/picodet_esnet.yml', + '../../_base_/optimizer_100e.yml', + '../../_base_/picodet_640_reader.yml', +] + +pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/LCNet_x2_5_ssld_pretrained.pdparams +weights: output/picodet_lcnet_x2_5_640_mainbody/model_final +find_unused_parameters: True +use_ema: true +cycle_epoch: 20 +snapshot_epoch: 2 + +PicoDet: + backbone: LCNet + neck: CSPPAN + head: PicoHead + +LCNet: + scale: 2.5 + feature_maps: [3, 4, 5] + +metric: COCO +num_classes: 1 + +TrainDataset: + !COCODataSet + image_dir: ./ + anno_path: train.json + dataset_dir: dataset/mainbody/ + data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd'] + +EvalDataset: + !COCODataSet + image_dir: ./ + anno_path: val.json + dataset_dir: dataset/mainbody/ + +TestDataset: + !ImageFolder + anno_path: ./dataset/mainbody/val.json