Spaces:
Runtime error
Runtime error
Commit
•
1446d23
1
Parent(s):
9c86395
Testing tracker conf
Browse files- inference.py +1 -0
- lib/fish_eye/tracker.py +1 -0
- visualizer.py +0 -10
inference.py
CHANGED
@@ -365,6 +365,7 @@ def do_associative_tracking(low_preds, high_preds, image_meter_width, image_mete
|
|
365 |
'image_meter_width': image_meter_width,
|
366 |
'image_meter_height': image_meter_height
|
367 |
}
|
|
|
368 |
tracker = Tracker(clip_info, algorithm=Associate, reverse=reverse, args={ 'max_age': max_age, 'min_hits': 0, 'iou_threshold': iou_thres}, min_hits=min_hits)
|
369 |
|
370 |
# Run tracking
|
|
|
365 |
'image_meter_width': image_meter_width,
|
366 |
'image_meter_height': image_meter_height
|
367 |
}
|
368 |
+
print("Tracking using Associate")
|
369 |
tracker = Tracker(clip_info, algorithm=Associate, reverse=reverse, args={ 'max_age': max_age, 'min_hits': 0, 'iou_threshold': iou_thres}, min_hits=min_hits)
|
370 |
|
371 |
# Run tracking
|
lib/fish_eye/tracker.py
CHANGED
@@ -29,6 +29,7 @@ class Tracker:
|
|
29 |
# Match confidence with correct track
|
30 |
conf = 0
|
31 |
min_score = 1000000
|
|
|
32 |
if self.algorithm == Sort:
|
33 |
print("SORT")
|
34 |
for det in dets:
|
|
|
29 |
# Match confidence with correct track
|
30 |
conf = 0
|
31 |
min_score = 1000000
|
32 |
+
print("algorithm", self.algorithm)
|
33 |
if self.algorithm == Sort:
|
34 |
print("SORT")
|
35 |
for det in dets:
|
visualizer.py
CHANGED
@@ -42,9 +42,6 @@ def generate_video_batches(didson, preds, frame_rate, video_out_path, gp=None, i
|
|
42 |
frames = didson.load_frames(start_frame=i, end_frame=batch_end)
|
43 |
vid_frames, h, w = get_video_frames(frames, preds, frame_rate, image_meter_width, image_meter_height, start_frame=i)
|
44 |
|
45 |
-
print("starting", i)
|
46 |
-
print("len frames", len(frames))
|
47 |
-
print("len vid_frames", len(vid_frames))
|
48 |
if out is None:
|
49 |
codec = cv2.VideoWriter_fourcc(*'avc1') if is_fourcc_available("avc1") else cv2.VideoWriter_fourcc(*'mp4v')
|
50 |
out = cv2.VideoWriter(video_out_path, codec, frame_rate, [ int(1.5*w), h ] )
|
@@ -54,7 +51,6 @@ def generate_video_batches(didson, preds, frame_rate, video_out_path, gp=None, i
|
|
54 |
out.write(frame)
|
55 |
pbar.update(1)
|
56 |
|
57 |
-
print("done", i)
|
58 |
del frames
|
59 |
del vid_frames
|
60 |
|
@@ -74,11 +70,8 @@ def get_video_frames(frames, preds, frame_rate, image_meter_width=None, image_me
|
|
74 |
|
75 |
# filter JSON, if necessary (for shorter clips)
|
76 |
preds_frames = preds['frames'][start_frame:]
|
77 |
-
print(len(preds['frames']))
|
78 |
-
print(start_frame)
|
79 |
|
80 |
vid_frames = []
|
81 |
-
print(len(frames))
|
82 |
if len(frames):
|
83 |
# assumes all frames the same size
|
84 |
h, w = frames[0].shape
|
@@ -90,8 +83,6 @@ def get_video_frames(frames, preds, frame_rate, image_meter_width=None, image_me
|
|
90 |
|
91 |
num_frames = min(len(frames), len(preds_frames))
|
92 |
|
93 |
-
print(len(frames[:num_frames]))
|
94 |
-
print(num_frames)
|
95 |
for i, frame_raw in enumerate(frames[:num_frames]):
|
96 |
frame_raw = cv2.resize(cv2.cvtColor(frame_raw, cv2.COLOR_GRAY2BGR), (w,h))
|
97 |
pred = preds_frames[i]
|
@@ -123,7 +114,6 @@ def get_video_frames(frames, preds, frame_rate, image_meter_width=None, image_me
|
|
123 |
|
124 |
vid_frames.append(frame)
|
125 |
|
126 |
-
print(len(vid_frames))
|
127 |
return vid_frames, h, w
|
128 |
|
129 |
def draw_fish(frame, left, right, top, bottom, color, fish_id, fish_len, LINE_HEIGHT=18, anno_align="left"):
|
|
|
42 |
frames = didson.load_frames(start_frame=i, end_frame=batch_end)
|
43 |
vid_frames, h, w = get_video_frames(frames, preds, frame_rate, image_meter_width, image_meter_height, start_frame=i)
|
44 |
|
|
|
|
|
|
|
45 |
if out is None:
|
46 |
codec = cv2.VideoWriter_fourcc(*'avc1') if is_fourcc_available("avc1") else cv2.VideoWriter_fourcc(*'mp4v')
|
47 |
out = cv2.VideoWriter(video_out_path, codec, frame_rate, [ int(1.5*w), h ] )
|
|
|
51 |
out.write(frame)
|
52 |
pbar.update(1)
|
53 |
|
|
|
54 |
del frames
|
55 |
del vid_frames
|
56 |
|
|
|
70 |
|
71 |
# filter JSON, if necessary (for shorter clips)
|
72 |
preds_frames = preds['frames'][start_frame:]
|
|
|
|
|
73 |
|
74 |
vid_frames = []
|
|
|
75 |
if len(frames):
|
76 |
# assumes all frames the same size
|
77 |
h, w = frames[0].shape
|
|
|
83 |
|
84 |
num_frames = min(len(frames), len(preds_frames))
|
85 |
|
|
|
|
|
86 |
for i, frame_raw in enumerate(frames[:num_frames]):
|
87 |
frame_raw = cv2.resize(cv2.cvtColor(frame_raw, cv2.COLOR_GRAY2BGR), (w,h))
|
88 |
pred = preds_frames[i]
|
|
|
114 |
|
115 |
vid_frames.append(frame)
|
116 |
|
|
|
117 |
return vid_frames, h, w
|
118 |
|
119 |
def draw_fish(frame, left, right, top, bottom, color, fish_id, fish_len, LINE_HEIGHT=18, anno_align="left"):
|