deepcam-cn / yolov5-face

YOLO5Face: Why Reinventing a Face Detector (https://arxiv.org/abs/2105.12931) ECCV Workshops 2022)
GNU General Public License v3.0
2.12k stars 504 forks source link

IndexError: index 85 is out of bounds for dimension 0 with size 85 #204

Open ozayr opened 2 years ago

ozayr commented 2 years ago

Hi ,

getting the following error when running detect_face.py using yolov5s weights

yolov5-face/models/yolo.py", line 88, in forward y[..., class_range] = x[i][..., class_range].sigmoid() IndexError: index 85 is out of bounds for dimension 0 with size 85

tried with PyTorch 1.12 and 1.8 with python3.8 both have same error.

I have added the following code

print(class_range)
print(y.shape)
print(len(x))
print(x[0].shape)
print(i)
y[..., class_range] = x[i][..., class_range].sigmoid()

for which I get the following output

//class range [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94] //y.shape torch.Size([1, 3, 48, 80, 85]) //len(x) 3 //x[0].shape torch.Size([1, 3, 48, 80, 85]) //i 0

synchrony10 commented 2 years ago

hi,

could you please share weights with me ?

thanks

On Thu, 29 Sept 2022 at 17:17, Ozayr Moorad @.***> wrote:

Hi ,

getting the following error when running detect_face.py using yolov5s weights

yolov5-face/models/yolo.py", line 88, in forward y[..., class_range] = x[i][..., class_range].sigmoid() IndexError: index 85 is out of bounds for dimension 0 with size 85

tried with PyTorch 1.12 and 1.8 with python3.8 both have same error.

I have added the following code

print(class_range) print(y.shape) print(len(x)) print(x[0].shape) print(i) y[..., class_range] = x[i][..., class_range].sigmoid()

for which I get the following output

//class range [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94] //y.shape torch.Size([1, 3, 48, 80, 85]) //len(x) 3 //x[0].shape torch.Size([1, 3, 48, 80, 85]) //i 0

— Reply to this email directly, view it on GitHub https://github.com/deepcam-cn/yolov5-face/issues/204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB24H3OM5TV4FRGY5RY3YLDWAWQJNANCNFSM6AAAAAAQY2KOBY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ozayr commented 2 years ago

Hi,

Yes there wights I'm using are the exact weights that the bash script downloads in the weights folder here: https://github.com/deepcam-cn/yolov5-face/tree/master/weights

ramosrafh commented 2 years ago

Hello!!

Are you still having this issue? I got this exact same error, but in my case I'm using two models, one for people tracking and this one for face detection, my issue happens because when the face tracking calls the model, it goes through the python3.6 torch package and somehow when it returns it runs the code in the face detection module, I have no idea what's going on, but I think the sys.path.insert(0, "PATH.../yolov5-face" has something to do with it while running the people tracking.

ggamaz commented 2 years ago

did it solved, I was trooped here too

camilotorron commented 1 year ago

Did you solve it? I'm dealing with the same error here. using python 3.10.6

gdiasbruno commented 1 year ago

Same for me

yanggestars commented 1 year ago

when i use yolo5s.pt as weight i get the same problem, but it is fine when you use other weights

serkansulun commented 2 months ago

For me, this error happens when I mistakenly use yolo5x.pt weights instead of yolo5x-face.pt. The weights for face detection can be found here: https://github.com/deepcam-cn/yolov5-face