Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace np.<type alias> with base types #327

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tutorials/centertrack/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
36 changes: 18 additions & 18 deletions tutorials/centertrack/mot_online/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ def ious(atlbrs, btlbrs):

:rtype ious np.ndarray
"""
ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=np.float)
ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=float)
if ious.size == 0:
return ious

ious = bbox_ious(
np.ascontiguousarray(atlbrs, dtype=np.float),
np.ascontiguousarray(btlbrs, dtype=np.float)
np.ascontiguousarray(atlbrs, dtype=float),
np.ascontiguousarray(btlbrs, dtype=float)
)

return ious
Expand Down Expand Up @@ -109,13 +109,13 @@ def embedding_distance(tracks, detections, metric='cosine'):
:return: cost_matrix np.ndarray
"""

cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float)
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=float)
if cost_matrix.size == 0:
return cost_matrix
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
#for i, track in enumerate(tracks):
#cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric))
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
return cost_matrix

Expand All @@ -127,17 +127,17 @@ def embedding_distance2(tracks, detections, metric='cosine'):
:return: cost_matrix np.ndarray
"""

cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float)
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=float)
if cost_matrix.size == 0:
return cost_matrix
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
#for i, track in enumerate(tracks):
#cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric))
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
track_features = np.asarray([track.features[0] for track in tracks], dtype=np.float)
track_features = np.asarray([track.features[0] for track in tracks], dtype=float)
cost_matrix2 = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
track_features = np.asarray([track.features[len(track.features)-1] for track in tracks], dtype=np.float)
track_features = np.asarray([track.features[len(track.features)-1] for track in tracks], dtype=float)
cost_matrix3 = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
for row in range(len(cost_matrix)):
cost_matrix[row] = (cost_matrix[row]+cost_matrix2[row]+cost_matrix3[row])/3
Expand All @@ -149,11 +149,11 @@ def vis_id_feature_A_distance(tracks, detections, metric='cosine'):
det_features = []
leg1 = len(tracks)
leg2 = len(detections)
cost_matrix = np.zeros((leg1, leg2), dtype=np.float)
cost_matrix_det = np.zeros((leg1, leg2), dtype=np.float)
cost_matrix_track = np.zeros((leg1, leg2), dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
cost_matrix = np.zeros((leg1, leg2), dtype=float)
cost_matrix_det = np.zeros((leg1, leg2), dtype=float)
cost_matrix_track = np.zeros((leg1, leg2), dtype=float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
if leg2 != 0:
cost_matrix_det = np.maximum(0.0, cdist(det_features, det_features, metric))
if leg1 != 0:
Expand All @@ -167,8 +167,8 @@ def vis_id_feature_A_distance(tracks, detections, metric='cosine'):
if leg2 > 10:
leg2 = 10
detections = detections[:10]
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
return track_features, det_features, cost_matrix, cost_matrix_det, cost_matrix_track

def gate_cost_matrix(kf, cost_matrix, tracks, detections, only_position=False):
Expand Down
2 changes: 1 addition & 1 deletion tutorials/cstrack/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
2 changes: 1 addition & 1 deletion tutorials/cstrack/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score, temp_feat, buffer_size=30):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
2 changes: 1 addition & 1 deletion tutorials/ctracker/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
36 changes: 18 additions & 18 deletions tutorials/ctracker/mot_online/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ def ious(atlbrs, btlbrs):

:rtype ious np.ndarray
"""
ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=np.float)
ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=float)
if ious.size == 0:
return ious

ious = bbox_ious(
np.ascontiguousarray(atlbrs, dtype=np.float),
np.ascontiguousarray(btlbrs, dtype=np.float)
np.ascontiguousarray(atlbrs, dtype=float),
np.ascontiguousarray(btlbrs, dtype=float)
)

return ious
Expand Down Expand Up @@ -109,13 +109,13 @@ def embedding_distance(tracks, detections, metric='cosine'):
:return: cost_matrix np.ndarray
"""

cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float)
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=float)
if cost_matrix.size == 0:
return cost_matrix
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
#for i, track in enumerate(tracks):
#cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric))
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
return cost_matrix

Expand All @@ -127,17 +127,17 @@ def embedding_distance2(tracks, detections, metric='cosine'):
:return: cost_matrix np.ndarray
"""

cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float)
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=float)
if cost_matrix.size == 0:
return cost_matrix
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
#for i, track in enumerate(tracks):
#cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric))
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
track_features = np.asarray([track.features[0] for track in tracks], dtype=np.float)
track_features = np.asarray([track.features[0] for track in tracks], dtype=float)
cost_matrix2 = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
track_features = np.asarray([track.features[len(track.features)-1] for track in tracks], dtype=np.float)
track_features = np.asarray([track.features[len(track.features)-1] for track in tracks], dtype=float)
cost_matrix3 = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
for row in range(len(cost_matrix)):
cost_matrix[row] = (cost_matrix[row]+cost_matrix2[row]+cost_matrix3[row])/3
Expand All @@ -149,11 +149,11 @@ def vis_id_feature_A_distance(tracks, detections, metric='cosine'):
det_features = []
leg1 = len(tracks)
leg2 = len(detections)
cost_matrix = np.zeros((leg1, leg2), dtype=np.float)
cost_matrix_det = np.zeros((leg1, leg2), dtype=np.float)
cost_matrix_track = np.zeros((leg1, leg2), dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
cost_matrix = np.zeros((leg1, leg2), dtype=float)
cost_matrix_det = np.zeros((leg1, leg2), dtype=float)
cost_matrix_track = np.zeros((leg1, leg2), dtype=float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
if leg2 != 0:
cost_matrix_det = np.maximum(0.0, cdist(det_features, det_features, metric))
if leg1 != 0:
Expand All @@ -167,8 +167,8 @@ def vis_id_feature_A_distance(tracks, detections, metric='cosine'):
if leg2 > 10:
leg2 = 10
detections = detections[:10]
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
return track_features, det_features, cost_matrix, cost_matrix_det, cost_matrix_track

def gate_cost_matrix(kf, cost_matrix, tracks, detections, only_position=False):
Expand Down
2 changes: 1 addition & 1 deletion tutorials/fairmot/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
2 changes: 1 addition & 1 deletion tutorials/fairmot/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score, temp_feat, buffer_size=30):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
2 changes: 1 addition & 1 deletion tutorials/jde/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
2 changes: 1 addition & 1 deletion tutorials/jde/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score, temp_feat, buffer_size=30):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
2 changes: 1 addition & 1 deletion tutorials/motr/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
36 changes: 18 additions & 18 deletions tutorials/motr/mot_online/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def ious(atlbrs, btlbrs):
:type atlbrs: list[tlbr] | np.ndarray
:rtype ious np.ndarray
"""
ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=np.float)
ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=float)
if ious.size == 0:
return ious

ious = bbox_ious(
np.ascontiguousarray(atlbrs, dtype=np.float),
np.ascontiguousarray(btlbrs, dtype=np.float)
np.ascontiguousarray(atlbrs, dtype=float),
np.ascontiguousarray(btlbrs, dtype=float)
)

return ious
Expand Down Expand Up @@ -107,13 +107,13 @@ def embedding_distance(tracks, detections, metric='cosine'):
:return: cost_matrix np.ndarray
"""

cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float)
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=float)
if cost_matrix.size == 0:
return cost_matrix
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
#for i, track in enumerate(tracks):
#cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric))
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
return cost_matrix

Expand All @@ -125,17 +125,17 @@ def embedding_distance2(tracks, detections, metric='cosine'):
:return: cost_matrix np.ndarray
"""

cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float)
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=float)
if cost_matrix.size == 0:
return cost_matrix
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
#for i, track in enumerate(tracks):
#cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric))
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
track_features = np.asarray([track.features[0] for track in tracks], dtype=np.float)
track_features = np.asarray([track.features[0] for track in tracks], dtype=float)
cost_matrix2 = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
track_features = np.asarray([track.features[len(track.features)-1] for track in tracks], dtype=np.float)
track_features = np.asarray([track.features[len(track.features)-1] for track in tracks], dtype=float)
cost_matrix3 = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
for row in range(len(cost_matrix)):
cost_matrix[row] = (cost_matrix[row]+cost_matrix2[row]+cost_matrix3[row])/3
Expand All @@ -147,11 +147,11 @@ def vis_id_feature_A_distance(tracks, detections, metric='cosine'):
det_features = []
leg1 = len(tracks)
leg2 = len(detections)
cost_matrix = np.zeros((leg1, leg2), dtype=np.float)
cost_matrix_det = np.zeros((leg1, leg2), dtype=np.float)
cost_matrix_track = np.zeros((leg1, leg2), dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
cost_matrix = np.zeros((leg1, leg2), dtype=float)
cost_matrix_det = np.zeros((leg1, leg2), dtype=float)
cost_matrix_track = np.zeros((leg1, leg2), dtype=float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
if leg2 != 0:
cost_matrix_det = np.maximum(0.0, cdist(det_features, det_features, metric))
if leg1 != 0:
Expand All @@ -165,8 +165,8 @@ def vis_id_feature_A_distance(tracks, detections, metric='cosine'):
if leg2 > 10:
leg2 = 10
detections = detections[:10]
det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float)
det_features = np.asarray([track.curr_feat for track in detections], dtype=float)
track_features = np.asarray([track.smooth_feat for track in tracks], dtype=float)
return track_features, det_features, cost_matrix, cost_matrix_det, cost_matrix_track

def gate_cost_matrix(kf, cost_matrix, tracks, detections, only_position=False):
Expand Down
2 changes: 1 addition & 1 deletion tutorials/qdtrack/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class STrack(BaseTrack):
def __init__(self, tlwh, score):

# wait activate
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=float)
self.kalman_filter = None
self.mean, self.covariance = None, None
self.is_activated = False
Expand Down
Loading