INSTALL.md 4.3 KB
Newer Older
Q
qingqing01 已提交
1 2
English | [简体中文](INSTALL_cn.md)

3 4 5 6 7 8 9 10 11 12 13 14 15 16
# Installation

---
## Table of Contents

- [Introduction](#introduction)
- [PaddlePaddle](#paddlepaddle)
- [Other Dependencies](#other-dependencies)
- [PaddleDetection](#paddle-detection)


## Introduction

This document covers how to install PaddleDetection, its dependencies
Q
qingqing01 已提交
17
(including PaddlePaddle), together with COCO and Pascal VOC dataset.
18

C
cnn 已提交
19
For general information about PaddleDetection, please see [README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/).
20 21


G
Guanghua Yu 已提交
22
## Install PaddlePaddle
23

G
Guanghua Yu 已提交
24
### Requirements:
C
cnn 已提交
25 26 27
- 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
G
Guanghua Yu 已提交
28 29 30 31 32 33 34 35 36
- CUDA >= 9.0
- cuDNN >= 7.6

If you need GPU multi-card training, firstly please install NCCL. (Windows does not support nccl).

PaddleDetection depends on PaddlePaddle version relationship:

| PaddleDetection version | PaddlePaddle version  |    tips    |
| :----------------: | :---------------: | :-------: |
C
cnn 已提交
37 38 39 40 41
|    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    |     --    |

G
Guanghua Yu 已提交
42 43

If you want install paddlepaddle, please follow the instructions in [installation document](http://www.paddlepaddle.org.cn/).
44

C
cnn 已提交
45 46 47 48 49 50 51
```
# 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
52

C
cnn 已提交
53 54
install paddlepaddle CPU
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
55 56
```

C
cnn 已提交
57 58 59 60
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.

61
```
C
cnn 已提交
62 63 64
# check
>>> import paddle
>>> paddle.utils.run_check()
65

C
cnn 已提交
66 67 68
# confirm the paddle's version
python -c "import paddle; print(paddle.__version__)"
```
69 70 71 72 73 74


## Other Dependencies

[COCO-API](https://github.com/cocodataset/cocoapi):

K
Kaipeng Deng 已提交
75
COCO-API is needed for running. Installation is as follows:
76 77 78 79 80 81 82 83 84 85

    git clone https://github.com/cocodataset/cocoapi.git
    cd cocoapi/PythonAPI
    # if cython is not installed
    pip install Cython
    # Install into global site-packages
    make install
    # Alternatively, if you do not have permissions or prefer
    # not to install the COCO API into global site-packages
    python setup.py install --user
86 87
    # or with pip
    pip install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"
88

89 90 91 92 93 94
**Installation of COCO-API in windows:**

    # if cython is not installed
    pip install Cython
    # Because the origin version of cocoapi does not support windows, another version is used which only supports Python3
    pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
95 96 97 98 99

## PaddleDetection

**Clone Paddle models repository:**

100
You can clone PaddleDetection with the following commands:
101 102

```
103 104
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git
105 106 107 108
```

**Install Python dependencies:**

109
Required python packages are specified in [requirements.txt](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/static/requirements.txt), and can be installed with:
110 111 112 113 114

```
pip install -r requirements.txt
```

G
Guanghua Yu 已提交
115 116 117
**Make sure the tests pass:**

```shell
118 119 120
python ppdet/modeling/tests/test_architectures.py
```

C
cnn 已提交
121
After the test is passed, the following information will be prompted:
K
Kaipeng Deng 已提交
122
```
C
cnn 已提交
123 124 125 126
..........
----------------------------------------------------------------------
Ran 12 tests in 2.480s
OK (skipped=2)
K
Kaipeng Deng 已提交
127 128
```

C
cnn 已提交
129
**Infer by pretrained-model**
130

C
cnn 已提交
131
Use the pre-trained model to predict the image:
132 133

```
C
cnn 已提交
134 135
# 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
136 137
```

C
cnn 已提交
138 139
An image of the same name with the predicted result will be generated under the `output` folder.
The result is as shown below:
140

C
cnn 已提交
141
![](../images/000000014439.jpg)