From 7f564b5b878d332a20e6aa1df5d0fceb5ecfbc3c Mon Sep 17 00:00:00 2001 From: cnn Date: Tue, 16 Mar 2021 22:42:04 +0800 Subject: [PATCH] [Doc] update install doc (#2316) (#2362) * Update install doc and deploy doc. --- deploy/cpp/README.md | 4 +- deploy/cpp/docs/Jetson_build.md | 6 +- deploy/cpp/docs/linux_build.md | 2 +- .../deploy/docs/windows_vs2015_build.md | 2 +- docs/tutorials/INSTALL.md | 150 +++++------------- docs/tutorials/INSTALL_cn.md | 33 ++-- docs/tutorials/QUICK_STARTED.md | 94 ++++++----- 7 files changed, 116 insertions(+), 175 deletions(-) diff --git a/deploy/cpp/README.md b/deploy/cpp/README.md index c7c5e50ff..2792afefc 100644 --- a/deploy/cpp/README.md +++ b/deploy/cpp/README.md @@ -67,5 +67,5 @@ yolov3_darknet # 模型目录 ### 3.2 编译 仅支持在`Windows`和`Linux`平台编译和使用 -- [Linux 编译指南](https://github.com/PaddlePaddle/PaddleDetection/blob/master/deploy/cpp/docs/linux_build.md) -- [Windows编译指南(使用Visual Studio 2019)](https://github.com/PaddlePaddle/PaddleDetection/blob/master/deploy/cpp/docs/windows_vs2019_build.md) +- [Linux 编译指南](docs/linux_build.md) +- [Windows编译指南(使用Visual Studio 2019)](docs/windows_vs2019_build.md) diff --git a/deploy/cpp/docs/Jetson_build.md b/deploy/cpp/docs/Jetson_build.md index c5526cf31..0262ffbd1 100644 --- a/deploy/cpp/docs/Jetson_build.md +++ b/deploy/cpp/docs/Jetson_build.md @@ -19,9 +19,9 @@ cat /etc/nv_tegra_release * (3) 下载`JetPack`,请参考[NVIDIA Jetson Linux Developer Guide](https://docs.nvidia.com/jetson/l4t/index.html) 中的`Preparing a Jetson Developer Kit for Use`章节内容进行刷写系统镜像。 ## 下载或编译`Paddle`预测库 -本文档使用`Paddle`在`JetPack4.3`上预先编译好的预测库,请根据硬件在[安装与编译 Linux 预测库](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.0-rc/guides/05_inference_deployment/inference/build_and_install_lib_cn.html) 中选择对应版本的`Paddle`预测库。 +本文档使用`Paddle`在`JetPack4.3`上预先编译好的预测库,请根据硬件在[安装与编译 Linux 预测库](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/05_inference_deployment/inference/build_and_install_lib_cn.html) 中选择对应版本的`Paddle`预测库。 -这里选择[nv_jetson_cuda10_cudnn7.6_trt6(jetpack4.3)](https://paddle-inference-lib.bj.bcebos.com/2.0.0-rc0-nv-jetson-cuda10-cudnn7.6-trt6/paddle_inference.tgz), `Paddle`版本`2.0.0-rc0`,`CUDA`版本`10.0`,`CUDNN`版本`7.6`,`TensorRT`版本`6`。 +这里选择[nv_jetson_cuda10_cudnn7.6_trt6(jetpack4.3)](https://paddle-inference-lib.bj.bcebos.com/2.0.0-nv-jetson-jetpack4.3-all/paddle_inference.tgz), `Paddle`版本`2.0.0-rc0`,`CUDA`版本`10.0`,`CUDNN`版本`7.6`,`TensorRT`版本`6`。 若需要自己在`Jetson`平台上自定义编译`Paddle`库,请参考文档[安装与编译 Linux 预测库](https://www.paddlepaddle.org.cn/documentation/docs/zh/advanced_guide/inference_deployment/inference/build_and_install_lib_cn.html) 的`NVIDIA Jetson嵌入式硬件预测库源码编译`部分内容。 @@ -34,7 +34,7 @@ cat /etc/nv_tegra_release ### Step2: 下载PaddlePaddle C++ 预测库 fluid_inference -解压下载的[nv_jetson_cuda10_cudnn7.6_trt6(jetpack4.3)](https://paddle-inference-lib.bj.bcebos.com/2.0.0-rc0-nv-jetson-cuda10-cudnn7.6-trt6/paddle_inference.tgz) 。 +解压下载的[nv_jetson_cuda10_cudnn7.6_trt6(jetpack4.3)](https://paddle-inference-lib.bj.bcebos.com/2.0.0-nv-jetson-jetpack4.3-all/paddle_inference.tgz) 。 下载并解压后`/root/projects/fluid_inference`目录包含内容为: ``` diff --git a/deploy/cpp/docs/linux_build.md b/deploy/cpp/docs/linux_build.md index 95446122e..ab95dc786 100644 --- a/deploy/cpp/docs/linux_build.md +++ b/deploy/cpp/docs/linux_build.md @@ -19,7 +19,7 @@ ### Step2: 下载PaddlePaddle C++ 预测库 fluid_inference -PaddlePaddle C++ 预测库针对不同的`CPU`和`CUDA`版本提供了不同的预编译版本,请根据实际情况下载: [C++预测库下载列表](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/05_inference_deployment/inference/build_and_install_lib_cn.html#linux) +PaddlePaddle C++ 预测库针对不同的`CPU`和`CUDA`版本提供了不同的预编译版本,请根据实际情况下载: [C++预测库下载列表](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/05_inference_deployment/inference/build_and_install_lib_cn.html#linux) 下载并解压后`/root/projects/fluid_inference`目录包含内容为: diff --git a/docs/advanced_tutorials/deploy/docs/windows_vs2015_build.md b/docs/advanced_tutorials/deploy/docs/windows_vs2015_build.md index 6182bf311..2d24ff1d7 100644 --- a/docs/advanced_tutorials/deploy/docs/windows_vs2015_build.md +++ b/docs/advanced_tutorials/deploy/docs/windows_vs2015_build.md @@ -111,4 +111,4 @@ cd /d D:\projects\PaddleDetection\inference\build\release detection_demo.exe --conf=/path/to/your/conf --input_dir=/path/to/your/input/data/directory ``` -更详细说明请参考ReadMe文档: [预测和可视化部分](https://github.com/PaddlePaddle/PaddleDetection/blob/master/deploy/README.md) +更详细说明请参考ReadMe文档: [预测和可视化部分](../../deploy/README.md) diff --git a/docs/tutorials/INSTALL.md b/docs/tutorials/INSTALL.md index cd3796d79..573434ed8 100644 --- a/docs/tutorials/INSTALL.md +++ b/docs/tutorials/INSTALL.md @@ -9,7 +9,6 @@ English | [简体中文](INSTALL_cn.md) - [PaddlePaddle](#paddlepaddle) - [Other Dependencies](#other-dependencies) - [PaddleDetection](#paddle-detection) -- [Datasets](#datasets) ## Introduction @@ -17,16 +16,17 @@ English | [简体中文](INSTALL_cn.md) This document covers how to install PaddleDetection, its dependencies (including PaddlePaddle), together with COCO and Pascal VOC dataset. -For general information about PaddleDetection, please see [README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/master/). +For general information about PaddleDetection, please see [README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/). ## Install PaddlePaddle ### Requirements: -- Python2 or Python3 (Only support Python3 for windows) +- OS 64 bit +- Python2 >= 2.7.15 or Python 3(3.5.1+/3.6/3.7),64 bit +- pip/pip3(9.0.1+), 64 bit - CUDA >= 9.0 - cuDNN >= 7.6 -- nccl >= 2.1.2 If you need GPU multi-card training, firstly please install NCCL. (Windows does not support nccl). @@ -34,24 +34,38 @@ PaddleDetection depends on PaddlePaddle version relationship: | PaddleDetection version | PaddlePaddle version | tips | | :----------------: | :---------------: | :-------: | -| v0.3 | >=1.7 | -- | -| v0.4 | >= 1.8.4 | PP-YOLO依赖1.8.4 | -| v0.5 | >= 1.8.4 | Most models can run with >= 1.8.4, Cascade R-CNN and SOLOv2 depend on 2.0.0.rc | +| release/0.3 | >=1.7 | -- | +| release/0.4 | >= 1.8.4 | PP-YOLO depends on 1.8.4 | +| release/0.5 | >= 1.8.4 | Cascade R-CNN and SOLOv2 depends on 2.0.0.rc | +| release/2.0-rc | >= 2.0.1 | -- | + If you want install paddlepaddle, please follow the instructions in [installation document](http://www.paddlepaddle.org.cn/). -Please make sure your PaddlePaddle installation was successful and the version -of your PaddlePaddle is not lower than required. Verify with the following commands. +``` +# install paddlepaddle +# install paddlepaddle CUDA9.0 +python -m pip install paddlepaddle-gpu==2.0.1.post90 -i https://mirror.baidu.com/pypi/simple + +install paddlepaddle CUDA10.0 +python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://paddlepaddle.org.cn/whl/mkl/stable.html +install paddlepaddle CPU +python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` -# To check PaddlePaddle installation in your Python interpreter ->>> import paddle.fluid as fluid ->>> fluid.install_check.run_check() -# To check PaddlePaddle version -python -c "import paddle; print(paddle.__version__)" +For more installation methods such as conda, docker installation, please refer to the instructions in the [installation document](https://www.paddlepaddle.org.cn/install/quick) + +Please make sure that your PaddlePaddle is installed successfully and the version is not lower than the required version. Use the following command to verify. + ``` +# check +>>> import paddle +>>> paddle.utils.run_check() +# confirm the paddle's version +python -c "import paddle; print(paddle.__version__)" +``` ## Other Dependencies @@ -104,108 +118,24 @@ pip install -r requirements.txt python ppdet/modeling/tests/test_architectures.py ``` -## Datasets - -PaddleDetection includes support for [COCO](http://cocodataset.org) and [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/) by default, please follow these instructions to set up the dataset. - -**Create symlinks for local datasets:** - -Default dataset path in config files is `dataset/coco` and `dataset/voc`, if the -datasets are already available on disk, you can simply create symlinks to -their directories: - -``` -ln -sf /dataset/coco -ln -sf /dataset/voc -``` - -For Pascal VOC dataset, you should create file list by: - +After the test is passed, the following information will be prompted: ``` -python dataset/voc/create_list.py +.......... +---------------------------------------------------------------------- +Ran 12 tests in 2.480s +OK (skipped=2) ``` -**Download datasets manually:** - -On the other hand, to download the datasets, run the following commands: +**Infer by pretrained-model** -- COCO +Use the pre-trained model to predict the image: ``` -python dataset/coco/download_coco.py +# set use_gpu +python tools/infer.py -c configs/ppyolo/ppyolo.yml -o use_gpu=true weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439.jpg ``` -`COCO` dataset with directory structures like this: - - ``` - dataset/coco/ - ├── annotations - │ ├── instances_train2014.json - │ ├── instances_train2017.json - │ ├── instances_val2014.json - │ ├── instances_val2017.json - │ | ... - ├── train2017 - │ ├── 000000000009.jpg - │ ├── 000000580008.jpg - │ | ... - ├── val2017 - │ ├── 000000000139.jpg - │ ├── 000000000285.jpg - │ | ... - | ... - ``` - -- Pascal VOC - -``` -python dataset/voc/download_voc.py -``` +An image of the same name with the predicted result will be generated under the `output` folder. +The result is as shown below: -`Pascal VOC` dataset with directory structure like this: - - ``` - dataset/voc/ - ├── trainval.txt - ├── test.txt - ├── label_list.txt (optional) - ├── VOCdevkit/VOC2007 - │ ├── Annotations - │ ├── 001789.xml - │ | ... - │ ├── JPEGImages - │ ├── 001789.jpg - │ | ... - │ ├── ImageSets - │ | ... - ├── VOCdevkit/VOC2012 - │ ├── Annotations - │ ├── 2011_003876.xml - │ | ... - │ ├── JPEGImages - │ ├── 2011_003876.jpg - │ | ... - │ ├── ImageSets - │ | ... - | ... - ``` - -**NOTE:** If you set `use_default_label=False` in yaml configs, the `label_list.txt` -of Pascal VOC dataset will be read, otherwise, `label_list.txt` is unnecessary and -the default Pascal VOC label list which defined in -[voc\_loader.py](https://github.com/PaddlePaddle/PaddleDetection/blob/master/ppdet/data/source/voc.py) will be used. - -**Download datasets automatically:** - -If a training session is started but the dataset is not setup properly (e.g, -not found in `dataset/coco` or `dataset/voc`), PaddleDetection can automatically -download them from [COCO-2017](http://images.cocodataset.org) and -[VOC2012](http://host.robots.ox.ac.uk/pascal/VOC), the decompressed datasets -will be cached in `~/.cache/paddle/dataset/` and can be discovered automatically -subsequently. - - -**NOTE:** - -- If you want to use a custom datasets, please refer to [Custom DataSet Document](Custom_DataSet.md) -- For further informations on the datasets, please see [READER.md](../advanced_tutorials/READER.md) +![](../images/000000014439.jpg) diff --git a/docs/tutorials/INSTALL_cn.md b/docs/tutorials/INSTALL_cn.md index dd1e18d18..0730f7641 100644 --- a/docs/tutorials/INSTALL_cn.md +++ b/docs/tutorials/INSTALL_cn.md @@ -13,7 +13,7 @@ 这份文档介绍了如何安装PaddleDetection及其依赖项(包括PaddlePaddle)。 -PaddleDetection的相关信息,请参考[README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/master/README.md). +PaddleDetection的相关信息,请参考[README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/README_cn.md). ## 安装PaddlePaddle @@ -22,7 +22,7 @@ PaddleDetection的相关信息,请参考[README.md](https://github.com/PaddleP - OS 64位操作系统 - Python2 >= 2.7.15 or Python 3(3.5.1+/3.6/3.7),64位版本 -- pip/pip3(9.0.1+),64位版本操作系统是 +- pip/pip3(9.0.1+),64位版本操作系统 - CUDA >= 9.0 - cuDNN >= 7.6 @@ -30,35 +30,34 @@ PaddleDetection的相关信息,请参考[README.md](https://github.com/PaddleP PaddleDetection 依赖 PaddlePaddle 版本关系: -| PaddleDetection版本 | PaddlePaddle版本 | 备注 | -| :----------------: | :---------------: | :-------: | -| v0.3 | >=1.7 | -- | -| v0.4 | >= 1.8.4 | PP-YOLO依赖1.8.4 | -| v0.5 | >= 1.8.4 | 大部分模型>=1.8.4即可运行,Cascade R-CNN系列模型与SOLOv2依赖2.0.0.rc版本 | +| PaddleDetection版本 | PaddlePaddle版本 | 备注 | +| :------------------: | :---------------: | :-------: | +| release/0.3 | >=1.7 | -- | +| release/0.4 | >= 1.8.4 | PP-YOLO依赖1.8.4 | +| release/0.5 | >= 1.8.4 | 大部分模型>=1.8.4即可运行,Cascade R-CNN系列模型与SOLOv2依赖2.0.0.rc版本 | +| release/2.0-rc | >= 2.0.1 | -- | ``` # install paddlepaddle -python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple - # 如果您的机器安装的是CUDA9,请运行以下命令安装 -python -m pip install paddlepaddle-gpu==1.8.4.post97 -i https://mirror.baidu.com/pypi/simple +python -m pip install paddlepaddle-gpu==2.0.1.post90 -i https://mirror.baidu.com/pypi/simple -如果您的机器安装的是CUDA10,请运行以下命令安装 -python -m pip install paddlepaddle-gpu==1.8.4.post107 -i https://mirror.baidu.com/pypi/simple +如果您的机器安装的是CUDA10.1,请运行以下命令安装 +python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://paddlepaddle.org.cn/whl/mkl/stable.html 如果您的机器是CPU,请运行以下命令安装 - -python -m pip install paddlepaddle==1.8.4 -i https://mirror.baidu.com/pypi/simple +python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` + 更多的安装方式如conda, docker安装,请参考[安装文档](https://www.paddlepaddle.org.cn/install/quick)中的说明进行操作 请确保您的PaddlePaddle安装成功并且版本不低于需求版本。使用以下命令进行验证。 ``` # 在您的Python解释器中确认PaddlePaddle安装成功 ->>> import paddle.fluid as fluid ->>> fluid.install_check.run_check() +>>> import paddle +>>> paddle.utils.run_check() # 确认PaddlePaddle版本 python -c "import paddle; print(paddle.__version__)" @@ -86,7 +85,7 @@ python -c "import paddle; print(paddle.__version__)" **安装Python依赖库:** -Python依赖库在[requirements.txt](https://github.com/PaddlePaddle/PaddleDetection/blob/master/requirements.txt)中给出,可通过如下命令安装: +Python依赖库在[requirements.txt](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/requirements.txt) 中给出,可通过如下命令安装: ``` pip install -r requirements.txt diff --git a/docs/tutorials/QUICK_STARTED.md b/docs/tutorials/QUICK_STARTED.md index 5dad54bef..d8ca71377 100644 --- a/docs/tutorials/QUICK_STARTED.md +++ b/docs/tutorials/QUICK_STARTED.md @@ -1,70 +1,82 @@ English | [简体中文](QUICK_STARTED_cn.md) # Quick Start - -This tutorial fine-tunes a tiny dataset by pretrained detection model for users to get a model and learn PaddleDetection quickly. The model can be trained in around 20min with good performance. - -- **Note: before started, need to specifiy the GPU device as follows.** - +In order to enable users to quickly produce models in a short time and master the use of PaddleDetection, this tutorial uses a pre-trained detection model to finetune small data sets. A good model can be produced in a short period of time. In actual business, it is recommended that users select a suitable model configuration file for adaptation according to their needs. +- **Set GPU** ```bash export CUDA_VISIBLE_DEVICES=0 ``` -## Data Preparation - -Dataset refers to [Kaggle](https://www.kaggle.com/mbkinaci/fruit-images-for-object-detection), which contains 240 images in train dataset and 60 images in test dataset. Data categories are apple, orange and banana. Download [here](https://dataset.bj.bcebos.com/PaddleDetection_demo/fruit-detection.tar) and uncompress the dataset after download, script for data preparation is located at [download_fruit.py](../../dataset/fruit/download_fruit.py). Command is as follows: - -```bash -python dataset/fruit/download_fruit.py +## Quick Start +``` +# predict an image using PP-YOLO +python tools/infer.py -c configs/ppyolo/ppyolo.yml -o use_gpu=true weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439.jpg ``` +the result: -Training: +![](../images/000000014439.jpg) -```bash -python -u tools/train.py -c configs/yolov3_mobilenet_v1_fruit.yml --eval -``` -Use `yolov3_mobilenet_v1` to fine-tune the model from COCO dataset. +## Prepare Dataset +The Dataset is [Kaggle dataset](https://www.kaggle.com/andrewmvd/road-sign-detection) ,Contains 877 images, 4 data categories: crosswalk, speedlimit, stop, trafficlight. +The dataset is divided into training set(contains 701 images) and test set(contains 176 images),[download link](https://paddlemodels.bj.bcebos.com/object_detection/roadsign_voc.tar). -Meanwhile, loss and mAP can be observed on VisualDL by set `--use_vdl` and `--vdl_log_dir`. But note Python version required >= 3.5 for VisualDL. +``` +# +python dataset/roadsign_voc/download_roadsign_voc.py +``` -```bash -python -u tools/train.py -c configs/yolov3_mobilenet_v1_fruit.yml \ - --use_vdl=True \ - --vdl_log_dir=vdl_fruit_dir/scalar \ - --eval +## Train、Eval、Infer +### 1、Train ``` +# It will takes about 5 minutes on GPU +# -c set configt file +# -o overwrite the settings in the configuration file +# --eval Evaluate while training, and a model named best_model.pdmodel with the most evaluation results will be automatically saved -Then observe the loss and mAP curve through VisualDL command: -```bash -visualdl --logdir vdl_fruit_dir/scalar/ --host --port +python tools/train.py -c configs/yolov3_mobilenet_v1_roadsign.yml --eval -o use_gpu=true ``` -Result on VisualDL is shown below: +If you want to observe the loss change curve in real time through VisualDL, add --use_vdl=true to the training command, and set the log save path through --vdl_log_dir. +**Note: VisualDL need Python>=3.5** -![](../images/visualdl_fruit.jpg) +Please install [VisualDL](https://github.com/PaddlePaddle/VisualDL) first +``` +python -m pip install visualdl -i https://mirror.baidu.com/pypi/simple +``` -Model can be downloaded [here](https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar) +``` +python -u tools/train.py -c configs/yolov3_mobilenet_v1_roadsign.yml \ + --use_vdl=true \ + --vdl_log_dir=vdl_dir/scalar \ + --eval +``` +View the change curve in real time through the visualdl command: +``` +visualdl --logdir vdl_dir/scalar/ --host --port +``` -Evaluation: +### 2、Eval +``` +# Eval using best_model by default +# -c set config file +# -o overwrite the settings in the configuration file -```bash -python -u tools/eval.py -c configs/yolov3_mobilenet_v1_fruit.yml +CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/yolov3_mobilenet_v1_roadsign.yml -o use_gpu=true ``` -Inference: -```bash -python -u tools/infer.py -c configs/yolov3_mobilenet_v1_fruit.yml \ - -o weights=https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar \ - --infer_img=demo/orange_71.jpg +### 3、Infer ``` +# -c set config file +# -o overwrite the settings in the configuration file +# --infer_img image path +# After the prediction is over, an image of the same name with the prediction result will be generated in the output folder -Inference images are shown below: - -![](../../demo/orange_71.jpg) +python tools/infer.py -c configs/yolov3_mobilenet_v1_roadsign.yml -o use_gpu=true --infer_img=demo/road554.png +``` -![](../images/orange_71_detection.jpg) +The result is as shown below: -For detailed infomation of training and evalution, please refer to [GETTING_STARTED.md](GETTING_STARTED.md). +![](../images/road554.png) -- GitLab