-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvideo-detect.py
More file actions
34 lines (25 loc) · 744 Bytes
/
video-detect.py
File metadata and controls
34 lines (25 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 09:57:31 2020
@author: tanmay
"""
import argparse
from imageai.Detection import VideoObjectDetection
parser = argparse.ArgumentParser()
parser.add_argument(
'--path',
help = 'Path to Video',
type = str,
required = True
)
args = parser.parse_args()
arguments = args.__dict__
detector = VideoObjectDetection()
detector.setModelTypeAsTinyYOLOv3()
detector.setModelPath("yolo-tiny.h5")
detector.loadModel()
video_path = detector.detectObjectsFromVideo(input_file_path = arguments.pop("path"),
output_file_path = "new.mp4",
frames_per_second = 20, log_progress = True)
print(video_path)