更换文档检测模型
This commit is contained in:
50
paddle_detection/test_tipc/docs/benchmark_train.md
Normal file
50
paddle_detection/test_tipc/docs/benchmark_train.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# TIPC Linux端Benchmark测试文档
|
||||
|
||||
该文档为Benchmark测试说明,Benchmark预测功能测试的主程序为`benchmark_train.sh`,用于验证监控模型训练的性能。
|
||||
|
||||
# 1. 测试流程
|
||||
## 1.1 准备数据和环境安装
|
||||
运行`test_tipc/prepare.sh`,完成训练数据准备和安装环境流程。
|
||||
|
||||
```shell
|
||||
# 运行格式:bash test_tipc/prepare.sh train_benchmark.txt mode
|
||||
bash test_tipc/prepare.sh test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt benchmark_train
|
||||
```
|
||||
|
||||
## 1.2 功能测试
|
||||
执行`test_tipc/benchmark_train.sh`,完成模型训练和日志解析
|
||||
|
||||
```shell
|
||||
# 运行格式:bash test_tipc/benchmark_train.sh train_benchmark.txt mode
|
||||
bash test_tipc/benchmark_train.sh test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt benchmark_train
|
||||
```
|
||||
|
||||
`test_tipc/benchmark_train.sh`支持根据传入的第三个参数实现只运行某一个训练配置,如下:
|
||||
```shell
|
||||
# 运行格式:bash test_tipc/benchmark_train.sh train_benchmark.txt mode
|
||||
bash test_tipc/benchmark_train.sh test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt benchmark_train dynamic_bs2_fp32_DP_N1C1
|
||||
```
|
||||
dynamic_bs2_fp32_DP_N1C1为test_tipc/benchmark_train.sh传入的参数,格式如下:
|
||||
`${modeltype}_${batch_size}_${fp_item}_${run_mode}_${device_num}`
|
||||
包含的信息有:模型类型、batchsize大小、训练精度如fp32,fp16等、分布式运行模式以及分布式训练使用的机器信息如单机单卡(N1C1)。
|
||||
|
||||
|
||||
## 2. 日志输出
|
||||
|
||||
运行后将保存模型的训练日志和解析日志,使用 `test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt` 参数文件的训练日志解析结果是:
|
||||
|
||||
```
|
||||
{"model_branch": "tipc_fuse_benchmark", "model_commit": "4cce901d231f7954468045cf96302505bd6be495", "model_name": "faster_rcnn_r50_fpn_1x_coco_bs2_fp32_SingleP_DP", "batch_size": 2, "fp_item": "fp32", "run_process_type": "SingleP", "run_mode": "DP", "convergence_value": "0.556966", "convergence_key": "loss:", "ips": 4.857, "speed_unit": "images/s", "device_num": "N1C1", "model_run_time": "590", "frame_commit": "6b0c57cf65945e97d87a8fba89c0a2fc18dd8544", "frame_version": "0.0.0"}
|
||||
```
|
||||
|
||||
训练日志和日志解析结果保存在benchmark_log目录下,文件组织格式如下:
|
||||
```
|
||||
train_log/
|
||||
├── index
|
||||
│ └── PaddleDetection_faster_rcnn_r50_fpn_1x_coco_bs2_fp32_SingleP_DP_N1C1_speed
|
||||
├── profiling_log
|
||||
│ └── PaddleDetection_faster_rcnn_r50_fpn_1x_coco_bs2_fp32_SingleP_DP_N1C1_profiling
|
||||
└── train_log
|
||||
├── PaddleDetection_faster_rcnn_r50_fpn_1x_coco_bs2_fp32_SingleP_DP_N1C1_log
|
||||
└── PaddleDetection_faster_rcnn_r50_fpn_1x_coco_bs2_fp32_MultiP_DP_N1C4_log
|
||||
```
|
||||
BIN
paddle_detection/test_tipc/docs/guide.png
Normal file
BIN
paddle_detection/test_tipc/docs/guide.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 138 KiB |
149
paddle_detection/test_tipc/docs/install.md
Normal file
149
paddle_detection/test_tipc/docs/install.md
Normal file
@@ -0,0 +1,149 @@
|
||||
## 1. 环境准备
|
||||
|
||||
本教程适用于test_tipc目录下基础功能测试的运行环境搭建。
|
||||
|
||||
推荐环境:
|
||||
- CUDA 10.1/10.2
|
||||
- CUDNN 7.6/cudnn8.1
|
||||
- TensorRT 6.1.0.5 / 7.1 / 7.2
|
||||
|
||||
环境配置可以选择docker镜像安装,或者在本地环境Python搭建环境。推荐使用docker镜像安装,避免不必要的环境配置。
|
||||
|
||||
## 2. Docker 镜像安装
|
||||
|
||||
推荐docker镜像安装,按照如下命令创建镜像,当前目录映射到镜像中的`/paddle`目录下
|
||||
```
|
||||
# 启动docker镜像
|
||||
nvidia-docker run --name paddle -it -v $PWD:/paddle paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7-gcc82-dev /bin/bash
|
||||
cd /paddle
|
||||
```
|
||||
|
||||
```
|
||||
# 编译安装Paddle
|
||||
git clone https://github.com/PaddlePaddle/Paddle.git
|
||||
cd Paddle
|
||||
mkdir build && cd build
|
||||
cmake .. \
|
||||
-DWITH_MKL=ON \
|
||||
-DWITH_MKLDNN=ON \
|
||||
-DWITH_GPU=ON \
|
||||
-DWITH_DISTRIBUTE=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCUDA_ARCH_NAME=Auto \
|
||||
-DPY_VERSION=3.7 \
|
||||
-DON_INFER=ON \
|
||||
-DWITH_TENSORRT=ON \
|
||||
-DTENSORRT_ROOT=/usr/local/TensorRT6-cuda10.1-cudnn7
|
||||
make -j 20
|
||||
pip3.7 install python/dist/paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl
|
||||
cd ../../
|
||||
```
|
||||
or
|
||||
```
|
||||
# 下载安装Paddle-2.2
|
||||
wget https://paddle-inference-lib.bj.bcebos.com/2.2.0/python/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddlepaddle_gpu-2.2.0.post101-cp37-cp37m-linux_x86_64.whl
|
||||
pip3.7 install paddlepaddle_gpu-2.2.0.post101-cp37-cp37m-linux_x86_64.whl
|
||||
# 下载C++预测库用于C++ inference
|
||||
wget https://paddle-inference-lib.bj.bcebos.com/2.2.0/cxx_c/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddle_inference.tgz
|
||||
tar -xvf paddle_inference.tgz
|
||||
export PADDLE_DIR=/paddle/paddle_inference
|
||||
```
|
||||
|
||||
## 3 Python 环境构建
|
||||
|
||||
如果您已经通过docker方式构建环境,跳过该部分内容。非docker环境下,环境配置比较灵活,推荐环境组合配置:
|
||||
- CUDA10.1 + CUDNN7.6 + TensorRT 6
|
||||
- CUDA10.2 + CUDNN8.1 + TensorRT 7
|
||||
- CUDA11.1 + CUDNN8.1 + TensorRT 7
|
||||
|
||||
下面以 CUDA10.2 + CUDNN8.1 + TensorRT 7 配置为例,介绍环境配置的流程。
|
||||
|
||||
### 3.1 安装CUDNN
|
||||
|
||||
如果当前环境满足CUDNN版本的要求,可以跳过此步骤。
|
||||
|
||||
以CUDNN8.1 安装安装为例,安装步骤如下,首先下载CUDNN,从[Nvidia官网](https://developer.nvidia.com/rdp/cudnn-archive)下载CUDNN8.1版本,下载符合当前系统版本的三个deb文件,分别是:
|
||||
- cuDNN Runtime Library ,如:libcudnn8_8.1.0.77-1+cuda10.2_amd64.deb
|
||||
- cuDNN Developer Library ,如:libcudnn8-dev_8.1.0.77-1+cuda10.2_amd64.deb
|
||||
- cuDNN Code Samples,如:libcudnn8-samples_8.1.0.77-1+cuda10.2_amd64.deb
|
||||
|
||||
deb安装可以参考[官方文档](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-deb),安装方式如下
|
||||
```
|
||||
# x.x.x表示下载的版本号
|
||||
# $HOME为工作目录
|
||||
sudo dpkg -i libcudnn8_x.x.x-1+cudax.x_arm64.deb
|
||||
sudo dpkg -i libcudnn8-dev_8.x.x.x-1+cudax.x_arm64.deb
|
||||
sudo dpkg -i libcudnn8-samples_8.x.x.x-1+cudax.x_arm64.deb
|
||||
|
||||
# 验证是否正确安装
|
||||
cp -r /usr/src/cudnn_samples_v8/ $HOME
|
||||
cd $HOME/cudnn_samples_v8/mnistCUDNN
|
||||
|
||||
# 编译
|
||||
make clean && make
|
||||
./mnistCUDNN
|
||||
```
|
||||
如果运行mnistCUDNN完后提示运行成功,则表示安装成功。如果运行后出现freeimage相关的报错,需要按照提示安装freeimage库:
|
||||
```
|
||||
sudo apt-get install libfreeimage-dev
|
||||
sudo apt-get install libfreeimage
|
||||
```
|
||||
|
||||
### 3.2 安装TensorRT
|
||||
|
||||
首先,从[Nvidia官网TensorRT板块](https://developer.nvidia.com/tensorrt-getting-started)下载TensorRT,这里选择7.1.3.4版本的TensorRT,注意选择适合自己系统版本和CUDA版本的TensorRT,另外建议下载TAR package的安装包。
|
||||
|
||||
以Ubuntu16.04+CUDA10.2为例,下载并解压后可以参考[官方文档](https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-713/install-guide/index.html#installing-tar)的安装步骤,按照如下步骤安装:
|
||||
```
|
||||
# 以下安装命令中 '${version}' 为下载的TensorRT版本,如7.1.3.4
|
||||
# 设置环境变量,<TensorRT-${version}/lib> 为解压后的TensorRT的lib目录
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<TensorRT-${version}/lib>
|
||||
|
||||
# 安装TensorRT
|
||||
cd TensorRT-${version}/python
|
||||
pip3.7 install tensorrt-*-cp3x-none-linux_x86_64.whl
|
||||
|
||||
# 安装graphsurgeon
|
||||
cd TensorRT-${version}/graphsurgeon
|
||||
```
|
||||
|
||||
|
||||
### 3.3 安装PaddlePaddle
|
||||
|
||||
下载支持TensorRT版本的Paddle安装包,注意安装包的TensorRT版本需要与本地TensorRT一致,下载[链接](https://paddleinference.paddlepaddle.org.cn/master/user_guides/download_lib.html#python)
|
||||
选择下载 linux-cuda10.2-trt7-gcc8.2 Python3.7版本的Paddle:
|
||||
```
|
||||
# 从下载链接中可以看到是paddle2.1.1-cuda10.2-cudnn8.1版本
|
||||
wget https://paddle-wheel.bj.bcebos.com/with-trt/2.1.1-gpu-cuda10.2-cudnn8.1-mkl-gcc8.2/paddlepaddle_gpu-2.1.1-cp37-cp37m-linux_x86_64.whl
|
||||
pip3.7 install -U paddlepaddle_gpu-2.1.1-cp37-cp37m-linux_x86_64.whl
|
||||
```
|
||||
|
||||
## 4. 安装PaddleDetection依赖
|
||||
```
|
||||
# 安装AutoLog
|
||||
git clone https://github.com/LDOUBLEV/AutoLog
|
||||
cd AutoLog
|
||||
pip3.7 install -r requirements.txt
|
||||
python3.7 setup.py bdist_wheel
|
||||
pip3.7 install ./dist/auto_log-1.0.0-py3-none-any.whl
|
||||
|
||||
# 下载PaddleDetection代码
|
||||
cd ../
|
||||
git clone https://github.com/PaddlePaddle/PaddleDetection
|
||||
```
|
||||
|
||||
安装PaddleDetection依赖:
|
||||
```
|
||||
cd PaddleDetection
|
||||
pip3.7 install -r ./requirements.txt
|
||||
```
|
||||
|
||||
## FAQ :
|
||||
Q. You are using Paddle compiled with TensorRT, but TensorRT dynamic library is not found. Ignore this if TensorRT is not needed.
|
||||
|
||||
A. 问题一般是当前安装paddle版本带TRT,但是本地环境找不到TensorRT的预测库,需要下载TensorRT库,解压后设置环境变量LD_LIBRARY_PATH;
|
||||
如:
|
||||
```
|
||||
export LD_LIBRARY_PATH=/usr/local/python3.7.0/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/paddle/package/TensorRT-6.0.1.5/lib
|
||||
```
|
||||
或者问题是下载的TensorRT版本和当前paddle中编译的TRT版本不匹配,需要下载版本相符的TensorRT重新安装。
|
||||
73
paddle_detection/test_tipc/docs/more_models.md
Normal file
73
paddle_detection/test_tipc/docs/more_models.md
Normal file
@@ -0,0 +1,73 @@
|
||||
## 汇总信息
|
||||
|
||||
已填写的部分表示可以使用本工具进行一键测试,未填写的表示正在支持中。
|
||||
|
||||
**字段说明:**
|
||||
- 基础训练预测:包括模型训练、Paddle Inference Python预测。
|
||||
- 更多训练方式:包括多机多卡、混合精度。
|
||||
- 模型压缩:包括裁剪、离线/在线量化、蒸馏。
|
||||
- 其他预测部署:包括Paddle Inference C++预测、Paddle Serving部署、Paddle-Lite部署等。
|
||||
|
||||
| 算法论文 | 模型名称 | 模型类型 | 基础<br>训练预测 | 更多<br>训练方式 | 模型压缩 | 其他预测部署 |
|
||||
| :--- |:----------------------------------------------------------------------------------------------------------------------| :----: | :--------: | :---- | :---- | :---- |
|
||||
| [YOLOv3](https://arxiv.org/abs/1804.02767) | [yolov3_darknet53_270e_coco](../../configs/yolov3/yolov3_darknet53_270e_coco.yml) | 目标检测 | 支持 | 混合精度 | FPGM裁剪 <br> PACT量化 <br> 离线量化 | Paddle Inference: C++ |
|
||||
| YOLOv3 | [yolov3_mobilenet_v1_270e_coco](../../configs/yolov3/yolov3_mobilenet_v1_270e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| YOLOv3 | [yolov3_mobilenet_v3_large_270e_coco](../../configs/yolov3/yolov3_mobilenet_v3_large_270e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| YOLOv3 | [yolov3_r34_270e_coco](../../configs/yolov3/yolov3_r34_270e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| YOLOv3 | [yolov3_r50vd_dcn_270e_coco](../../configs/yolov3/yolov3_r50vd_dcn_270e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [PPYOLO](https://arxiv.org/abs/2007.12099) | [ppyolo_mbv3_large_coco](../../configs/ppyolo/ppyolo_mbv3_large_coco.yml) | 目标检测 | 支持 | 混合精度 | FPGM裁剪 <br> PACT量化 <br> 离线量化 | Paddle Inference: C++ |
|
||||
| PPYOLO | [ppyolo_r50vd_dcn_1x_coco](../../configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | FPGM裁剪 <br> PACT量化 <br> 离线量化 | Paddle Inference: C++ |
|
||||
| PPYOLO | [ppyolo_mbv3_small_coco](../../configs/ppyolo/ppyolo_mbv3_small_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PPYOLO | [ppyolo_r18vd_coco](../../configs/ppyolo/ppyolo_r18vd_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PPYOLO-tiny | [ppyolo_tiny_650e_coco](../../configs/ppyolo/ppyolo_tiny_650e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [PPYOLOv2](https://arxiv.org/abs/2104.10419) | [ppyolov2_r50vd_dcn_365e_coco](../../configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco.yml) | 目标检测 | 支持 | 多机多卡 <br> 混合精度 | | Paddle Inference: C++ |
|
||||
| PPYOLOv2 | [ppyolov2_r50vd_dcn_365e_coco](../../configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PPYOLOv2 | [ppyolov2_r101vd_dcn_365e_coco](../../configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [PP-PicoDet](https://arxiv.org/abs/2111.00902) | picodet_s_320_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PP-PicoDet | picodet_m_416_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PP-PicoDet | picodet_l_640_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PP-PicoDet | picodet_lcnet_1_5x_416_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PP-PicoDet | picodet_mobilenetv3_large_1x_416_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PP-PicoDet | picodet_r18_640_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| PP-PicoDet | picodet_shufflenetv2_1x_416_coco | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [SSD](https://arxiv.org/abs/1512.02325) | [ssdlite_mobilenet_v1_300_coco](../../configs/ssd/ssdlite_mobilenet_v1_300_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [Faster R-CNN](https://arxiv.org/abs/1506.01497) | [faster_rcnn_r50_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r34_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_r34_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r34_vd_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_r34_vd_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r50_1x_coco](../../configs/faster_rcnn/faster_rcnn_r50_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r50_vd_1x_coco](../../configs/faster_rcnn/faster_rcnn_r50_vd_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r50_vd_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_r50_vd_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r101_1x_coco](../../configs/faster_rcnn/faster_rcnn_r101_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r101_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_r101_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_r101_vd_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_r101_vd_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_x101_vd_64x4d_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_x101_vd_64x4d_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Faster R-CNN | [faster_rcnn_swin_tiny_fpn_1x_coco](../../configs/faster_rcnn/faster_rcnn_swin_tiny_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [Cascade Faster R-CNN](https://arxiv.org/abs/1712.00726) | [cascade_rcnn_r50_fpn_1x_coco](../../configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Cascade Faster R-CNN | [cascade_rcnn_r50_vd_fpn_ssld_1x_coco](../../configs/cascade_rcnn/cascade_rcnn_r50_vd_fpn_ssld_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [FCOS](https://arxiv.org/abs/1904.01355) | [fcos_r50_fpn_1x_coco](../../configs/fcos/fcos_r50_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| FCOS | [fcos_dcn_r50_fpn_1x_coco](../../configs/fcos/fcos_dcn_r50_fpn_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [TTFNet](https://arxiv.org/abs/1909.00700) | [ttfnet_darknet53_1x_coco](../../configs/ttfnet/ttfnet_darknet53_1x_coco.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [S2ANet](https://arxiv.org/abs/2008.09397) | [s2anet_conv_2x_dota](../../configs/dota/s2anet_conv_2x_dota.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| S2ANet | [s2anet_1x_spine](../../configs/dota/s2anet_1x_spine.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| S2ANet | [s2anet_alignconv_2x_dota](../../configs/dota/s2anet_alignconv_2x_dota.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [BlazeFace](https://arxiv.org/abs/1907.05047) | [blazeface_1000e](../../configs/face_detection/blazeface_1000e.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| BlazeFace | [blazeface_fpn_ssh_1000e](../../configs/face_detection/blazeface_fpn_ssh_1000e.yml) | 目标检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [Mask R-CNN](https://arxiv.org/abs/1703.06870) | [mask_rcnn_r50_fpn_1x_coco](../../configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Mask R-CNN | [mask_rcnn_r50_1x_coco](../../configs/mask_rcnn/mask_rcnn_r50_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Mask R-CNN | [mask_rcnn_r50_vd_fpn_1x_coco](../../configs/mask_rcnn/mask_rcnn_r50_vd_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Mask R-CNN | [mask_rcnn_r101_fpn_1x_coco](../../configs/mask_rcnn/mask_rcnn_r101_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Mask R-CNN | [mask_rcnn_r101_vd_fpn_1x_coco](../../configs/mask_rcnn/mask_rcnn_r101_vd_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Mask R-CNN | [mask_rcnn_x101_vd_64x4d_fpn_1x_coco](../../configs/mask_rcnn/mask_rcnn_x101_vd_64x4d_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [Cascade Mask R-CNN](https://arxiv.org/abs/1906.09756) | [cascade_mask_rcnn_r50_fpn_1x_coco](../../configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| Cascade Mask R-CNN | [cascade_mask_rcnn_r50_vd_fpn_ssld_1x_coco](../../configs/cascade_rcnn/cascade_mask_rcnn_r50_vd_fpn_ssld_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [SOLOv2](https://arxiv.org/abs/2003.10152) | [solov2_r50_fpn_1x_coco](../../configs/solov2/solov2_r50_fpn_1x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| SOLOv2 | [solov2_r50_enhance_coco](../../configs/solov2/solov2_r50_enhance_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| SOLOv2 | [solov2_r101_vd_fpn_3x_coco](../../configs/solov2/solov2_r101_vd_fpn_3x_coco.yml) | 实例分割 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [PP-Tinypose] | [tinypose_128x96](../../configs/keypoint/tiny_pose/tinypose_128x96.yml) | 关键点检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [HRNet](https://arxiv.org/abs/1902.09212) | [hrnet_w32_256x192](../../configs/keypoint/hrnet/hrnet_w32_256x192.yml) | 关键点检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| HRNet | [dark_hrnet_w32_256x192](../../configs/keypoint/hrnet/dark_hrnet_w32_256x192.yml) | 关键点检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| HRNet | [dark_hrnet_w48_256x192](../../configs/keypoint/hrnet/dark_hrnet_w48_256x192.yml) | 关键点检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [HigherHRNet](https://arxiv.org/abs/1908.10357) | [higherhrnet_hrnet_w32_512](../../configs/keypoint/higherhrnet/higherhrnet_hrnet_w32_512.yml) | 关键点检测 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [FairMot](https://arxiv.org/abs/2004.01888) | [fairmot_dla34_30e_576x320](../../configs/mot/fairmot/fairmot_dla34_30e_576x320.yml) | 目标跟踪 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| FairMot | [fairmot_hrnetv2_w18_dlafpn_30e_576x320](../../configs/mot/fairmot/fairmot_hrnetv2_w18_dlafpn_30e_576x320.yml) | 目标跟踪 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
| [JDE](https://arxiv.org/abs/1909.12605) | [jde_darknet53_30e_576x320](../../configs/mot/jde/jde_darknet53_30e_576x320.yml) | 目标跟踪 | 支持 | 混合精度 | | Paddle Inference: C++ |
|
||||
BIN
paddle_detection/test_tipc/docs/test.png
Normal file
BIN
paddle_detection/test_tipc/docs/test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 224 KiB |
99
paddle_detection/test_tipc/docs/test_inference_cpp.md
Normal file
99
paddle_detection/test_tipc/docs/test_inference_cpp.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# C++预测功能测试
|
||||
|
||||
C++预测功能测试的主程序为`test_inference_cpp.sh`,可以测试基于C++预测库的模型推理功能。
|
||||
|
||||
## 1. 测试结论汇总
|
||||
|
||||
基于训练是否使用量化,进行本测试的模型可以分为`正常模型`和`量化模型`,这两类模型对应的C++预测功能汇总如下:
|
||||
|
||||
| 模型类型 |device | batchsize | tensorrt | mkldnn | cpu多线程 |
|
||||
| ---- | ---- | ---- | :----: | :----: | :----: |
|
||||
| 正常模型 | GPU | 1/8 | fp32/fp16 | - | - |
|
||||
| 正常模型 | CPU | 1/8 | - | fp32 | 支持 |
|
||||
| 量化模型 | GPU | 1/8 | int8 | - | - |
|
||||
| 量化模型 | CPU | 1/8 | - | int8 | 支持 |
|
||||
|
||||
## 2. 测试流程
|
||||
运行环境配置请参考[文档](./install.md)的内容配置TIPC的运行环境。
|
||||
```
|
||||
# 请设置paddle_inference环境变量,如:
|
||||
export PADDLE_INFER_DIR=/path/to/paddle_inference
|
||||
# 若不设置paddle_inference环境变量,也可通过指定参数的方式使脚本自动下载paddle_inference.tgz,如:
|
||||
bash test_tipc/test_inference_cpp.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt 'https://paddle-inference-lib.bj.bcebos.com/2.3.0/cxx_c/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddle_inference.tgz'
|
||||
|
||||
# 若未使用docker镜像: paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7-gcc82-dev
|
||||
# 请设置TensorRT环境变量,如:
|
||||
export TENSORRT_ROOT=/usr/local/TensorRT6-cuda10.1-cudnn7
|
||||
```
|
||||
|
||||
### 2.1 功能测试
|
||||
先运行`prepare.sh`准备数据和模型,然后运行`test_inference_cpp.sh`进行测试,最终在```test_tipc/output```目录下生成`cpp_infer_*.log`后缀的日志文件。
|
||||
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt "cpp_infer"
|
||||
# 用法1:
|
||||
bash test_tipc/test_inference_cpp.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt
|
||||
# 用法2: 指定下载paddle_inference.tgz链接,第二个传入参数为下载链接
|
||||
bash test_tipc/test_inference_cpp.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt 'https://paddle-inference-lib.bj.bcebos.com/2.3.0/cxx_c/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddle_inference.tgz'
|
||||
# 用法3: 同时指定下载paddle_inference.tgz链接和指定GPU卡预测,第三个传入参数为GPU卡号
|
||||
bash test_tipc/test_inference_cpp.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt 'https://paddle-inference-lib.bj.bcebos.com/2.3.0/cxx_c/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddle_inference.tgz' '1'
|
||||
```
|
||||
|
||||
运行预测指令后,在`test_tipc/output`文件夹下自动会保存运行日志,包括以下文件:
|
||||
|
||||
```shell
|
||||
test_tipc/output/
|
||||
|- results_cpp.log # 运行指令状态的日志
|
||||
|- cpp_infer_cpu_usemkldnn_False_threads_1_precision_fluid_batchsize_1.log # CPU上不开启Mkldnn,线程数设置为1,测试batch_size=1条件下的预测运行日志
|
||||
|- cpp_infer_cpu_usemkldnn_False_threads_6_precision_fluid_batchsize_1.log # CPU上不开启Mkldnn,线程数设置为6,测试batch_size=1条件下的预测运行日志
|
||||
|- cpp_infer_gpu_precision_fluid_batchsize_1.log # GPU上不开启TensorRT,测试batch_size=1的fp32精度预测日志
|
||||
|- cpp_infer_gpu_precision_trt_fp16_batchsize_1.log # GPU上开启TensorRT,测试batch_size=1的fp16精度预测日志
|
||||
......
|
||||
```
|
||||
其中results_cpp.log中包含了每条指令的运行状态,如果运行成功会输出:
|
||||
|
||||
```
|
||||
Run successfully with command - python3.7 tools/export_model.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams filename=yolov3_darknet53_270e_coco --output_dir=./output_inference !
|
||||
Run successfully with command - ./deploy/cpp/build/main --device=gpu --run_mode=fluid --model_dir=./output_inference/yolov3_darknet53_270e_coco --batch_size=8 --image_dir=./dataset/coco/test2017/ --run_benchmark=True > ./test_tipc/output/cpp_infer_gpu_precision_fluid_batchsize_8.log 2>&1 !
|
||||
......
|
||||
```
|
||||
如果运行失败,会输出:
|
||||
```
|
||||
Run failed with command - python3.7 tools/export_model.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams filename=yolov3_darknet53_270e_coco --output_dir=./output_inference !
|
||||
Run failed with command - ./deploy/cpp/build/main --device=gpu --run_mode=fluid --model_dir=./output_inference/yolov3_darknet53_270e_coco --batch_size=8 --image_dir=./dataset/coco/test2017/ --run_benchmark=True > ./test_tipc/output/cpp_infer_gpu_precision_fluid_batchsize_8.log 2>&1 !
|
||||
......
|
||||
```
|
||||
可以很方便的根据results_cpp.log中的内容判定哪一个指令运行错误。
|
||||
|
||||
|
||||
### 2.2 精度测试
|
||||
|
||||
使用compare_results.py脚本比较模型预测的结果是否符合预期,主要步骤包括:
|
||||
- 提取日志中的预测坐标;
|
||||
- 从本地文件中提取保存好的坐标结果;
|
||||
- 比较上述两个结果是否符合精度预期,误差大于设置阈值时会报错。
|
||||
|
||||
#### 使用方式
|
||||
运行命令:
|
||||
```shell
|
||||
python3.7 test_tipc/compare_results.py --gt_file=./test_tipc/results/cpp_*.txt --log_file=./test_tipc/output/cpp_*.log --atol=1e-3 --rtol=1e-3
|
||||
```
|
||||
|
||||
参数介绍:
|
||||
- gt_file: 指向事先保存好的预测结果路径,支持*.txt 结尾,会自动索引*.txt格式的文件,文件默认保存在test_tipc/result/ 文件夹下
|
||||
- log_file: 指向运行test_tipc/test_inference_cpp.sh 脚本的infer模式保存的预测日志,预测日志中打印的有预测结果,比如:文本框,预测文本,类别等等,同样支持cpp_infer_*.log格式传入
|
||||
- atol: 设置的绝对误差
|
||||
- rtol: 设置的相对误差
|
||||
|
||||
#### 运行结果
|
||||
|
||||
正常运行效果如下图:
|
||||
<img src="compare_cpp_right.png" width="1000">
|
||||
|
||||
出现不一致结果时的运行输出:
|
||||
<img src="compare_cpp_wrong.png" width="1000">
|
||||
|
||||
|
||||
## 3. 更多教程
|
||||
|
||||
本文档为功能测试用,更详细的c++预测使用教程请参考:[C++预测](../../deploy/cpp/README.md)
|
||||
47
paddle_detection/test_tipc/docs/test_paddle2onnx.md
Normal file
47
paddle_detection/test_tipc/docs/test_paddle2onnx.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Paddle2onnx预测功能测试
|
||||
|
||||
PaddleServing预测功能测试的主程序为`test_paddle2onnx.sh`,可以测试Paddle2ONNX的模型转化功能,并验证正确性。
|
||||
|
||||
## 1. 测试结论汇总
|
||||
|
||||
基于训练是否使用量化,进行本测试的模型可以分为`正常模型`和`量化模型`,这两类模型对应的Paddle2ONNX预测功能汇总如下:
|
||||
|
||||
| 模型类型 |device |
|
||||
| ---- | ---- |
|
||||
| 正常模型 | GPU |
|
||||
| 正常模型 | CPU |
|
||||
| 量化模型 | GPU |
|
||||
| 量化模型 | CPU |
|
||||
|
||||
## 2. 测试流程
|
||||
### 2.1 功能测试
|
||||
先运行`prepare.sh`准备数据和模型,然后运行`test_paddle2onnx.sh`进行测试,最终在```test_tipc/output```目录下生成`paddle2onnx_infer_*.log`后缀的日志文件。
|
||||
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt "paddle2onnx_infer"
|
||||
|
||||
# 用法:
|
||||
bash test_tipc/test_paddle2onnx.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
|
||||
```
|
||||
|
||||
#### 运行结果
|
||||
|
||||
各测试的运行情况会打印在 `test_tipc/output/results_paddle2onnx.log` 中:
|
||||
运行成功时会输出:
|
||||
|
||||
```
|
||||
Run successfully with command - yolov3_darknet53_270e_coco - paddle2onnx --model_dir=./output_inference/yolov3_darknet53_270e_coco --model_filename=model.pdmodel --params_filename=model.pdiparams --save_file=./output_inference/yolov3_darknet53_270e_coco/model.onnx --opset_version=11 --enable_onnx_checker=True !
|
||||
Run successfully with command - yolov3_darknet53_270e_coco - python3.7 ./deploy/third_engine/onnx/infer.py --infer_cfg=./output_inference/yolov3_darknet53_270e_coco/infer_cfg.yml --onnx_file=./output_inference/yolov3_darknet53_270e_coco/model.onnx --image_file=./demo/000000014439.jpg > ./test_tipc/output/paddle2onnx_infer_cpu.log 2>&1 !
|
||||
```
|
||||
|
||||
运行失败时会输出:
|
||||
|
||||
```
|
||||
Run failed with command - yolov3_darknet53_270e_coco - paddle2onnx --model_dir=./output_inference/yolov3_darknet53_270e_coco --model_filename=model.pdmodel --params_filename=model.pdiparams --save_file=./output_inference/yolov3_darknet53_270e_coco/model.onnx --opset_version=11 --enable_onnx_checker=True !
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## 3. 更多教程
|
||||
|
||||
本文档为功能测试用,更详细的Paddle2onnx预测使用教程请参考:[Paddle2ONNX](https://github.com/PaddlePaddle/Paddle2ONNX)
|
||||
44
paddle_detection/test_tipc/docs/test_ptq_inference_python.md
Normal file
44
paddle_detection/test_tipc/docs/test_ptq_inference_python.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Linux GPU/CPU 离线量化功能测试
|
||||
|
||||
Linux GPU/CPU 离线量化功能测试的主程序为`test_ptq_inference_python.sh`,可以测试基于Python的离线量化功能。
|
||||
|
||||
## 1. 测试结论汇总
|
||||
|
||||
| 模型类型 |device | batchsize | tensorrt | mkldnn | cpu多线程 |
|
||||
| ---- | ---- |-----------| :----: | :----: | :----: |
|
||||
| 量化模型 | GPU | 1/2 | int8 | - | - |
|
||||
| 量化模型 | CPU | 1/2 | - | int8 | 支持 |
|
||||
|
||||
## 2. 测试流程
|
||||
### 2.1 功能测试
|
||||
先运行`prepare.sh`准备数据和模型,然后运行`test_ptq_inference_python.sh`进行测试,最终在```test_tipc/output```目录下生成`python_infer_*.log`后缀的日志文件。
|
||||
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_ptq_infer_python.txt "whole_infer"
|
||||
|
||||
# 用法:
|
||||
bash test_tipc/test_ptq_inference_python.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_ptq_infer_python.txt
|
||||
```
|
||||
|
||||
#### 运行结果
|
||||
|
||||
各测试的运行情况会打印在 `test_tipc/output/results_ptq_python.log` 中:
|
||||
运行成功时会输出:
|
||||
|
||||
```
|
||||
Run successfully with command - yolov3_darknet53_270e_coco - python3.7 tools/post_quant.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams filename=yolov3_darknet53_270e_coco --output_dir=./output_inference !
|
||||
Run successfully with command - yolov3_darknet53_270e_coco - python3.7 ./deploy/python/infer.py --device=gpu --run_mode=paddle --model_dir=./output_inference/yolov3_darknet53_270e_coco --batch_size=2 --image_dir=./dataset/coco/test2017/ --run_benchmark=False > ./test_tipc/output/yolov3_darknet53_270e_coco/whole_infer/python_infer_gpu_mode_paddle_batchsize_2.log 2>&1 !
|
||||
...
|
||||
```
|
||||
|
||||
运行失败时会输出:
|
||||
|
||||
```
|
||||
Run failed with command - yolov3_darknet53_270e_coco - python3.7 tools/post_quant.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams filename=yolov3_darknet53_270e_coco --output_dir=./output_inference!
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## 3. 更多教程
|
||||
|
||||
本文档为功能测试用,更详细的离线量化功能使用教程请参考:[Paddle 离线量化官网教程](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/docs/zh_cn/api_cn/static/quant/quantization_api.rst#quant_post_static)
|
||||
91
paddle_detection/test_tipc/docs/test_serving.md
Normal file
91
paddle_detection/test_tipc/docs/test_serving.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# PaddleServing预测功能测试
|
||||
|
||||
PaddleServing预测功能测试的主程序为`test_serving_infer_python.sh`和`test_serving_infer_cpp.sh`,可以测试基于PaddleServing的部署功能。
|
||||
|
||||
## 1. 测试结论汇总
|
||||
|
||||
基于训练是否使用量化,进行本测试的模型可以分为`正常模型`和`量化模型`,这两类模型对应的Serving预测功能汇总如下:
|
||||
|
||||
| 模型类型 |device | batchsize | tensorrt | mkldnn | cpu多线程 |
|
||||
| ---- | ---- |-----------| :----: | :----: | :----: |
|
||||
| 正常模型 | GPU | 1/2 | fp32/fp16 | - | - |
|
||||
| 正常模型 | CPU | 1/2 | - | fp32 | 支持 |
|
||||
| 量化模型 | GPU | 1/2 | int8 | - | - |
|
||||
| 量化模型 | CPU | 1/2 | - | int8 | 支持 |
|
||||
|
||||
## 2. 测试流程
|
||||
运行环境配置请参考[文档](./install.md)的内容配置TIPC的运行环境。
|
||||
|
||||
### 2.1 功能测试
|
||||
**python serving**
|
||||
先运行`prepare.sh`准备数据和模型,然后运行`test_serving_infer_python.sh`进行测试,最终在```test_tipc/output```目录下生成`serving_infer_python*.log`后缀的日志文件。
|
||||
|
||||
```shell
|
||||
bash test_tipc/prepare.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt "serving_infer"
|
||||
|
||||
# 用法1:
|
||||
bash test_tipc/test_serving_infer_python.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt
|
||||
# 用法2: 指定GPU卡预测,第二个传入参数为GPU卡号
|
||||
bash test_tipc/test_serving_infer_python.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt "1"
|
||||
```
|
||||
**cpp serving**
|
||||
先运行`prepare.sh`准备数据和模型,然后运行`test_serving_infer_cpp.sh`进行测试,最终在```test_tipc/output```目录下生成`serving_infer_cpp*.log`后缀的日志文件。
|
||||
|
||||
```shell
|
||||
bash test_tipc/prepare.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_serving_cpp_linux_gpu_cpu.txt "serving_infer"
|
||||
|
||||
# 用法:
|
||||
bash test_tipc/test_serving_infer_cpp.sh test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_model_linux_gpu_normal_normal_serving_cpp_linux_gpu_cpu.txt
|
||||
```
|
||||
|
||||
#### 运行结果
|
||||
|
||||
各测试的运行情况会打印在 `test_tipc/output/results_serving.log` 中:
|
||||
运行成功时会输出:
|
||||
|
||||
```
|
||||
Run successfully with command - python3.7 pipeline_http_client.py --image_dir=../../doc/imgs > ../../tests/output/server_infer_cpu_usemkldnn_True_threads_1_batchsize_1.log 2>&1 !
|
||||
Run successfully with command - xxxxx
|
||||
...
|
||||
```
|
||||
|
||||
运行失败时会输出:
|
||||
|
||||
```
|
||||
Run failed with command - python3.7 pipeline_http_client.py --image_dir=../../doc/imgs > ../../tests/output/server_infer_cpu_usemkldnn_True_threads_1_batchsize_1.log 2>&1 !
|
||||
Run failed with command - python3.7 pipeline_http_client.py --image_dir=../../doc/imgs > ../../tests/output/server_infer_cpu_usemkldnn_True_threads_6_batchsize_1.log 2>&1 !
|
||||
Run failed with command - xxxxx
|
||||
...
|
||||
```
|
||||
|
||||
详细的预测结果会存在 test_tipc/output/ 文件夹下,例如`server_infer_gpu_usetrt_True_precision_fp32_batchsize_1.log`中会返回检测框的坐标:
|
||||
|
||||
```
|
||||
{'err_no': 0, 'err_msg': '', 'key': ['dt_boxes'], 'value': ['[[[ 78. 642.]\n [409. 640.]\n [409. 657.]\n
|
||||
[ 78. 659.]]\n\n [[ 75. 614.]\n [211. 614.]\n [211. 635.]\n [ 75. 635.]]\n\n
|
||||
[[103. 554.]\n [135. 554.]\n [135. 575.]\n [103. 575.]]\n\n [[ 75. 531.]\n
|
||||
[347. 531.]\n [347. 549.]\n [ 75. 549.] ]\n\n [[ 76. 503.]\n [309. 498.]\n
|
||||
[309. 521.]\n [ 76. 526.]]\n\n [[163. 462.]\n [317. 462.]\n [317. 493.]\n
|
||||
[163. 493.]]\n\n [[324. 431.]\n [414. 431.]\n [414. 452.]\n [324. 452.]]\n\n
|
||||
[[ 76. 412.]\n [208. 408.]\n [209. 424.]\n [ 76. 428.]]\n\n [[307. 409.]\n
|
||||
[428. 409.]\n [428. 426.]\n [307 . 426.]]\n\n [[ 74. 385.]\n [217. 382.]\n
|
||||
[217. 400.]\n [ 74. 403.]]\n\n [[308. 381.]\n [427. 380.]\n [427. 400.]\n
|
||||
[308. 401.]]\n\n [[ 74. 363.]\n [195. 362.]\n [195. 378.]\n [ 74. 379.]]\n\n
|
||||
[[303. 359.]\n [423. 357.]\n [423. 375.]\n [303. 377.]]\n\n [[ 70. 336.]\n
|
||||
[239. 334.]\n [239. 354.]\ n [ 70. 356.]]\n\n [[ 70. 312.]\n [204. 310.]\n
|
||||
[204. 327.]\n [ 70. 330.]]\n\n [[303. 308.]\n [419. 306.]\n [419. 326.]\n
|
||||
[303. 328.]]\n\n [[113. 2 72.]\n [246. 270.]\n [247. 299.]\n [113. 301.]]\n\n
|
||||
[[361. 269.]\n [384. 269.]\n [384. 296.]\n [361. 296.]]\n\n [[ 70. 250.]\n
|
||||
[243. 246.]\n [243. 265.]\n [ 70. 269.]]\n\n [[ 65. 221.]\n [187. 220.]\n
|
||||
[187. 240.]\n [ 65. 241.]]\n\n [[337. 216.]\n [382. 216.]\n [382. 240.]\n
|
||||
[337. 240.]]\n\n [ [ 65. 196.]\n [247. 193.]\n [247. 213.]\n [ 65. 216.]]\n\n
|
||||
[[296. 197.]\n [423. 191.]\n [424. 209.]\n [296. 215.]]\n\n [[ 65. 167.]\n [244. 167.]\n
|
||||
[244. 186.]\n [ 65. 186.]]\n\n [[ 67. 139.]\n [290. 139.]\n [290. 159.]\n [ 67. 159.]]\n\n
|
||||
[[ 68. 113.]\n [410. 113.]\n [410. 128.]\n [ 68. 129.] ]\n\n [[277. 87.]\n [416. 87.]\n
|
||||
[416. 108.]\n [277. 108.]]\n\n [[ 79. 28.]\n [132. 28.]\n [132. 62.]\n [ 79. 62.]]\n\n
|
||||
[[163. 17.]\n [410. 14.]\n [410. 50.]\n [163. 53.]]]']}
|
||||
```
|
||||
|
||||
## 3. 更多教程
|
||||
|
||||
本文档为功能测试用,更详细的Serving预测使用教程请参考:[PaddleDetection 服务化部署](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/deploy/serving)
|
||||
@@ -0,0 +1,76 @@
|
||||
# Linux GPU/CPU 多机多卡训练推理测试
|
||||
|
||||
Linux GPU/CPU 多机多卡训练推理测试的主程序为`test_train_fleet_inference_python.sh`,可以测试基于Python的模型训练、评估、推理等基本功能。
|
||||
|
||||
## 1. 测试结论汇总
|
||||
|
||||
- 训练相关:
|
||||
|
||||
| 算法名称 | 模型名称 | 多机多卡 |
|
||||
|:--------:| :----: | :----: |
|
||||
| PP-YOLOE | ppyoloe_crn_s_300e_coco | 分布式训练 |
|
||||
|
||||
|
||||
- 推理相关:
|
||||
|
||||
| 算法名称 | 模型名称 | device_CPU | device_GPU | batchsize |
|
||||
|:--------:|:------------------------:| :----: | :----: |:---------:|
|
||||
| PP-YOLOE | ppyoloe_crn_s_300e_coco | 支持 | 支持 | 1, 2 |
|
||||
|
||||
|
||||
## 2. 测试流程
|
||||
|
||||
运行环境配置请参考[文档](./install.md)的内容配置TIPC的运行环境。
|
||||
|
||||
### 2.1 功能测试
|
||||
|
||||
#### 2.1.1 修改配置文件
|
||||
|
||||
首先,修改配置文件中的`ip`设置: 假设两台机器的`ip`地址分别为`192.168.0.1`和`192.168.0.2`,则对应的配置文件`gpu_list`字段需要修改为`gpu_list:192.168.0.1,192.168.0.2;0,1`; `ip`地址查看命令为`ifconfig`。
|
||||
|
||||
|
||||
#### 2.1.2 准备数据
|
||||
|
||||
运行`prepare.sh`准备数据和模型,以配置文件`test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt`为例,数据准备命令如下所示。
|
||||
|
||||
```shell
|
||||
bash test_tipc/prepare.sh test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt lite_train_lite_infer
|
||||
```
|
||||
|
||||
**注意:** 由于是多机训练,这里需要在所有的节点上均运行启动上述命令,准备数据。
|
||||
|
||||
#### 2.1.3 修改起始端口并开始测试
|
||||
|
||||
在多机的节点上使用下面的命令设置分布式的起始端口(否则后面运行的时候会由于无法找到运行端口而hang住),一般建议设置在`10000~20000`之间。
|
||||
|
||||
```shell
|
||||
export FLAGS_START_PORT=17000
|
||||
```
|
||||
|
||||
以配置文件`test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt`为例,测试方法如下所示。
|
||||
|
||||
```shell
|
||||
bash test_tipc/test_train_inference_python.sh test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt lite_train_lite_infer
|
||||
```
|
||||
|
||||
**注意:** 由于是多机训练,这里需要在所有的节点上均运行启动上述命令进行测试。
|
||||
|
||||
|
||||
#### 2.1.4 输出结果
|
||||
|
||||
输出结果如下,表示命令运行成功。
|
||||
|
||||
```bash
|
||||
Run successfully with command - python3.7 -m paddle.distributed.launch --ips=192.168.0.1,192.168.0.2 --gpus=0,1
|
||||
tools/train.py -c configs/ppyoloe/ppyoloe_crn_s_300e_coco.yml -o log_iter=1 use_gpu=True save_dir=./test_tipc/outpu
|
||||
t/ppyoloe_crn_s_300e_coco/norm_train_gpus_0,1_autocast_null_nodes_2 epoch=1 pretrain_weights=https://paddledet.bj.bc
|
||||
ebos.com/models/ppyoloe_crn_s_300e_coco.pdparams TrainReader.batch_size=2 filename=ppyoloe_crn_s_300e_coco !
|
||||
|
||||
......
|
||||
Run successfully with command - python3.7 ./deploy/python/infer.py --device=cpu --enable_mkldnn=False --cpu_threads
|
||||
=4 --model_dir=./test_tipc/output/ppyoloe_crn_s_300e_coco/norm_train_gpus_0,1_autocast_null_nodes_2/ppyoloe_crn_s_30
|
||||
0e_coco --batch_size=2 --image_dir=./dataset/coco/test2017/ --run_benchmark=False --trt_max_shape=1600 > ./test_tipc
|
||||
/output/ppyoloe_crn_s_300e_coco/python_infer_cpu_usemkldnn_False_threads_4_precision_fluid_batchsize_2.log 2>&1 !
|
||||
```
|
||||
|
||||
**注意:** 由于分布式训练时,仅在`trainer_id=0`所在的节点中保存模型,因此其他的节点中在运行模型导出与推理时会报错,为正常现象。
|
||||
152
paddle_detection/test_tipc/docs/test_train_inference_python.md
Normal file
152
paddle_detection/test_tipc/docs/test_train_inference_python.md
Normal file
@@ -0,0 +1,152 @@
|
||||
# Linux端基础训练预测功能测试
|
||||
|
||||
Linux端基础训练预测功能测试的主程序为`test_train_inference_python.sh`,可以测试基于Python的模型训练、评估、推理等基本功能,包括裁剪、量化、蒸馏。
|
||||
|
||||
- Mac端基础训练预测功能测试参考[链接](./)
|
||||
- Windows端基础训练预测功能测试参考[链接](./)
|
||||
|
||||
## 1. 测试结论汇总
|
||||
|
||||
- 训练相关:
|
||||
|
||||
| 算法名称 | 模型名称 | 单机单卡 | 单机多卡 | 多机多卡 | 模型压缩(单机多卡) |
|
||||
| :---- | :---- | :---- | :---- | :---- | :---- |
|
||||
| PPYOLO | ppyolo_mbv3_large_coco | 正常训练 <br> 混合精度 | 正常训练 <br> 混合精度 | 正常训练 <br> 混合精度 | 正常训练:FPGM裁剪、PACT量化 <br> 离线量化(无需训练) |
|
||||
| PPYOLO | ppyolo_r50vd_dcn_1x_coco | 正常训练 <br> 混合精度 | 正常训练 <br> 混合精度 | 正常训练 <br> 混合精度 | 正常训练:FPGM裁剪、PACT量化 <br> 离线量化(无需训练) |
|
||||
|
||||
|
||||
- 预测相关:基于训练是否使用量化,可以将训练产出的模型可以分为`正常模型`和`量化模型`,这两类模型对应的预测功能汇总如下,
|
||||
|
||||
| 模型类型 |device | batchsize | tensorrt | mkldnn | cpu多线程 |
|
||||
| ---- | ---- | ---- | :----: | :----: | :----: |
|
||||
| 正常模型 | GPU | 1/8 | fp32/fp16 | - | - |
|
||||
| 正常模型 | CPU | 1/8 | - | fp32/fp16 | 支持 |
|
||||
| 量化模型 | GPU | 1/8 | int8 | - | - |
|
||||
| 量化模型 | CPU | 1/8 | - | int8 | 支持 |
|
||||
|
||||
|
||||
## 2. 测试流程
|
||||
|
||||
运行环境配置请参考[文档](./install.md)的内容配置TIPC的运行环境。
|
||||
|
||||
### 2.1 安装依赖
|
||||
- 安装PaddlePaddle >= 2.2
|
||||
- 安装PaddleDetection依赖
|
||||
```
|
||||
pip install -r ./requirements.txt
|
||||
pip install -r ./test_tipc/requirements.txt
|
||||
```
|
||||
- 安装autolog(规范化日志输出工具)
|
||||
```
|
||||
git clone https://github.com/LDOUBLEV/AutoLog
|
||||
cd AutoLog
|
||||
pip install -r ./requirements.txt
|
||||
python setup.py bdist_wheel
|
||||
pip install ./dist/auto_log-1.0.0-py3-none-any.whl
|
||||
```
|
||||
- 安装PaddleSlim (可选)
|
||||
```
|
||||
# 如果要测试量化、裁剪等功能,需要安装PaddleSlim
|
||||
pip install paddleslim
|
||||
```
|
||||
|
||||
|
||||
### 2.2 功能测试
|
||||
先运行`prepare.sh`准备数据和模型,然后运行`test_train_inference_python.sh`进行测试,最终在```test_tipc/output```目录下生成`python_infer_*.log`格式的日志文件,
|
||||
以yolov3_darknet53_270e_coco为例。
|
||||
|
||||
|
||||
`test_train_inference_python.sh`包含5种运行模式,每种模式的运行数据不同,分别用于测试速度和精度,分别是:
|
||||
|
||||
- 模式1:lite_train_lite_infer,使用少量数据训练,用于快速验证训练到预测的走通流程,不验证精度和速度;
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'lite_train_lite_infer'
|
||||
bash test_tipc/test_train_inference_python.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'lite_train_lite_infer'
|
||||
```
|
||||
|
||||
- 模式2:lite_train_whole_infer,使用少量数据训练,一定量数据预测,用于验证训练后的模型执行预测,预测速度是否合理;
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'lite_train_whole_infer'
|
||||
bash test_tipc/test_train_inference_python.sh ../test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'lite_train_whole_infer'
|
||||
```
|
||||
|
||||
- 模式3:whole_infer,不训练,全量数据预测,走通开源模型评估、动转静,检查inference model预测时间和精度;
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'whole_infer'
|
||||
# 用法1:
|
||||
bash test_tipc/test_train_inference_python.sh ../test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'whole_infer'
|
||||
# 用法2: 指定GPU卡预测,第三个传入参数为GPU卡号
|
||||
bash test_tipc/test_train_inference_python.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'whole_infer' '1'
|
||||
```
|
||||
|
||||
- 模式4:whole_train_whole_infer,CE: 全量数据训练,全量数据预测,验证模型训练精度,预测精度,预测速度;
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'whole_train_whole_infer'
|
||||
bash test_tipc/test_train_inference_python.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'whole_train_whole_infer'
|
||||
```
|
||||
|
||||
- 模式5:klquant_whole_infer,测试离线量化;
|
||||
```shell
|
||||
bash test_tipc/prepare.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'klquant_whole_infer'
|
||||
bash test_tipc/test_train_inference_python.sh ./test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt 'klquant_whole_infer'
|
||||
```
|
||||
|
||||
运行相应指令后,在`test_tipc/output`文件夹下自动会保存运行日志。如'lite_train_lite_infer'模式下,会运行训练+推理的链条,因此,在`test_tipc/output`文件夹有以下文件:
|
||||
```
|
||||
test_tipc/output/
|
||||
|- results_python.log # 运行指令状态的日志
|
||||
|- norm_train_gpus_0_autocast_null/ # GPU 0号卡上正常训练的训练日志和模型保存文件夹
|
||||
|- pact_train_gpus_0_autocast_null/ # GPU 0号卡上量化训练的训练日志和模型保存文件夹
|
||||
......
|
||||
|- python_infer_cpu_usemkldnn_True_threads_1_precision_fluid_batchsize_1.log # CPU上开启Mkldnn线程数设置为1,测试batch_size=1条件下的预测运行日志
|
||||
|- python_infer_gpu_precision_trt_fp16_batchsize_1.log # GPU上开启TensorRT,测试batch_size=1的半精度预测日志
|
||||
......
|
||||
```
|
||||
|
||||
其中`results_python.log`中包含了每条指令的运行状态,如果运行成功会输出:
|
||||
```
|
||||
Run successfully with command - python3.7 tools/train.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o use_gpu=True save_dir=./test_tipc/output/norm_train_gpus_0_autocast_null epoch=1 pretrain_weights=https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams TrainReader.batch_size=2 filename=yolov3_darknet53_270e_coco !
|
||||
Run successfully with command - python3.7 tools/eval.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o weights=./test_tipc/output/norm_train_gpus_0_autocast_null/yolov3_darknet53_270e_coco/model_final.pdparams use_gpu=True !
|
||||
......
|
||||
```
|
||||
如果运行失败,会输出:
|
||||
```
|
||||
Run failed with command - python3.7 tools/train.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o use_gpu=True save_dir=./test_tipc/output/norm_train_gpus_0_autocast_null epoch=1 pretrain_weights=https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams TrainReader.batch_size=2 filename=yolov3_darknet53_270e_coco !
|
||||
Run failed with command - python3.7 tools/eval.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o weights=./test_tipc/output/norm_train_gpus_0_autocast_null/yolov3_darknet53_270e_coco/model_final.pdparams use_gpu=True !
|
||||
......
|
||||
```
|
||||
可以很方便的根据`results_python.log`中的内容判定哪一个指令运行错误。
|
||||
|
||||
|
||||
### 2.3 精度测试
|
||||
|
||||
使用compare_results.py脚本比较模型预测的结果是否符合预期,主要步骤包括:
|
||||
- 提取日志中的预测坐标;
|
||||
- 从本地文件中提取保存好的坐标结果;
|
||||
- 比较上述两个结果是否符合精度预期,误差大于设置阈值时会报错。
|
||||
|
||||
#### 使用方式
|
||||
运行命令:
|
||||
```shell
|
||||
python3.7 test_tipc/compare_results.py --gt_file=./test_tipc/results/python_*.txt --log_file=./test_tipc/output/python_*.log --atol=1e-3 --rtol=1e-3
|
||||
```
|
||||
|
||||
参数介绍:
|
||||
- gt_file: 指向事先保存好的预测结果路径,支持*.txt 结尾,会自动索引*.txt格式的文件,文件默认保存在test_tipc/result/ 文件夹下
|
||||
- log_file: 指向运行test_tipc/test_train_inference_python.sh 脚本的infer模式保存的预测日志,预测日志中打印的有预测结果,比如:文本框,预测文本,类别等等,同样支持python_infer_*.log格式传入
|
||||
- atol: 设置的绝对误差
|
||||
- rtol: 设置的相对误差
|
||||
|
||||
#### 运行结果
|
||||
|
||||
正常运行效果如下图:
|
||||
<img src="compare_right.png" width="1000">
|
||||
|
||||
出现不一致结果时的运行输出:
|
||||
<img src="compare_wrong.png" width="1000">
|
||||
|
||||
|
||||
## 3. 更多教程
|
||||
本文档为功能测试用,更丰富的训练预测使用教程请参考:
|
||||
[模型训练](../../docs/tutorials/GETTING_STARTED_cn.md)
|
||||
[PaddleDetection预测部署](../../deploy/README.md)
|
||||
Reference in New Issue
Block a user