INSTALL.md 2.05 KB
Newer Older
Kai Chen's avatar
Kai Chen committed
1
2
3
4
5
6
## Installation

### Requirements

- Linux (tested on Ubuntu 16.04 and CentOS 7.2)
- Python 3.4+
Kai Chen's avatar
Kai Chen committed
7
- PyTorch 1.0
Kai Chen's avatar
Kai Chen committed
8
- Cython
Kai Chen's avatar
Kai Chen committed
9
- [mmcv](https://github.com/open-mmlab/mmcv) >= 0.2.2
Kai Chen's avatar
Kai Chen committed
10
11
12

### Install mmdetection

Kai Chen's avatar
Kai Chen committed
13
a. Install PyTorch 1.0 and torchvision following the [official instructions](https://pytorch.org/).
Kai Chen's avatar
Kai Chen committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

b. Clone the mmdetection repository.

```shell
git clone https://github.com/open-mmlab/mmdetection.git
```

c. Compile cuda extensions.

```shell
cd mmdetection
pip install cython  # or "conda install cython" if you prefer conda
./compile.sh  # or "PYTHON=python3 ./compile.sh" if you use system python3 without virtual environments
```

d. Install mmdetection (other dependencies will be installed automatically).

```shell
python(3) setup.py install  # add --user if you want to install it locally
# or "pip install ."
```

Note: You need to run the last step each time you pull updates from github.
The git commit id will be written to the version number and also saved in trained models.

### Prepare COCO dataset.

It is recommended to symlink the dataset root to `$MMDETECTION/data`.

```
mmdetection
├── mmdet
├── tools
├── configs
├── data
│   ├── coco
│   │   ├── annotations
│   │   ├── train2017
│   │   ├── val2017
│   │   ├── test2017
│   ├── VOCdevkit
│   │   ├── VOC2007
│   │   ├── VOC2012

```

### Scripts
Just for reference, [Here](https://gist.github.com/hellock/bf23cd7348c727d69d48682cb6909047) is
a script for setting up mmdetection with conda.
pangjm's avatar
pangjm committed
63
64

### Notice
pangjm's avatar
pangjm committed
65
66
67
68
You can run `python(3) setup.py develop` or `pip install -e .` to install mmdetection if you want to make modifications to it frequently.

If there are more than one mmdetection on your machine, and you want to use them alternatively.
Please insert the following code to the main file
pangjm's avatar
pangjm committed
69
```python
pangjm's avatar
pangjm committed
70
71
72
import os.path as osp
import sys
sys.path.insert(0, osp.join(osp.dirname(osp.abspath(__file__)), '../'))
pangjm's avatar
pangjm committed
73
```
pangjm's avatar
pangjm committed
74
or run the following command in the terminal of corresponding folder.
pangjm's avatar
pangjm committed
75
76
77
```shell
export PYTHONPATH=`pwd`:$PYTHONPATH
```