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

self.samples KeyError #332

Open
jeffxhansen opened this issue Jul 16, 2024 · 0 comments
Open

self.samples KeyError #332

jeffxhansen opened this issue Jul 16, 2024 · 0 comments

Comments

@jeffxhansen
Copy link

Hello, I am using YOLOv7 and DeepSORT for vehicle detection and tracking. In the image, the YOLO model successfully detected five cars, and now the tracker is updating and it throws this error:

Exception has occurred: KeyError
1
  File "/home/spotparking/SpotBackend/deep_sort/nn_matching.py", line 177, in distance
    cost_matrix[i, :] = self._metric(self.samples[target], features)
  File "/home/spotparking/SpotBackend/deep_sort/tracker.py", line 98, in gated_metric
    cost_matrix = self.metric.distance(features, targets)
  File "/home/spotparking/SpotBackend/deep_sort/linear_assignment.py", line 55, in min_cost_matching
    cost_matrix = distance_metric(
  File "/home/spotparking/SpotBackend/deep_sort/linear_assignment.py", line 137, in matching_cascade
    min_cost_matching(
  File "/home/spotparking/SpotBackend/deep_sort/tracker.py", line 113, in _match
    linear_assignment.matching_cascade(
  File "/home/spotparking/SpotBackend/deep_sort/tracker.py", line 69, in update
    self._match(detections)
  File "/home/spotparking/SpotBackend/scripts/run_doterra_small_lot.py", line 153, in <module>
    tracker.update(detections)
KeyError: 1

where this is the current state of the variables:

features.shape
(5, 128)
self.samples
{}
targets
array([1, 2, 3, 4, 5])

at this point the tracker.predict() tracker.update() functions have been called twice, and these cars are stationary.

Any help as to how to fix this problem would be much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant