INSTALL.md 4.9 KB
Newer Older
1 2 3 4 5 6 7 8
English | [简体中文](INSTALL_cn.md)

# Installation


This document covers how to install PaddleDetection and its dependencies
(including PaddlePaddle), together with COCO and Pascal VOC dataset.

9
For general information about PaddleDetection, please see [README.md](https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.5).
10 11 12

## Requirements:

G
Guanghua Yu 已提交
13
- PaddlePaddle 2.2
14
- OS 64 bit
G
Guanghua Yu 已提交
15
- Python 3(3.5.1+/3.6/3.7/3.8/3.9),64 bit
16
- pip/pip3(9.0.1+), 64 bit
17
- CUDA >= 10.2
18 19 20
- cuDNN >= 7.6


21 22 23 24
Dependency of PaddleDetection and PaddlePaddle:

| PaddleDetection version | PaddlePaddle version  |    tips    |
| :----------------: | :---------------: | :-------: |
25
|    develop           |       develop   |     Dygraph mode is set as default    |
26
|    release/2.5       |       >= 2.2.2   |     Dygraph mode is set as default    |
K
Kaipeng Deng 已提交
27
|    release/2.4       |       >= 2.2.2   |     Dygraph mode is set as default    |
28
|    release/2.3       |       >= 2.2.0rc |     Dygraph mode is set as default    |
29
|    release/2.2       |       >= 2.1.2   |     Dygraph mode is set as default    |
G
Guanghua Yu 已提交
30
|    release/2.1       |       >= 2.1.0   |     Dygraph mode is set as default    |
31 32 33 34 35 36 37
|    release/2.0       |       >= 2.0.1    |     Dygraph mode is set as default    |
|    release/2.0-rc    |       >= 2.0.1    |     --    |
|    release/0.5       |       >= 1.8.4    |  Cascade R-CNN and SOLOv2 depends on 2.0.0.rc |
|    release/0.4       |       >= 1.8.4    |  PP-YOLO depends on 1.8.4 |
|    release/0.3       |        >=1.7      |     --    |


38 39
## Instruction

K
Kaipeng Deng 已提交
40
### 1. Install PaddlePaddle
41 42 43

```

44 45
# CUDA10.2
python -m pip install paddlepaddle-gpu==2.2.2 -i https://mirror.baidu.com/pypi/simple
46 47

# CPU
48
python -m pip install paddlepaddle==2.2.2 -i https://mirror.baidu.com/pypi/simple
49 50
```

G
Guanghua Yu 已提交
51 52
- For more CUDA version or environment to quick install, please refer to the [PaddlePaddle Quick Installation document](https://www.paddlepaddle.org.cn/install/quick)
- 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)
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

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__)"
```

**Note**

1.  If you want to use PaddleDetection on multi-GPU, please install NCCL at first.


K
Kaipeng Deng 已提交
70 71 72 73 74 75 76 77
### 2. Install PaddleDetection



**Note:** Installing via pip only supports Python3

```

78 79 80 81 82
# Clone PaddleDetection repository
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git

# Install other dependencies
83
cd PaddleDetection
84 85
pip install -r requirements.txt

86 87 88
# Compile and install paddledet
python setup.py install

89 90 91 92
```

**Note**

K
Kaipeng Deng 已提交
93
1. If you are working on Windows OS, `pycocotools` installing may failed because of the origin version of cocoapi does not support windows, another version can be used used which only supports Python3:
94 95 96

    ```pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI```

97 98
2. If you are using Python <= 3.6, `pycocotools` installing may failed with error like `distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cython>=0.27.3')`, please install `cython` firstly, for example `pip install cython`

99 100 101 102 103 104 105 106 107
After installation, make sure the tests pass:

```shell
python ppdet/modeling/tests/test_architectures.py
```

If the tests are passed, the following information will be prompted:

```
108
.......
109
----------------------------------------------------------------------
110
Ran 7 tests in 12.816s
K
Kaipeng Deng 已提交
111
OK
112 113
```

114 115 116 117 118 119
## Use built Docker images

> If you  do not have a Docker environment, please refer to [Docker](https://www.docker.com/).

We provide docker images containing the latest PaddleDetection code, and all environment and package dependencies are pre-installed. All you have to do is to **pull and run the docker image**. Then you can enjoy PaddleDetection without any extra steps.

120
Get these images and guidance in [docker hub](https://hub.docker.com/repository/docker/paddlecloud/paddledetection), including CPU, GPU, ROCm environment versions.
121 122 123

If you have some customized requirements about automatic building docker images, you can get it in github repo [PaddlePaddle/PaddleCloud](https://github.com/PaddlePaddle/PaddleCloud/tree/main/tekton).

124 125 126 127 128 129 130
## Inference demo

**Congratulation!** Now you have installed PaddleDetection successfully and try our inference demo:

```
# Predict an image by GPU
export CUDA_VISIBLE_DEVICES=0
131
python tools/infer.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams --infer_img=demo/000000014439.jpg
132 133 134 135 136 137
```

An image of the same name with the predicted result will be generated under the `output` folder.
The result is as shown below:

![](../images/000000014439.jpg)