Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

cmower/object-detection-opencv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object detection using deep learning with OpenCV and Python

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.

Install

  1. Clone repository: $ [email protected]:cmower/object-detection-opencv.git
  2. Change directory: $ cd object-detection-opencv
  3. Install: $ pip install .

Usage

Either you can use the command line interface yolo_opencv (see examples below) or import the package using

import yolo_opencv

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.

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

Command format

$ yolo_opencv --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)

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%