introduction_en.ipynb 5.6 KB
Notebook
Newer Older
W
wangxinxin08 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Introduction\n",
    "We developed a series of lightweight models, named PP-PicoDet. Because of the excellent performance, our models are very suitable for deployment on mobile or CPU.\n",
    "\n",
    "The PP-PicoDet model has the following characteristics:\n",
    "- 🌟 Higher mAP: the **first** object detectors that surpass mAP(0.5:0.95) **30+** within 1M parameters when the input size is 416.\n",
    "- 🚀 Faster latency: 150FPS on mobile ARM CPU.\n",
    "- 😊 Deploy friendly: support PaddleLite/MNN/NCNN/OpenVINO and provide C++/Python/Android implementation.\n",
    "- 😍 Advanced algorithm: use the most advanced algorithms and offer innovation, such as ESNet, CSP-PAN, SimOTA with VFL, etc.\n",
    "\n",
    "For more details, please refer to [official documentation](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/picodet/README_en.md)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Model Effects\n",
    "The accuracy and speed comparison of PP-Picodet and other lightweight models is shown below:\n",
    "<div align=\"center\">\n",
26
    "  <img src=\"https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.5/docs/images/picodet_map.png\" width=500 />\n",
W
wangxinxin08 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40
    "</div>"
   ]
  },
  {
   "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,
41
   "metadata": {},
W
wangxinxin08 已提交
42 43
   "outputs": [],
   "source": [
44 45 46 47 48 49
    "# clone PaddleDetection\n",
    "%mkdir -p ~/work\n",
    "%cd ~/work/\n",
    "!git clone https://github.com/PaddlePaddle/PaddleDetection.git\n",
    "\n",
    "# Other Dependencies\n",
50
    "%cd PaddleDetection\n",
51
    "%mkdir -p demo_input demo_output\n",
52
    "!pip install -r requirements.txt"
W
wangxinxin08 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1 Training\n",
    "Training PP-Picodet with following command"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
66
   "metadata": {},
W
wangxinxin08 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
   "outputs": [],
   "source": [
    "# training with single GPU\n",
    "!CUDA_VISIBLE_DEVICES=0 python tools/train.py -c configs/picodet/picodet_s_320_coco_lcnet.yml --eval\n",
    "\n",
    "# training with mutiple GPUs\n",
    "!CUDA_VISIBLE_DEVICES=0,1,2,3 python -m paddle.distributed.launch --gpus 0,1,2,3 tools/train.py -c configs/picodet/picodet_s_320_coco_lcnet.yml --eval"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Notes:**\n",
    "- All models of PicoDet are trained by 4 GPUs. If the number of GPUs is changed, the learning rate `base_lr` needs to be scaled linearly."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2 Deployment\n",
W
wangxinxin08 已提交
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    "\n",
    "Run the following command to quickly deploy the model using PaddleInference"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# export the model\n",
    "!python tools/export_model.py -c configs/picodet/picodet_s_320_coco_lcnet.yml -o weights=https://paddledet.bj.bcebos.com/models/picodet_s_320_coco_lcnet.pdparams\n",
    "\n",
    "# inference\n",
    "!wget -P demo_input -N https://paddledet.bj.bcebos.com/modelcenter/images/General/000000014439.jpg\n",
    "!python deploy/python/infer.py --model_dir=output_inference/picodet_s_320_coco_lcnet --image_file=demo_input/000000014439.jpg --device=GPU --output_dir=demo_output"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
W
wangxinxin08 已提交
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    "PP-Picodet supports multiple deployment methods, please refer to [PP-Picodet deployment](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/picodet/README_en.md#deployment) for details."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. Model principle\n",
    "The overall structure of PP-Picodet is shown below:\n",
    "<div align=\"center\">\n",
    "  <img src=\"https://bj.bcebos.com/v1/paddledet/modelcenter/images/PP-Picodet-arch.png\" width=70% />\n",
    "</div>\n",
    "PP-Picodet is composed of following methods:\n",
    "- Enhanced ShuffleNet-ESNet\n",
    "- CSP-PAN\n",
    "- SimOTA label assignment\n",
    "\n",
    "For more details, please refer to our technical report: https://arxiv.org/abs/2111.00902"
   ]
  },
  {
   "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",
    "@article{yu2021pp,\n",
    "  title={PP-PicoDet: A Better Real-Time Object Detector on Mobile Devices},\n",
    "  author={Yu, Guanghua and Chang, Qinyao and Lv, Wenyu and Xu, Chang and Cui, Cheng and Ji, Wei and Dang, Qingqing and Deng, Kaipeng and Wang, Guanzhong and Du, Yuning and others},\n",
    "  journal={arXiv preprint arXiv:2111.00902},\n",
    "  year={2021}\n",
    "}\n",
    "```"
   ]
  }
 ],
 "metadata": {
156 157 158 159 160
  "kernelspec": {
   "display_name": "Python 3.10.6 64-bit",
   "language": "python",
   "name": "python3"
  },
W
wangxinxin08 已提交
161
  "language_info": {
162 163
   "name": "python",
   "version": "3.10.6"
W
wangxinxin08 已提交
164
  },
165 166 167 168 169 170
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
   }
  }
W
wangxinxin08 已提交
171 172 173 174
 },
 "nbformat": 4,
 "nbformat_minor": 2
}