DeepFace IndexError: single positional indexer is out-of-bounds

33 Views Asked by At

I am using the following repository -https://github.com/slashtechno/wyzely-detect. This works okay and face is correctly recognised until more than one face is seen in th frame, the program stops and gives an error. It is in the recognize_face function in utils.py in utils.

Can anybody suggest a way to make the script keep going when multiple faces are present and recognition tries on each one by one?

Is is it a DeepFace limitation? Then the alternative?

Error:

Traceback (most recent call last):

File "C:\Users\funnu\OneDrive\Desktop\Face and Object\wyzely_detect_main_.py", line 225, in

main()

File "C:\Users\funnu\OneDrive\Desktop\Face and Object\wyzely_detect_main_.py", line 94, in main

if face_details := utils.recognize_face(

File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wyzely_detect\utils\utils.py", line 141, in recognize_face

path_to_image = Path(df.iloc[-1]["identity"])

File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\indexing.py", line 1153, in getitem

return self._getitem_axis(maybe_callable, axis=axis)

File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\indexing.py", line 1714, in _getitem_axis

self._validate_integer(key, axis)

File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\indexing.py", line 1647, in _validate_integer

raise IndexError("single positional indexer is out-of-bounds")

IndexError: single positional indexer is out-of-bounds

I have tried using a function to make the loop continue even when dataframe is none. Tried multiple debug messages in and around the function but none of those work. I just get the error as soon as another face appears.

0

There are 0 best solutions below