Use machine learning for computer vision to draw bounding boxes around dogs in pictures. See accompanying blog post.
NBViewer for easier viewing (recommended) here
-
(Optional) Create Anaconda environment w/ Python 3.6:
$ conda create -n retinanet python=3.6 anaconda
-
(Optional) Activate virtual environment:
$ source activate retinanet
-
Install dependencies:
$ conda install tensorflow numpy scipy opencv pillow matplotlib h5py keras
-
Install ImageAI library:
$ pip install https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.1/imageai-2.0.1-py3-none-any.whl
-
Download pretrained RetinaNet model: https://github.com/OlafenwaMoses/ImageAI/releases/download/1.0/resnet50_coco_best_v2.0.1.h5
Image_detection.ipynb
: Jupyter notebook, walks through the steps and set updetect_single_image.py
: Script to run to run object detection on a single image file. Setinput_path
to your image file.detect_images_folder.py
: Script to run to run object detection on images in a folder. Setinput_images_path
toyour-folder/*
. Resulting images can be found inresults/
directory. Keep in mind that theresults
folder images will be overwritten each time you run the script, so move previous files elsewhere.