ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.45k stars 13.49k forks source link

face_encodings method freezes program on raspberry pi #119

Open codeundercoverdev opened 7 years ago

codeundercoverdev commented 7 years ago

Description

Thanks for making this - it is awesome.

The face_encodings method seems to freeze the python shell. No error - the shell just stops printing or doing anything:

obama_image = face_recognition.load_image_file("obama_small.jpg")
print("image loaded")
obama_face_encoding = face_recognition.face_encodings(obama_image)[0]
print("image encoded")

The above code just returns:

image loaded

Any idea how to fix this?

What I Did

Paste the command(s) you ran and the output. I just run the program with python3 facerec_on_raspberry_pi.py

If there was a crash, please include the traceback here.

ageitgey commented 7 years ago

Sounds like the same or similar issue as in #109, so just linking these issues.

codeundercoverdev commented 7 years ago

Yea, I saw #109 but unlike that one I can't even ctrl-c out. It just freezes.

ageitgey commented 7 years ago

Strange. I didn't have this issue when I lasted tested it on an RPi, so I'm not sure what is going on. How did you go about installing dlib? Did you install dlib via pip, compile it locally, or something else?

codeundercoverdev commented 7 years ago

I did it exactly as described on the face_recognition raspberry pi install page install page:

mkdir -p dlib
git clone -b 'v19.4' --single-branch https://github.com/davisking/dlib.git dlib/
cd ./dlib
sudo python3 setup.py install 
ageitgey commented 7 years ago

Thanks. Since I haven't seen this issue myself, it's hard to know what is going on.

When it happens, is the CPU pegged at 100% or idle? Does this issue still happen if you try processing a very small image (like 100x100 pixels or something) instead of a larger image?

If you are familiar with how to use strace, can you capture a trace from when this happens?

codeundercoverdev commented 7 years ago

I'm using the obama_small image that comes included. I'll try looking at trace

saebaxp commented 6 years ago

Just experienced same segsegv issue. Raspberrypi: Stretch dlib: compiled with NEON instructions enabled. version 19.9.99 python 3.5.3 opencv: compiled from source code, v3.3.0

strace: (around the crash) write(1, "Found 1 faces in image.\n", 24) = 24 mmap2(NULL, 3051520, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x68417000 futex(0x75957ba4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x75957ba0, FUTEX_OP_SET<<28|0<<12|FUTEX_OP_CMP_GT<<24|0x1) = 1 futex(0x75957b88, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x75957c24, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x75957c20, FUTEX_OP_SET<<28|0<<12|FUTEX_OP_CMP_GT<<24|0x1) = 1 futex(0x75957ca4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x75957ca0, FUTEX_OP_SET<<28|0<<12|FUTEX_OP_CMP_GT<<24|0x1) = 1 futex(0x75957c88, FUTEX_WAKE_PRIVATE, 1) = 1 munmap(0x68417000, 3051520) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 munmap(0x685a7000, 1413120) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 munmap(0x685a7000, 1413120) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 munmap(0x685a7000, 1413120) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 munmap(0x685a7000, 1413120) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 munmap(0x685a7000, 1413120) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 munmap(0x685a7000, 1413120) = 0 brk(0x6100000) = 0x6100000 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 mmap2(NULL, 667648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6865d000 munmap(0x6865d000, 667648) = 0 write(1, "I see someone named <Unknown Per"..., 38) = 38 write(1, "Capturing image.\n", 17) = 17 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5eb64) = 0 futex(0x6d4913c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 0xffffffff) = -1 EAGAIN (Resource temporarily unavailable) ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5ec6c) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5e774) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5e87c) = 0 cacheflush(0x76fcc030, 0x76fcc043, 0, 0x76fcc030, 0x76fcc030) = 0 cacheflush(0x76fcc030, 0x76fcc03c, 0, 0x76fcc030, 0x76fcc030) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5f0bc) = 0 futex(0x6d4913c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 0xffffffff) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5eacc) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5ed5c) = 0 futex(0x6d4913c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 0xffffffff) = 0 futex(0x5b381b0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, {tv_sec=1517142596, tv_nsec=843294000}, 0xffffffff) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5ed5c) = 0 futex(0x6d4913c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 0xffffffff) = 0 ioctl(4, _IOC(_IOC_WRITE, 0xc4, 0x04, 0x0c), 0x7eb5efe4) = 0 futex(0x6d4913c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 0xffffffff) = 0 futex(0x5a386b8, FUTEX_WAKE_PRIVATE, 1) = 1 mmap2(NULL, 929792, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6861d000 mmap2(NULL, 643072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x68580000 brk(0x6148000) = 0x6148000 munmap(0x68580000, 643072) = 0 brk(0x6185000) = 0x6185000 brk(0x60c7000) = 0x60c7000 munmap(0x6861d000, 929792) = 0 write(1, "Found 1 faces in image.\n", 24) = 24 mmap2(NULL, 3051520, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x68417000 futex(0x75957ba4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x75957ba0, FUTEX_OP_SET<<28|0<<12|FUTEX_OP_CMP_GT<<24|0x1) = 1 futex(0x75957b88, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x75957c24, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x75957c20, FUTEX_OP_SET<<28|0<<12|FUTEX_OP_CMP_GT<<24|0x1) = 1 futex(0x75957c08, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x75957ca4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x75957ca0, FUTEX_OP_SET<<28|0<<12|FUTEX_OP_CMP_GT<<24|0x1) = 1 munmap(0x68417000, 3051520) = 0 mmap2(NULL, 1413120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x685a7000 +++ killed by SIGSEGV +++

xyG67 commented 6 years ago

i met the same problem. Do you find the solution?