Dawn-LX / VidVRD-tracklets

Video Visual Relation Detection (VidVRD) tracklets generation. also for ACM MM Visual Relation Understanding Grand Challenge
39 stars 9 forks source link

`deepSORT_tracking_v2` will raise value error because lengths of lists in `results` are not the same #5

Open chuanwise opened 10 months ago

chuanwise commented 10 months ago

Near the line 251 of deepSORT/deep_sort_app_v2.py:

for i, track in enumerate(tracker.tracks):
    if not track.is_confirmed() or track.time_since_update > 1:
        continue
    bbox = track.to_tlwh()
    track_res = [frame_idx, track.track_id, bbox[0], bbox[1], bbox[2],
            bbox[3]]
    if i not in track2det.keys():
        results.append(track_res)
        continue
    track_res += [detections[track2det[i]].confidence]
    track_res += [detections[track2det[i]].label]
    track_res += list(detections[track2det[i]].tlwh)
    track_res += list(detections[track2det[i]].feature)
    results.append(track_res)

The are 2 statements calling results.append(track_res). The first one always appends a list with length 6, but the last one is 1036, which will make np.array(results) fail:

Traceback (most recent call last):
  File "/home/chuanwise/develop/projects/VidVRD-tracklets/deepSORT/deepSORT_tracking_v2.py", line 94, in <module>
    run(
  File "/home/chuanwise/develop/projects/VidVRD-tracklets/deepSORT/deep_sort_app_v2.py", line 244, in run
    visualizer.run(frame_callback)
  File "/home/chuanwise/develop/projects/VidVRD-tracklets/deepSORT/application_util/visualization.py", line 80, in run
    frame_callback(self, self.frame_idx)
  File "/home/chuanwise/develop/projects/VidVRD-tracklets/deepSORT/deep_sort_app_v2.py", line 185, in frame_callback
Traceback (most recent call last):
  File "/home/chuanwise/develop/projects/VidVRD-tracklets/deepSORT/deepSORT_tracking_v2.py", line 94, in <module>
    run(
  File "/home/chuanwise/develop/projects/VidVRD-tracklets/deepSORT/deep_sort_app_v2.py", line 254, in run
    res = np.array(results)
          ^^^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (389,) + inhomogeneous part.