Skip to content

Commit c72d6c9

Browse files
authored
update install doc, test=document_fix (#2460)
* update install doc, test=document_fix * update doc, test=document_fix
1 parent 15747a0 commit c72d6c9

File tree

4 files changed

+223
-35
lines changed

4 files changed

+223
-35
lines changed

docs/tutorials/INSTALL.md

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
English | [简体中文](INSTALL_cn.md)
2+
3+
# Installation
4+
5+
6+
This document covers how to install PaddleDetection and its dependencies.
7+
8+
For general information about PaddleDetection, please see [README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/).
9+
10+
## Requirements:
11+
12+
- PaddlePaddle 2.0.1
13+
- OS 64 bit
14+
- Python 3(3.5.1+/3.6/3.7),64 bit
15+
- pip/pip3(9.0.1+), 64 bit
16+
- CUDA >= 9.0
17+
- cuDNN >= 7.6
18+
19+
20+
## Instruction
21+
22+
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.
23+
24+
25+
### 1. (Recommended) Prepare docker environment
26+
27+
For example, the environment is CUDA10.1 and CUDNN 7.6
28+
29+
```bash
30+
# Firstly, pull the PaddlePaddle image
31+
sudo docker pull paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82
32+
33+
# Switch to the working directory
34+
cd /home/work
35+
36+
# Create a container called ppdet and
37+
# mount the current directory which may contains the dataset
38+
# to /paddle directory in the container
39+
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
40+
```
41+
42+
You can see [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that matches your machine.
43+
44+
```
45+
# ctrl+P+Q to exit docker, to re-enter docker using the following command:
46+
sudo docker exec -it ppdet /bin/bash
47+
```
48+
49+
For more docker usage, please refer to the PaddlePaddle [document](https://www.paddlepaddle.org.cn/documentation/docs/en/install/docker/fromdocker_en.html).
50+
51+
### 2. Install PaddlePaddle
52+
53+
```
54+
# CUDA9.0
55+
python -m pip install paddlepaddle-gpu==2.0.1.post90 -i https://mirror.baidu.com/pypi/simple
56+
57+
# CUDA10.1
58+
python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://mirror.baidu.com/pypi/simple
59+
60+
# CPU
61+
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
62+
```
63+
64+
For more installation methods such as conda or compile with source code, please refer to the [installation document](https://www.paddlepaddle.org.cn/documentation/docs/en/install/index_en.html)
65+
66+
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.
67+
68+
```
69+
# check
70+
>>> import paddle
71+
>>> paddle.utils.run_check()
72+
73+
# confirm the paddle's version
74+
python -c "import paddle; print(paddle.__version__)"
75+
```
76+
77+
**Note**
78+
79+
1. If you want to use PaddleDetection on multi-GPU, please install NCCL at first.
80+
81+
82+
### 3. Install PaddleDetection
83+
84+
85+
```
86+
# Clone PaddleDetection repository
87+
cd <path/to/clone/PaddleDetection>
88+
git clone https://github.com/PaddlePaddle/PaddleDetection.git
89+
90+
# Install other dependencies
91+
pip install -r requirements.txt
92+
93+
# Install PaddleDetection
94+
cd PaddleDetection
95+
python setup.py install
96+
```
97+
98+
**Note**
99+
100+
1. Because the origin version of cocoapi does not support windows, another version is used which only supports Python3:
101+
102+
```pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI```
103+
104+
After installation, make sure the tests pass:
105+
106+
```shell
107+
python ppdet/modeling/tests/test_architectures.py
108+
```
109+
110+
If the tests are passed, the following information will be prompted:
111+
112+
```
113+
..........
114+
----------------------------------------------------------------------
115+
Ran 12 tests in 2.480s
116+
OK (skipped=2)
117+
```
118+
119+
120+
121+
## Inference demo
122+
123+
**Congratulation!** Now you have installed PaddleDetection successfully and try our inference demo:
124+
125+
```
126+
# Predict an image by GPU
127+
export CUDA_VISIBLE_DEVICES=0
128+
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
129+
```
130+
131+
An image of the same name with the predicted result will be generated under the `output` folder.
132+
The result is as shown below:
133+
134+
![](../images/000000014439.jpg)

docs/tutorials/INSTALL_cn.md

+84-34
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,129 @@
1-
# 安装说明
1+
[English](INSTALL.md) | 简体中文
22

3-
---
4-
## 目录
53

6-
- [安装PaddlePaddle](#安装PaddlePaddle)
7-
- [其他依赖安装](#其他依赖安装)
8-
- [PaddleDetection](#PaddleDetection)
4+
# 安装文档
95

6+
本文档包含了如何安装PaddleDetection以及相关依赖
107

11-
## 安装PaddlePaddle
8+
其他更多PaddleDetection信息,请参考[README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/).
129

13-
**环境需求:**
10+
## 环境要求
1411

15-
- PaddlePaddle 2.0.1 或 PaddlePaddle release/2.0分支最新编译安装包
12+
- PaddlePaddle 2.0.1
1613
- OS 64位操作系统
1714
- Python 3(3.5.1+/3.6/3.7),64位版本
1815
- pip/pip3(9.0.1+),64位版本
1916
- CUDA >= 9.0
2017
- cuDNN >= 7.6
2118

22-
如果需要 GPU 多卡训练,请先安装NCCL。
2319

20+
## 安装说明
2421

25-
## 其他依赖安装
22+
建议使用docker环境安装PaddleDetection并开启你的目标检测之旅。请按照如下步骤说明进行安装,如果您希望使用本机环境,可以跳过步骤1.
2623

27-
[COCO-API](https://github.com/cocodataset/cocoapi):
24+
### 1. (推荐)准备docker环境
2825

29-
运行需要COCO-API,安装方式如下:
26+
已CUDA10.1, CUDNN7.6为例
3027

31-
# 安装pycocotools
32-
pip install pycocotools
28+
```bash
29+
# 首先拉去PaddlePaddle镜像
30+
sudo docker pull paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82
3331

34-
**windows用户安装COCO-API方式:**
32+
# 切换到工作目录
33+
cd /home/work
3534

36-
# 若Cython未安装,请安装Cython
37-
pip install Cython
35+
# 创建ppdet容器
36+
# 将存放数据的当前目录映射到容器中的/ppdet目录中
37+
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
38+
```
39+
40+
可以在[DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) 中找到匹配您机器环境的镜像
41+
42+
```
43+
# ctrl+P+Q 退出容器, 使用如下命令重新进入docker环境:
44+
sudo docker exec -it ppdet /bin/bash
45+
```
46+
47+
其他更多docker用法,请参考PaddlePaddle[文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/install/docker/fromdocker.html)
48+
49+
50+
### 安装PaddlePaddle
51+
52+
```
53+
# CUDA9.0
54+
python -m pip install paddlepaddle-gpu==2.0.1.post90 -i https://mirror.baidu.com/pypi/simple
55+
56+
# CUDA10.1
57+
python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://mirror.baidu.com/pypi/simple
58+
59+
# CPU
60+
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
61+
```
3862

39-
# 由于原版cocoapi不支持windows,采用第三方实现版本,该版本仅支持Python3
40-
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
63+
更多安装方式例如conda或源码编译安装方法,请参考PaddlePaddle[安装文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/install/index_cn.html)
4164

42-
## PaddleDetection
65+
请确保您的PaddlePaddle安装成功并且版本不低于需求版本。使用以下命令进行验证。
4366

44-
**克隆PaddleDetection库:**
67+
```
68+
# 在您的Python解释器中确认PaddlePaddle安装成功
69+
>>> import paddle
70+
>>> paddle.utils.run_check()
71+
72+
# 确认PaddlePaddle版本
73+
python -c "import paddle; print(paddle.__version__)"
74+
```
75+
**注意**
76+
1. 如果您希望在多卡环境下使用PaddleDetection,请首先安装NCCL
4577

46-
您可以通过以下命令克隆PaddleDetection:
78+
### 3. 安装PaddleDetection
4779

4880
```
81+
# 克隆PaddleDetection仓库
4982
cd <path/to/clone/PaddleDetection>
5083
git clone https://github.com/PaddlePaddle/PaddleDetection.git
84+
85+
# 安装其他依赖
86+
pip install -r requirements.txt
87+
88+
# 安装PaddleDetection
89+
cd PaddleDetection
90+
python setup.py install
5191
```
5292

53-
也可以通过 [https://gitee.com/paddlepaddle/PaddleDetection](https://gitee.com/paddlepaddle/PaddleDetection) 克隆。
93+
**注意**
94+
95+
1. 由于原版cocoapi不支持windows,采用第三方实现版本,该版本仅支持Python3
96+
97+
```pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI```
98+
99+
100+
安装后确认测试通过:
101+
54102
```
55-
cd <path/to/clone/PaddleDetection>
56-
git clone https://gitee.com/paddlepaddle/PaddleDetection
103+
python ppdet/modeling/tests/test_architectures.py
57104
```
58105

59-
**安装PaddleDetection库:**
106+
测试通过后会提示如下信息:
60107

61108
```
62-
cd PaddleDetection/dygraph
63-
python setup.py install
109+
..........
110+
----------------------------------------------------------------------
111+
Ran 12 tests in 2.480s
112+
OK (skipped=2)
64113
```
65114

66-
**预训练模型预测**
115+
## 快速体验
67116

68-
使用预训练模型预测图像,快速体验模型预测效果:
117+
**恭喜!**您已经成功安装了PaddleDetection,接下来快速体验目标检测效果
69118

70119
```
71-
# use_gpu参数设置是否使用GPU
72-
python tools/infer.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddlemodels.bj.bcebos.com/object_detection/dygraph/ppyolo_r50vd_dcn_1x_coco.pdparams --infer_img=demo/000000014439.jpg
120+
# 在GPU上预测一张图片
121+
export CUDA_VISIBLE_DEVICES=0
122+
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
73123
```
74124

75125
会在`output`文件夹下生成一个画有预测结果的同名图像。
76126

77127
结果如下图:
78128

79-
![demo image](../images/000000014439.jpg)
129+
![](../images/000000014439.jpg)

ppdet/data/source/dataset.py

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def __init__(self,
125125
self.roidbs = None
126126
self.sample_num = sample_num
127127

128+
def check_or_download_dataset(self):
129+
return
130+
128131
def parse_dataset(self, ):
129132
if not self.roidbs:
130133
self.roidbs = self._load_images()

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ opencv-python
55
PyYAML
66
shapely
77
scipy
8-
terminaltables
8+
terminaltables
9+
pycocotools

0 commit comments

Comments
 (0)