ZQPei / deep_sort_pytorch

MOT using deepsort and yolov3 with pytorch
MIT License
2.83k stars 727 forks source link

A not aligned error when calculating the _cosine_distance #252

Closed enemy1205 closed 2 years ago

enemy1205 commented 2 years ago

In file sort/nn_matching.py line 175,176.

        for i, target in enumerate(targets):
            cost_matrix[i, :] = self._metric(self.samples[target], features)

The self.samples[target] is always a (x,1,512) (x is related to my hyperparameters N_INIT) matrix and the features current frame will be a (1,1,512) matrix, which leading to the error in line 54

1. - np.dot(a, b.T)

ValueError: shapes (2,1,512) and (512,1,1) not aligned: 512 (dim 2) != 1 (dim 1)

It feels like self.samples has been adding up before confirmed