Skip to content

IndexError: index 2 is out of bounds for axis 0 with size 2 #52

@Dashvvood

Description

@Dashvvood

Error Description

--> 215     keypoints = np.array([keypoints[i] for i in self.track_ids_last_frame])
    216     scores = np.array([scores[i] for i in self.track_ids_last_frame])
    218 self.bboxes_last_frame = bboxes_current_frame

IndexError: index 2 is out of bounds for axis 0 with size 2

Root Cause Analysis
In the 1st frame, 1 bbox is detected:

  • track ids = [0]
  • keypoints.shape = (1, X, Y)
  • reordering succeeds: keypoints = np.array([keypoints[i] for i in *self*.track_ids_last_frame])

In the 2nd frame, 2 bboxes are detected. During PoseTracker.track_by_iou(), no matches for second box are found, but since the bbox is large enough, a new track ID (1) is assigned:

  • track ids = [0, 1]
  • keypoints.shape = (2, X, Y)
  • reordering succeeds: keypoints = np.array([keypoints[i] for i in *self*.track_ids_last_frame])

In the 3rd frame, 2 bboxes are detected. During PoseTracker.track_by_iou(), no matches for second box are found, but since the bbox is large enough, a new track ID (2) is assigned:

  • track ids = [0, 2]
  • keypoints.shape = (2, X, Y)
  • reordering fails: keypoints = np.array([keypoints[i] for i in *self*.track_ids_last_frame])
  • IndexError: index 2 is out of bounds for axis 0 with size 2

Problematic Code Section

# Reorder keypoints and scores according to track_id
keypoints = np.array([keypoints[i] for i in self.track_ids_last_frame])
scores = np.array([scores[i] for i in self.track_ids_last_frame])

Track ID assignment logic appears to be generating IDs that exceed array dimensions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions