So I am following the tutorial on https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/ in Pycharm environment. When I run the encode faces file it comes out with this error.
Traceback (most recent call last):
File "Encoding_Faces.py", line 29, in <module>
boxes = face_recognition.face_locations(rgb, model=args["detection_method"])
File "C:\Users\my name\AppData\Local\Programs\Python\Python36-
32\Webcam_Face_Detect\lib\site-packages\face_recognition\api.py", line 116,
in face_locations
return [_trim_css_to_bounds(_rect_to_css(face.rect), img.shape) for face in
_raw_face_locations(img, number_of_times_to_upsample, "cnn")]
File "C:\Users\my name\AppData\Local\Programs\Python\Python36-
32\Webcam_Face_Detect\lib\site-packages\face_recognition\api.py", line 100,
in _raw_face_locations
return cnn_face_detector(img, number_of_times_to_upsample)
MemoryError: bad allocation
But when I see the memory usage on the bottom right of the screen it is around 200 of 4096M. I increase the memory from 750M but to no avail. Weirdly, the error occured on the first photo itself. My images are around 200kb each and 1920 by 1080. Total 17 images. My computer has no gpu so I am not sure if that is the problem.
I checked the task manager as well and the memory usage was about 50% when the program crashed.
My computer is a Hp Spectre x360 i5 6th gen 8gb ram. 2 years old if that is important.
Just realised the issue was that I had my code configured to run with a gpu. My bad... Changed default detection method to "hog", from "cnn".