changes + track

This commit is contained in:
√(noham)²
2024-07-23 16:09:32 +02:00
parent db075fb427
commit 25207230c6
124 changed files with 7850 additions and 26104 deletions

View File

@@ -175,7 +175,7 @@ def main(args):
exit(0)
"""3. load sequences"""
print('stride', stride)
dataset = DemoDataset(file_name=args.obj, img_size=model_img_size, model=args.detector, stride=stride, )
data_loader = torch.utils.data.DataLoader(dataset, batch_size=1, shuffle=False)

View File

@@ -103,10 +103,9 @@ class TestDataset(Dataset):
padded_img = padded_img.transpose(swap)
padded_img = np.ascontiguousarray(padded_img, dtype=np.float32)
return padded_img, r
def _preprocess_yolov7(self, img, ):
img_resized = self._letterbox(img, new_shape=self.img_size, stride=self.other_param['stride'], )[0]
img_resized = self._letterbox(img, new_shape=self.img_size, stride=32, )[0]
img_resized = img_resized[:, :, ::-1].transpose(2, 0, 1) # BGR to RGB
img_resized = np.ascontiguousarray(img_resized)

View File

@@ -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=np.float64)
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=np.float64),
np.ascontiguousarray(btlbrs, dtype=np.float64)
)
return ious
@@ -129,13 +129,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=np.float64)
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=np.float64)
#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=np.float64)
cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features
return cost_matrix

View File

@@ -32,7 +32,7 @@ class Tracklet(BaseTrack):
def __init__(self, tlwh, score, category, motion='byte'):
# initial position
self._tlwh = np.asarray(tlwh, dtype=np.float)
self._tlwh = np.asarray(tlwh, dtype=np.float64)
self.is_activated = False
self.score = score
@@ -40,6 +40,8 @@ class Tracklet(BaseTrack):
# kalman
self.motion = motion
self.motion = 'sort'
motion = 'sort'
self.kalman_filter = MOTION_MODEL_DICT[motion]()
self.convert_func = self.__getattribute__('tlwh_to_' + STATE_CONVERT_DICT[motion])
@@ -363,4 +365,4 @@ class Tracklet_w_depth(Tracklet):
cx = ret[0] + 0.5 * ret[2]
y2 = ret[1] + ret[3]
lendth = 2000 - y2
return np.asarray([cx, y2, lendth], dtype=np.float)
return np.asarray([cx, y2, lendth], dtype=np.float64)