Как извлечь обнаруженные объекты на видео с помощью ImageAI

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

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)

0 ответов

Другие вопросы по тегам