From 372016552bb10f0459d0db80896ec71c333a01bd Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Mon, 19 Apr 2021 21:47:07 +0800 Subject: [PATCH] [cherry pick] update install doc (#2691) * update install doc --- docs/tutorials/INSTALL.md | 51 +++++++++++++----------------------- docs/tutorials/INSTALL_cn.md | 49 ++++++++++++++-------------------- requirements.txt | 3 +++ setup.py | 17 +++++++++--- 4 files changed, 53 insertions(+), 67 deletions(-) diff --git a/docs/tutorials/INSTALL.md b/docs/tutorials/INSTALL.md index 874bdca09..c41d96e0c 100644 --- a/docs/tutorials/INSTALL.md +++ b/docs/tutorials/INSTALL.md @@ -19,36 +19,7 @@ For general information about PaddleDetection, please see [README.md](https://gi ## Instruction -It is recommened to install PaddleDetection and begin your object detection journey via docker environment. Please follow the instruction below and if you want to use your local environment, you could skip step 1. - - -### 1. (Recommended) Prepare docker environment - -For example, the environment is CUDA10.1 and CUDNN 7.6 - -```bash -# Firstly, pull the PaddlePaddle image -sudo docker pull paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 - -# Switch to the working directory -cd /home/work - -# Create a container called ppdet and -# mount the current directory which may contains the dataset -# to /paddle directory in the container -sudo nvidia-docker run --name ppdet -v $PWD:/paddle --privileged --shm-size=4G --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash -``` - -You can see [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that matches your machine. - -``` -# ctrl+P+Q to exit docker, to re-enter docker using the following command: -sudo docker exec -it ppdet /bin/bash -``` - -For more docker usage, please refer to the PaddlePaddle [document](https://www.paddlepaddle.org.cn/documentation/docs/en/install/docker/fromdocker_en.html). - -### 2. Install PaddlePaddle +### 1. Install PaddlePaddle ``` # CUDA9.0 @@ -79,8 +50,24 @@ python -c "import paddle; print(paddle.__version__)" 1. If you want to use PaddleDetection on multi-GPU, please install NCCL at first. -### 3. Install PaddleDetection +### 2. Install PaddleDetection + +PaddleDetection can be installed in the following two ways: + +#### 2.1 Install via pip + +**Note:** Installing via pip only supports Python3 + +``` +# install paddledet via pip +pip install paddledet==2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple + +# Download and use the configuration files and code examples in the source code +git clone https://github.com/PaddlePaddle/PaddleDetection.git +cd PaddleDetection +``` +#### 2.2 Compile and install from Source code ``` # Clone PaddleDetection repository @@ -116,8 +103,6 @@ Ran 12 tests in 2.480s OK (skipped=2) ``` - - ## Inference demo **Congratulation!** Now you have installed PaddleDetection successfully and try our inference demo: diff --git a/docs/tutorials/INSTALL_cn.md b/docs/tutorials/INSTALL_cn.md index facf2568e..c5d105ade 100644 --- a/docs/tutorials/INSTALL_cn.md +++ b/docs/tutorials/INSTALL_cn.md @@ -19,35 +19,7 @@ ## 安装说明 -建议使用docker环境安装PaddleDetection并开启你的目标检测之旅。请按照如下步骤说明进行安装,如果您希望使用本机环境,可以跳过步骤1. - -### 1. (推荐)准备docker环境 - -已CUDA10.1, CUDNN7.6为例 - -```bash -# 首先拉去PaddlePaddle镜像 -sudo docker pull paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 - -# 切换到工作目录 -cd /home/work - -# 创建ppdet容器 -# 将存放数据的当前目录映射到容器中的/ppdet目录中 -sudo nvidia-docker run --name ppdet -v $PWD:/paddle --privileged --shm-size=4G --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash -``` - -可以在[DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) 中找到匹配您机器环境的镜像 - -``` -# ctrl+P+Q 退出容器, 使用如下命令重新进入docker环境: -sudo docker exec -it ppdet /bin/bash -``` - -其他更多docker用法,请参考PaddlePaddle[文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/install/docker/fromdocker.html) - - -### 安装PaddlePaddle +### 1. 安装PaddlePaddle ``` # CUDA9.0 @@ -75,7 +47,24 @@ python -c "import paddle; print(paddle.__version__)" **注意** 1. 如果您希望在多卡环境下使用PaddleDetection,请首先安装NCCL -### 3. 安装PaddleDetection +### 2. 安装PaddleDetection + +可通过如下两种方式安装PaddleDetection + +#### 2.1 通过pip安装 + +**注意:** pip安装方式只支持Python3 + +``` +# pip安装paddledet +pip install paddledet==2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple + +# 下载使用源码中的配置文件和代码示例 +git clone https://github.com/PaddlePaddle/PaddleDetection.git +cd PaddleDetection +``` + +#### 2.2 源码编译安装 ``` # 克隆PaddleDetection仓库 diff --git a/requirements.txt b/requirements.txt index 8ce34b5f0..59187a3e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,6 @@ scipy terminaltables pycocotools setuptools>=42.0.0 + +# extension OPs for rotation bbox +rbox_iou_ops diff --git a/setup.py b/setup.py index 7be74fce9..cb0502220 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ import os.path as osp import glob import shutil from setuptools import find_packages, setup +from paddle.utils import cpp_extension def readme(): @@ -59,17 +60,25 @@ packages = [ 'ppdet.metrics', 'ppdet.modeling', 'ppdet.model_zoo', - 'ppdet.py_op', + 'ppdet.slim', 'ppdet.utils', ] if __name__ == "__main__": + # install extension APIs for rotation bbox + from paddle.utils import cpp_extension + cpp_extension.setup( + name='rbox_iou_ops', + ext_modules=cpp_extension.CUDAExtension(sources=[ + 'ppdet/ext_op/rbox_iou_op.cc', 'ppdet/ext_op/rbox_iou_op.cu' + ])) + setup( - name='ppdet', + name='paddledet', packages=find_packages(exclude=("configs", "tools", "deploy")), package_data={'ppdet.model_zoo': package_model_zoo()}, author='PaddlePaddle', - version='2.0-rc', + version='2.0', install_requires=parse_requirements('./requirements.txt'), description='Object detection and instance segmentation toolkit based on PaddlePaddle', long_description=readme(), @@ -88,4 +97,4 @@ if __name__ == "__main__": 'Programming Language :: Python :: 3.7', 'Topic :: Utilities' ], license='Apache License 2.0', - ext_modules=[], ) + ext_modules=[]) -- GitLab