question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MemoryError: std::bad_alloc

See original GitHub issue
  • face_recognition version: last
  • Python version: 3
  • Operating System: Ubuntu
  • CPU: Intel i3-6100
  • RAM: 8GB

Hello! I use script encode_faces.py from https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/ for encoding my dataset in pickle. But I get error “MemoryError: std::bad_alloc” when [INFO] processing image 12/69.


[INFO] processing image 11/69
[INFO] processing image 12/69
Traceback (most recent call last):
  File "encode_faces.py", line 45, in <module>
    model=args["detection_method"])
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/face_recognition/api.py", line 100, in _raw_face_locations
    return cnn_face_detector(img, number_of_times_to_upsample)
MemoryError: std::bad_alloc

Help please. Thank you advance

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
jrosebr1commented, Apr 12, 2019

Resize your input images prior to passing them through the network. Your input images are too large and your GPU is running out of memory.

2reactions
sbourdettecommented, Aug 9, 2019

I have the same issue on virtuabox machine. When changing detection-method to hog instead of cnn it works

Read more comments on GitHub >

github_iconTop Results From Across the Web

std::bad_alloc - am I out of memory? - Stack Overflow
std ::bad_alloc means a problem with allocating a memory - so yes, you're most likely out of memory. Unfortunately, there is no a...
Read more >
MemoryError: std::bad_alloc encountered on fresh install on ...
I get MemoryError: std::bad_alloc on a fresh install on the pytorch vm image on google cloud. Steps to reproduce: Start instance. export ...
Read more >
bad_alloc is not out-of-memory! - open-std.org
A custom allocator can preallocate a chunk of heap memory and distribute it to its callers. When the preallocated memory is run out...
Read more >
MemoryError: std::bad_alloc: rapids.ai Dask-cuDF-Pandas ...
Coding example for the question MemoryError: std::bad_alloc: rapids.ai Dask-cuDF-Pandas,Python.
Read more >
Memory error: std::bad_alloc - YouTube
Memory error : std :: bad_alloc. Watch later. Share. Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found