{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. 模型简介\n", "[PP-YOLO](https://arxiv.org/abs/2007.12099)是PaddleDetection优化和改进的YOLOv3的模型,其精度(COCO数据集mAP)和推理速度均优于[YOLOv4](https://arxiv.org/abs/2004.10934)模型。关于PP-YOLO的更多细节可以参考[官方文档](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/ppyolo/README_cn.md)。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. 模型效果\n", "PP-YOLO在[COCO](http://cocodataset.org) test-dev2017数据集上精度达到45.9%,在单卡V100上FP32推理速度为72.9 FPS, V100上开启TensorRT下FP16推理速度为155.6 FPS。\n", "\n", "
\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. 模型如何使用\n", "首先克隆PaddleDetection,并将数据集存放在`dataset/coco/`目录下面" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "%cd ~/work\n", "!git clone https://gitee.com/paddlepaddle/PaddleDetection\n", "%cd PaddleDetection\n", "!pip install -r requirements.txt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1 训练\n", "使用8GPU通过如下命令一键式启动训练(以下命令均默认在PaddleDetection根目录运行), 通过`--eval`参数开启训练中交替评估。" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "!python -m paddle.distributed.launch --log_dir=./ppyolo_dygraph/ --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2 推理部署\n", "PP-YOLO模型部署及推理benchmark需要通过`tools/export_model.py`导出模型后使用Paddle预测库进行部署和推理,可通过如下命令一键式启动。" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "# 导出模型,默认存储于output/ppyolo目录\n", "!python tools/export_model.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams\n", "\n", "# 预测库推理\n", "!CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/ppyolo_r50vd_dcn_1x_coco --image_file=demo/000000014439_640x640.jpg --device=GPU" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. 模型原理\n", "PP-YOLO的整体结构图如下图所示:\n", "
\n", " \n", "
\n", "\n", "PP-YOLO从如下方面优化和提升YOLOv3模型的精度和速度:\n", "\n", "- 更优的骨干网络: ResNet50vd-DCN\n", "- 更大的训练batch size: 8 GPUs,每GPU batch_size=24,对应调整学习率和迭代轮数\n", "- [Drop Block](https://arxiv.org/abs/1810.12890)\n", "- [Exponential Moving Average](https://www.investopedia.com/terms/e/ema.asp)\n", "- [IoU Loss](https://arxiv.org/pdf/1902.09630.pdf)\n", "- [Grid Sensitive](https://arxiv.org/abs/2004.10934)\n", "- [Matrix NMS](https://arxiv.org/pdf/2003.10152.pdf)\n", "- [CoordConv](https://arxiv.org/abs/1807.03247)\n", "- [Spatial Pyramid Pooling](https://arxiv.org/abs/1406.4729)\n", "\n", "更多细节可以参考我们的技术报告:https://arxiv.org/abs/2007.12099" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. 注意事项\n", "**所有的命令默认运行在AI Studio的`jupyter`上, 如果运行在终端上,去掉命令开头的符号%或!**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. 相关论文及引用信息\n", "```\n", "@misc{long2020ppyolo,\n", "title={PP-YOLO: An Effective and Efficient Implementation of Object Detector},\n", "author={Xiang Long and Kaipeng Deng and Guanzhong Wang and Yang Zhang and Qingqing Dang and Yuan Gao and Hui Shen and Jianguo Ren and Shumin Han and Errui Ding and Shilei Wen},\n", "year={2020},\n", "eprint={2007.12099},\n", "archivePrefix={arXiv},\n", "primaryClass={cs.CV}\n", "}\n", "```" ] } ], "metadata": { "language_info": { "name": "python" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }