jwoody02 / animal_detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IMPORTANT: YOU MUST PROVIDE YOUR OWN MODEL

the model I made is over 500mb which exceeds github's max file requirements. I cannot provide my training files either as they exceed 500mb.

Object detection using deep learning with OpenCV and Python

This is my implementation of object detection using OpenCV and python. The model I trained is specifically trained to recognize animals. Hoping that some non-profit organizations can use this in the future so categorize and identify endangered species (I know a non-profit that does this for the endangered kenya giraffe and thats how I got the idea). Depending on CPU, takes about .5 seconds to recognize each image so non-profits could use at a rate of 120 images/minute

OpenCV dnn module supports running inference on pre-trained deep learning models from popular frameworks like Caffe, Torch and TensorFlow.

When it comes to object detection, popular detection frameworks are

  • YOLO
  • SSD
  • Faster R-CNN

Support for running YOLO/DarkNet has been added to OpenCV dnn module recently.

Dependencies

  • opencv
  • numpy

pip install numpy opencv-python

Note: Compatability with Python 2.x is not officially tested.

YOLO (You Only Look Once)

Download the pre-trained YOLO v3 weights file from this link and place it in the current directory or you can directly download to the current directory in terminal using

$ wget https://pjreddie.com/media/files/yolov3.weights

Provided all the files are in the current directory, below command will apply object detection on the input image dog.jpg.

$ python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt

Command format

$ python yolo_opencv.py --image /path/to/input/image --config /path/to/config/file --weights /path/to/weights/file --classes /path/to/classes/file

Checkout the blog post to learn more.

sample output :

Checkout the object detection implementation available in cvlib which enables detecting common objects in the context through a single function call detect_common_objects().

(SSD and Faster R-CNN examples will be added soon)

animal_detection

About


Languages

Language:Python 100.0%