Как извлечь обнаруженные объекты в видео с помощью ImageAI - PullRequest
1 голос
/ 21 февраля 2020

Я использовал ImageAI для обнаружения транспортных средств в видео, и мое требование - сохранять обнаруженные транспортные средства в отдельной папке как изображения во время обработки видео. Код, который я использовал, приведен.

from imageai.Detection import VideoObjectDetection
import os

execution_path = os.getcwd()

detector = VideoObjectDetection()
detector.setModelTypeAsTinyYOLOv3()
detector.setModelPath( os.path.join(execution_path , "yolo-tiny.h5"))
detector.loadModel()

custom_objects = detector.CustomObjects( motorcycle=True, car=True, bus=True,truck=True,)

video_path = detector.detectCustomObjectsFromVideo(custom_objects=custom_objects, 
                                input_file_path=os.path.join(execution_path, 
                               'C:\\Users\\priyan\\Desktop\\Number plate identification\\Test 
                                Videos\\test04.mp4'),output_file_path=os.path.join(execution_path, 
                               "traffic_custom_detected"),frames_per_second=20, log_progress=True)
print(video_path)
...