TF_ObjectDetection_API
TF_ObjectDetection_API copied to clipboard
Tutorial on how to create your own object detection dataset and train using TensorFlow's API
TensorFlow Object Detection API Tutorial
This repository has the code from my O'Reilly article published on October 25, 2017.
Required Packages
There are two ways you can install these packages: by using Docker or by using native Python 3.5.
Using Docker
-
Download and install Docker. If using Ubuntu 14.04/16.04 I wrote my own instructions for installing docker here.
-
Download and unzip this entire repo from GitHub, either interactively, or by entering
git clone https://github.com/wagonhelm/TF_ObjectDetection_API.git
-
Open your terminal and use
cd
to navigate into the directory of the repo on your machinecd TF_ObjectDetection_API
-
To build the Dockerfile, enter
docker build -t object_dockerfile -f dockerfile .
If you get a permissions error on running this command, you may need to run it with
sudo
:sudo docker build -t object_dockerfile -f dockerfile .
-
Run Docker from the Dockerfile you've just built
docker run -it -p 8888:8888 -p 6006:6006 object_dockerfile bash
or
sudo docker run -it -p 8888:8888 -p 6006:6006 object_dockerfile bash
if you run into permission problems.
-
Install TensorFlow Object Detection API
cd models/research/ protoc object_detection/protos/*.proto --python_out=. export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim cd .. cd ..
-
Launch Jupyter and Tensorboard both by using tmux
tmux jupyter notebook --allow-root
Press CTL+B
thenC
to open a new tmux window, thentensorboard --logdir='data'
To switch windows
Press CTL+B
thenwindow #
Once both jupyter and tensorboard are running, using your browser, navigate to the URLs shown in the terminal output if those don't work try http://localhost:8888/ for Jupyter Notebook and http://localhost:6006/ for Tensorboard. I had issues with using TensorBoard with Firefox when launched from Docker.
Using Native Python 3
- Install system requirements
sudo apt-get install -y git-core wget protobuf-compiler
- Download and unzip this entire repo from GitHub, either interactively, or by entering
git clone https://github.com/wagonhelm/TF_ObjectDetection_API.git
- Install Python Requirement
cd TF_ObjectDetection_API
# Requires sudo if not in a virtual environment
pip3 install -r requirements.txt
pip3 install tensorflow jupyter
- Clone TensorFlow Models Into Repository Directory and Install Object Detection API
cd TF_ObjectDetection_API
git clone https://github.com/tensorflow/models.git
You will have to run this command every time you close your terminal unless you add the the path to slim to your .bashrc
file
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
cd ..
cd ..
- Launch Jupyter
jupyter notebook
- Launch Tensorboard In New Terminal
tensorboard --logdir='data'
Once both jupyter and tensorboard are running, using your browser, navigate to the URLs shown in the terminal output if those don't work try http://localhost:8888/ for Jupyter Notebook and http://localhost:6006/ for Tensorboard.