Skip to content

Instantly share code, notes, and snippets.

@OlafenwaMoses
Created July 26, 2018 00:15
Show Gist options
  • Save OlafenwaMoses/f02ecb745b4309241bbf0a4e2c7fb91a to your computer and use it in GitHub Desktop.
Save OlafenwaMoses/f02ecb745b4309241bbf0a4e2c7fb91a to your computer and use it in GitHub Desktop.
from imageai.Detection import VideoObjectDetection
import os
import cv2
execution_path = os.getcwd()
camera = cv2.VideoCapture(0)
detector = VideoObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath(os.path.join(execution_path , "yolo.h5"))
detector.loadModel()
video_path = detector.detectObjectsFromVideo(camera_input=camera,
output_file_path=os.path.join(execution_path, "camera_detected_1")
, frames_per_second=29, log_progress=True)
print(video_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment