INSTALL.md 3.5 KB
Newer Older
Y
Yang Zhang 已提交
1
# Installation
K
Kaipeng Deng 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14

---
## Table of Contents

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


## Introduction

Y
Yang Zhang 已提交
15
This document covers how to install PaddleDetection, its dependencies
Q
qingqing01 已提交
16
(including PaddlePaddle), together with COCO and Pascal VOC dataset.
K
Kaipeng Deng 已提交
17 18 19 20 21 22

For general information about PaddleDetection, please see [README.md](../README.md).


## PaddlePaddle

J
jerrywgz 已提交
23
Running PaddleDetection requires PaddlePaddle Fluid v.1.5 and later. please follow the instructions in [installation document](http://www.paddlepaddle.org.cn/).
K
Kaipeng Deng 已提交
24

Y
Yang Zhang 已提交
25 26
Please make sure your PaddlePaddle installation was successful and the version
of your PaddlePaddle is not lower than required. Verify with the following commands.
K
Kaipeng Deng 已提交
27 28

```
K
Kaipeng Deng 已提交
29
# To check PaddlePaddle installation in your Python interpreter
W
wangguanzhong 已提交
30
>>> import paddle.fluid as fluid
K
Kaipeng Deng 已提交
31
>>> fluid.install_check.run_check()
K
Kaipeng Deng 已提交
32

Y
Yang Zhang 已提交
33
# To check PaddlePaddle version
K
Kaipeng Deng 已提交
34 35 36 37 38 39 40
python -c "import paddle; print(paddle.__version__)"
```

### Requirements:

- Python2 or Python3
- CUDA >= 8.0
41
- cuDNN >= 5.0
K
Kaipeng Deng 已提交
42 43 44 45 46
- nccl >= 2.1.2


## Other Dependencies

Y
Yang Zhang 已提交
47
[COCO-API](https://github.com/cocodataset/cocoapi):
K
Kaipeng Deng 已提交
48

K
Kaipeng Deng 已提交
49
COCO-API is needed for running. Installation is as follows:
K
Kaipeng Deng 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

    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


## PaddleDetection

**Clone Paddle models repository:**

Y
Yang Zhang 已提交
66 67
You can clone Paddle models and change working directory to PaddleDetection
with the following commands:
K
Kaipeng Deng 已提交
68 69 70 71

```
cd <path/to/clone/models>
git clone https://github.com/PaddlePaddle/models
Q
qingqing01 已提交
72
cd models/PaddleCV/PaddleDetection
K
Kaipeng Deng 已提交
73 74
```

Y
Yang Zhang 已提交
75
**Install Python dependencies:**
K
Kaipeng Deng 已提交
76

Q
qingqing01 已提交
77
Required python packages are specified in [requirements.txt](../requirements.txt), and can be installed with:
K
Kaipeng Deng 已提交
78 79 80 81 82

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

Y
Yang Zhang 已提交
83
**Make sure the tests pass:**
K
Kaipeng Deng 已提交
84 85

```
86
export PYTHONPATH=`pwd`:$PYTHONPATH
K
Kaipeng Deng 已提交
87 88 89 90 91 92
python ppdet/modeling/tests/test_architectures.py
```


## Datasets

Q
qingqing01 已提交
93
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.
K
Kaipeng Deng 已提交
94

Y
Yang Zhang 已提交
95
**Create symlinks for local datasets:**
K
Kaipeng Deng 已提交
96

Q
qingqing01 已提交
97
Default dataset path in config files is `dataset/coco` and `dataset/voc`, if the
Y
Yang Zhang 已提交
98 99
datasets are already available on disk, you can simply create symlinks to
their directories:
K
Kaipeng Deng 已提交
100 101

```
Q
qingqing01 已提交
102 103
ln -sf <path/to/coco> <path/to/paddle_detection>/dataset/coco
ln -sf <path/to/voc> <path/to/paddle_detection>/dataset/voc
K
Kaipeng Deng 已提交
104 105
```

Y
Yang Zhang 已提交
106 107 108
**Download datasets manually:**

On the other hand, to download the datasets, run the following commands:
K
Kaipeng Deng 已提交
109

Q
qingqing01 已提交
110
- COCO
K
Kaipeng Deng 已提交
111 112

```
K
Kaipeng Deng 已提交
113 114
export PYTHONPATH=$PYTHONPATH:.
python dataset/coco/download_coco.py
K
Kaipeng Deng 已提交
115 116
```

Q
qingqing01 已提交
117
- Pascal VOC
K
Kaipeng Deng 已提交
118 119

```
K
Kaipeng Deng 已提交
120 121
export PYTHONPATH=$PYTHONPATH:.
python dataset/voc/download_voc.py
K
Kaipeng Deng 已提交
122 123
```

Y
Yang Zhang 已提交
124
**Download datasets automatically:**
K
Kaipeng Deng 已提交
125

Y
Yang Zhang 已提交
126
If a training session is started but the dataset is not setup properly (e.g,
Q
qingqing01 已提交
127 128
not found in `dataset/coco` or `dataset/voc`), PaddleDetection can automatically
download them from [COCO-2017](http://images.cocodataset.org) and
Y
Yang Zhang 已提交
129 130 131
[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.
K
Kaipeng Deng 已提交
132 133


Y
Yang Zhang 已提交
134
**NOTE:** For further informations on the datasets, please see [DATA.md](DATA.md)