OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.55k stars 2.19k forks source link

Object detection in live feed- Output video runs very fast #177

Closed prashantsondkar closed 5 years ago

prashantsondkar commented 5 years ago

Hello I used the code to perform the object detection in live feed (camera). But output video runs very very fast.

Is there a setting I need to change in the code. Currently I am using the sample code as it is. Copied below

from imageai.Detection import VideoObjectDetection import os import cv2

execution_path = os.getcwd()

camera = cv2.VideoCapture(0)

detector = VideoObjectDetection() detector.setModelTypeAsRetinaNet() detector.setModelPath(os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5")) detector.loadModel()

video_path = detector.detectObjectsFromVideo(camera_input=camera, output_file_path=os.path.join(execution_path, "camera_detected_video") , frames_per_second=40, log_progress=True, minimum_percentage_probability=40)

prajintst commented 5 years ago

change the fps according to the detection speed. decrease your fps to 15 or less.