"vscode:/vscode.git/clone" did not exist on "f5b9f783a1873ae980986bd926380d945e96bc66"
INSTALL_INSTRUCTIONS.md 2.63 KB
Newer Older
Andre Araujo's avatar
Andre Araujo committed
1
2
3
4
5
6
7
8
9
10
## DELF installation

### Tensorflow

For detailed steps to install Tensorflow, follow the [Tensorflow installation
instructions](https://www.tensorflow.org/install/). A typical user can install
Tensorflow using one of the following commands:

```bash
# For CPU:
11
pip install 'tensorflow==1.14'
Andre Araujo's avatar
Andre Araujo committed
12
# For GPU:
13
pip install 'tensorflow-gpu==1.14'
Andre Araujo's avatar
Andre Araujo committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
```

### Protobuf

The DELF library uses [protobuf](https://github.com/google/protobuf) (the python
version) to configure feature extraction and its format. You will need the
`protoc` compiler, version >= 3.3. The easiest way to get it is to download
directly. For Linux, this can be done as (see
[here](https://github.com/google/protobuf/releases) for other platforms):

```bash
wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
unzip protoc-3.3.0-linux-x86_64.zip
PATH_TO_PROTOC=`pwd`
```

### Python dependencies

Install python library dependencies:

```bash
35
pip install matplotlib numpy scikit-image scipy
Andre Araujo's avatar
Andre Araujo committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
```

### `tensorflow/models`

Now, clone `tensorflow/models`, and install required libraries: (note that the
`object_detection` library requires you to add `tensorflow/models/research/` to
your `PYTHONPATH`, as instructed
[here](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md))

```bash
git clone https://github.com/tensorflow/models

# First, install slim's "nets" package.
cd models/research/slim/
50
pip install -e .
Andre Araujo's avatar
Andre Araujo committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

# Second, setup the object_detection module by editing PYTHONPATH.
cd ..
# From tensorflow/models/research/
export PYTHONPATH=$PYTHONPATH:`pwd`
```

Then, compile DELF's protobufs. Use `PATH_TO_PROTOC` as the directory where you
downloaded the `protoc` compiler.

```bash
# From tensorflow/models/research/delf/
${PATH_TO_PROTOC?}/bin/protoc delf/protos/*.proto --python_out=.
```

Finally, install the DELF package.

```bash
# From tensorflow/models/research/delf/
70
pip install -e . # Install "delf" package.
Andre Araujo's avatar
Andre Araujo committed
71
72
73
74
75
76
77
78
79
80
```

At this point, running

```bash
python -c 'import delf'
```

should just return without complaints. This indicates that the DELF package is
loaded successfully.
81
82
83
84
85
86
87
88
89
90
91
92
93

### Troubleshooting

#### Python version

Installation issues may happen if multiple python versions are mixed. The
instructions above assume python2.7 version is used; if using python3.X, be sure
to use `pip3` instead of `pip`, and all should work.

#### `pip install`

Issues might be observed if using `pip install` with `-e` option (editable
mode). You may try out to simply remove the `-e` from the commands above. Also,
94
95
depending on your machine setup, you might need to run the `sudo pip install` command,
that is with a `sudo` at the beginning.