-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpipeline.py
72 lines (54 loc) · 1.7 KB
/
pipeline.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from modules.data_reader import DataReader
from modules.object_detector_ssd import SSD
# from modules.object_detector_yolo import YOLO
from modules.reid_extractor import FeatureExtractor
from modules.tracker_deepsort import DeepSort
from modules.tube_manager import TubeManager
from modules.action_detector_acam import ACAM
import sys
# ============ Video Input Modules ============
reader = DataReader()
reader.Setup(sys.argv[1])
# ============ Object Detection Modules ============
ssd = SSD()
ssd.Setup()
# yolo = YOLO()
# yolo.Setup()
object_detector = ssd
# ============ Tracking Modules ============
feature_extractor = FeatureExtractor()
feature_extractor.Setup()
deepsort = DeepSort()
deepsort.Setup()
tracker = deepsort
# ============ Action Detection Modules ============
tube_manager = TubeManager()
tube_manager.Setup()
acam = ACAM()
acam.Setup()
action_detector = acam
while(True):
# Read input
frame_data = reader.PostProcess()
if not frame_data: # end of video
break
# Obj detection module
object_detector.PreProcess(frame_data)
object_detector.Apply()
obj_det_data = object_detector.PostProcess()
# Tracking module
feature_extractor.PreProcess(obj_det_data)
feature_extractor.Apply()
feature_data = feature_extractor.PostProcess()
tracker.PreProcess(feature_data)
tracker.Apply()
track_data = tracker.PostProcess()
# Action detection module
tube_manager.PreProcess(track_data)
tube_manager.Apply()
tube_data = tube_manager.PostProcess()
action_detector.PreProcess(tube_data)
action_detector.Apply()
action_data = action_detector.PostProcess()
if action_data:
print(action_data['meta']['obj'])