Skip to content Skip to sidebar Skip to footer

Indexerror: Index 14708 Is Out Of Bounds For Axis 0 With Size 295

I'm trying to make object detection software with yolo and this error is popping and I am so lost please can anyone help me !! (the code not complete and sorry if there are any mis

Solution 1:

It seems that you are running into a problem because np.argmax will give you the raw number of the max element instead of the index. So if you have a 3x3 matrix the argmax function will treat the matrix as a 9x1 line instead of a 3x3 square.

# The matrix:
[[1, 2, 3],
 [4, 5, 6],
 [7, 8, 9]]

#will be treated as:
[1, 2, 3, 4, 5, 6, 7, 8, 9]

The documentation suggests the bellow solution:

classId = np.unravel_index(np.argmax(scores, axis=None), scores.shape)

Post a Comment for "Indexerror: Index 14708 Is Out Of Bounds For Axis 0 With Size 295"