introduction_cn.ipynb 5.0 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 26
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 模型简介\n",
    "PaddleDetection中提出了全新的轻量级系列模型`PP-PicoDet`,在移动端具有卓越的性能,成为全新SOTA轻量级模型。\n",
    "\n",
    "PP-PicoDet模型有如下特点:\n",
    "\n",
    "- 🌟 更高的mAP: 第一个在1M参数量之内`mAP(0.5:0.95)`超越**30+**(输入416像素时)。\n",
    "- 🚀 更快的预测速度: 网络预测在ARM CPU下可达150FPS。\n",
    "- 😊 部署友好: 支持PaddleLite/MNN/NCNN/OpenVINO等预测库,支持转出ONNX,提供了C++/Python/Android的demo。\n",
    "- 😍 先进的算法: 我们在现有SOTA算法中进行了创新, 包括:ESNet, CSP-PAN, SimOTA等等。\n",
    "\n",
    "关于PP-Picodet的更多细节可以参考我们的[官方文档](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/picodet/README.md)。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. 模型效果\n",
    "PP-Picodet与其他轻量级模型的精度速度对比图如下所示:\n",
    "<div align=\"center\">\n",
27
    "  <img src=\"https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.5/docs/images/picodet_map.png\" width=500 />\n",
W
wangxinxin08 已提交
28 29 30 31 32 33 34 35 36 37 38 39
    "</div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. 模型如何使用\n",
    "首先克隆PaddleDetection,并将数据集存放在`dataset/coco/`目录下面"
   ]
  },
  {
40 41
   "cell_type": "code",
   "execution_count": null,
42
   "metadata": {},
43
   "outputs": [],
W
wangxinxin08 已提交
44
   "source": [
45 46 47 48 49 50 51
    "\n",
    "# 克隆PaddleDetection仓库\n",
    "%mkdir -p ~/work\n",
    "%cd ~/work/\n",
    "!git clone https://github.com/PaddlePaddle/PaddleDetection.git\n",
    "\n",
    "# 安装其他依赖\n",
52
    "%cd PaddleDetection\n",
53
    "%mkdir -p demo_input demo_output\n",
54
    "!pip install -r requirements.txt"
W
wangxinxin08 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1 训练\n",
    "执行以下命令训练PP-Picodet"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
68
   "metadata": {},
W
wangxinxin08 已提交
69 70 71
   "outputs": [],
   "source": [
    "# 单卡训练\n",
72 73 74 75 76 77 78 79 80
    "!CUDA_VISIBLE_DEVICES=0 python tools/train.py -c configs/picodet/picodet_s_320_coco_lcnet.yml --eval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
W
wangxinxin08 已提交
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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
    "# 多卡训练\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": [
    "**注意:** \n",
    "- PicoDet所有模型均由4卡GPU训练得到,如果改变训练GPU卡数,需要按线性比例缩放学习率`base_lr`。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2 部署\n",
    "PP-Picodet支持多种方式部署,具体可以参考[PP-Picodet部署](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/picodet/README.md#%E9%83%A8%E7%BD%B2)。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. 模型原理\n",
    "PP-Picodet的整体结构图如下所示:\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由以下方法组成:\n",
    "- 增强的ShuffleNet-ESNet\n",
    "- CSP-PAN\n",
    "- SimOTA匹配策略\n",
    "\n",
    "更多细节可以参考我们的技术报告:https://arxiv.org/abs/2111.00902"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5. 注意事项\n",
    "**所有的命令默认运行在AI Studio的`jupyter`上, 如果运行在终端上,去掉命令开头的符号%或!**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 6. 相关论文及引用信息\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": {
143 144 145 146 147
  "kernelspec": {
   "display_name": "Python 3.8.13 ('paddle_env')",
   "language": "python",
   "name": "python3"
  },
W
wangxinxin08 已提交
148
  "language_info": {
149 150 151 152 153 154 155 156 157 158
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
W
wangxinxin08 已提交
159
  },
160 161 162 163 164 165
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "864bc28e4d94d9c1c4bd0747e4313c0ab41718ab445ced17dbe1a405af5ecc64"
   }
  }
W
wangxinxin08 已提交
166 167 168 169
 },
 "nbformat": 4,
 "nbformat_minor": 2
}