Spaces:
Runtime error
Runtime error
Commit ·
a0b3df8
1
Parent(s): add38cc
Update tracker.py
Browse files- lib/fish_eye/tracker.py +18 -10
lib/fish_eye/tracker.py
CHANGED
|
@@ -6,6 +6,7 @@ import numpy as np
|
|
| 6 |
|
| 7 |
from fish_length import Fish_Length
|
| 8 |
from sort import Sort
|
|
|
|
| 9 |
|
| 10 |
class Tracker:
|
| 11 |
def __init__(self, clip_info, algorithm=Sort, args={'max_age':1, 'min_hits':0, 'iou_threshold':0.05}, min_hits=3):
|
|
@@ -24,16 +25,23 @@ class Tracker:
|
|
| 24 |
# Match confidence with correct track
|
| 25 |
conf = 0
|
| 26 |
min_score = 1000000
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Assign Track
|
| 39 |
self.fish_ids[int(track[4])] += 1
|
|
|
|
| 6 |
|
| 7 |
from fish_length import Fish_Length
|
| 8 |
from sort import Sort
|
| 9 |
+
from associative import Associate
|
| 10 |
|
| 11 |
class Tracker:
|
| 12 |
def __init__(self, clip_info, algorithm=Sort, args={'max_age':1, 'min_hits':0, 'iou_threshold':0.05}, min_hits=3):
|
|
|
|
| 25 |
# Match confidence with correct track
|
| 26 |
conf = 0
|
| 27 |
min_score = 1000000
|
| 28 |
+
if self.algorithm == Sort:
|
| 29 |
+
for det in dets:
|
| 30 |
+
score = sum(abs(det[0:4] - track[0:4]))
|
| 31 |
+
if (score < min_score):
|
| 32 |
+
min_score = score
|
| 33 |
+
conf = det[4]
|
| 34 |
+
elif self.algorith == Associate:
|
| 35 |
+
for det in dets[0]:
|
| 36 |
+
score = sum(abs(det[0:4] - track[0:4]))
|
| 37 |
+
if (score < min_score):
|
| 38 |
+
min_score = score
|
| 39 |
+
conf = det[4]
|
| 40 |
+
for det in dets[1]:
|
| 41 |
+
score = sum(abs(det[0:4] - track[0:4]))
|
| 42 |
+
if (score < min_score):
|
| 43 |
+
min_score = score
|
| 44 |
+
conf = det[4]
|
| 45 |
|
| 46 |
# Assign Track
|
| 47 |
self.fish_ids[int(track[4])] += 1
|