Install the Protocol Buffers (protobuf) compiler with the following commands. Create a directory for protobuf and download the library directly:
mkdir protoc_3.3
cd protoc_3.3
wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
Change the permission of the folder and extract the contents, as shown here:
chmod 775 protoc-3.3.0-linux-x86_64.zip
unzip protoc-3.3.0-linux-x86_64.zip
Protocol Buffers (protobuf) is Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. It serves the use of XML but is much simpler and faster. The models are usually exported to this format in TensorFlow. One can define the data structure once but can be read or written in a variety of languages. Then run the following command to compile the protobufs. Move back to the working folder and clone the repo from https://github.com/tensorflow/models.git and move them to the following folder:
git clone https://github.com/tensorflow/models.git
Now, move the model to the research folder, using the following code:
cd models/research/
~/protoc_3.3/bin/protoc object_detection/protos/*.proto --python_out=.
The TensorFlow object detection API uses protobufs for exporting model weights and the training parameters. The TensorFlow, models, research, and slim directories should be appended to PYTHONPATH by the following command:
export PYTHONPATH=.:./slim/
Adding to the python path with the preceding command works only one time. For the next, this command has to be run again. The installation can be tested by running the following code:
python object_detection/builders/model_builder_test.py
The output of this code is given here:
Ran 7 tests in 0.022s
OK