A simple image-based object detection tensorflow app in Python Originally forked from here.
In my case, I have installed Python 3.6.2 via Anaconda. If you want to do that (which I recommend), download the corresponding installer from Anaconda's website.
Select your OS and install Tensorflow following the installation guide. I have installed the Ubuntu TensorFlow with CPU support via pip install
.
The object_detection
module from Tensorflow is not installed by default. You should download it from the Tensorflow Github repo and place it in the Tensorflow home directory. Clone or download this repo, extract the object_detection
folder, and place ir in <PATH_TO_YOUR_TF>/models
.
If you're wondering where your Tensorflow installation is, try this (if you've installed it via pip
):
pip show tensorflow
To make object_detection
libs available, do this in Python:
import sys
sys.path.append('<PATH_TO_TENSORFLOW>/models')
sys.path.append('<PATH_TO_TENSORFLOW>/models/slim')
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
If you installed Python through Anaconda, the <PATH_TO_TENSORFLOW>
will look like /home/<YOUR_USER>/anaconda3/lib/python3.6/site-packages/tensorflow
.
Make sure that you have downloaded moviepy
and ffmpeg
for image processing.
pip install moviepy
sudo apt-get install ffmpeg
python tf_simple_object_detection.py