{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Introduction\n", "[PP-YOLO](https://arxiv.org/abs/2007.12099) is a optimized model based on YOLOv3 in PaddleDetection,whose performance(mAP on COCO) and inference spped are better than [YOLOv4](https://arxiv.org/abs/2004.10934). For more details, refer to [official documentation](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/ppyolo/README.md)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Model Effects\n", "PP-YOLO reached mmAP(IoU=0.5:0.95) as 45.9% on COCO test-dev2017 dataset, and inference speed of FP32 on single V100 is 72.9 FPS, inference speed of FP16 with TensorRT on single V100 is 155.6 FPS.\n", "\n", "
\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. How to use the model\n", "Clone PaddleDetection firstly and put the COCO-style dataset in `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" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1 Training\n", "Training PP-YOLO on 8 GPUs with following command(all commands should be run under PaddleDetection dygraph directory as default)" ] }, { "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 &>ppyolo_dygraph.log 2>&1 &" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2 Inference\n", "For inference deployment or benchmark, model exported with `tools/export_model.py` should be used and perform inference with Paddle inference library with following commands:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "# export model, model will be save in output/ppyolo as default\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", "# inference with Paddle Inference library\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. Model principle\n", "The overall archtecture of PP-YOLO is shown as follows:\n", "
\n", " \n", "
\n", "\n", "PP-YOLO improved performance and speed of YOLOv3 with following methods:\n", "\n", "- Better backbone: ResNet50vd-DCN\n", "- Larger training batch size: 8 GPUs and mini-batch size as 24 on each GPU\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", "For more details, please refer to our technical report:https://arxiv.org/abs/2007.12099" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Attention\n", "**All commands run on AI Studio's `jupyter` by default. If running on a terminal, remove the % or ! at the beginning of the command.**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Related papers and citations\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 }