Skip to content

alexsikorski/live-object-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Live Object Detection

Detect objects in a webcam feed using OpenCV.

What's being used

  • Python 3.8
  • OpenCV
  • YOLO V3 tiny/416 cfg and weights
  • Your CPU/GPU

How to run

  • Download respective YOLO V3 cfg and weights files, I used YOLOv3-416 and YOLOv3-tiny.
  • Configure as desired.
  • Run detect.py.

Configurations

More than one camera?

capture = cv2.VideoCapture(0) # where 0 is the first connected device

How do I display objects with lower confidence percentages?

confidence_threshold = 0.8 # alter this value where 0.8 is 80%

How do I use my GPU?

# uncomment these
#network.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
#network.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)

I want to use different YOLO weights and cfg.

# change this value to the respective width, height target
wh_target = 320 # for example for the YOLO V3 320 files
# also change these to the appropriate files
model_config = 'yolov3.cfg'
model_weights = 'yolov3.weights'

Result

Detecting a mobile phone and a person

Releases

No releases published

Packages

No packages published

Languages