Qengineering / Face-Recognition-Raspberry-Pi-64-bits

Recognize 2000+ faces on your Raspberry Pi 4 with database auto-fill and anti-spoofing
https://qengineering.eu/deep-learning-examples-on-raspberry-32-64-os.html
BSD 3-Clause "New" or "Revised" License
69 stars 19 forks source link

RetinaFace crashes at release mode. #1

Closed MyraBaba closed 2 years ago

MyraBaba commented 3 years ago

Hi, @Qengineering

The system: Raspi 4 4GB ubuntu 20.04 64 bit gcc 10 opencv 4.5 ncnc latest

Progrmam working at Debug mode, but crashing at Release mode with SIGILL

any idea?

NOTE: When I analyze with Valgring it says invalid read 8 :

Screen Shot 2021-02-09 at 21 07 33
MyraBaba commented 3 years ago

What am I missing ?

PS: same code working at x86 desktop Ubuntu 20 both release and debug mode

Qengineering commented 3 years ago

Have really no clue. Just tried to reproduce your issue in the release mode, but no luck. It works like a charm in the same setting as yours. The line where it all goes wrong in your code is a ncnn call to a resize function. Is there something strange with the input? I've only used the given Norton_A and Norton_2 example videos.

MyraBaba commented 3 years ago

I struggled all day. Some times blindness stuck with us. So I stop looking today to refresh.

I used with cam 0

Interesting thing same code working at desktop but not in Rpi4.

İs it gcc 10 causing the problem ?

Will look tomorrow again.

Best

On 10 Feb 2021, at 13:11, Q-engineering notifications@github.com wrote:

Have really no clue. Just tried to reproduce your issue in the release mode, but no luck. It works like a charm in the same setting as yours. The line where it all goes wrong in your code is a ncnn call to a resize function. Is there something strange with the input? I've only used the given Norton_A and Norton_2 example videos.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Qengineering/Face-Recognition-Raspberry-Pi-64-bits/issues/1#issuecomment-776598743, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFRZHYAQMLY3YE4BAEF2YLS6JLVLANCNFSM4XLOQGAQ.

Qengineering commented 3 years ago

I,m sorry to hear about all the efforts you are going though. I've just tested the software with a webcam and again no issues in release mode. Given the location where the code crashes (in a resize algorithm) try to reduce your webcam image to a smaller format. I've use

cv::VideoCapture cap(0);

cap.set(CAP_PROP_POS_WIDTH, 320);
cap.set(CAP_PROP_POS_HEIGHT, 240);

This is the same size as the RetinaWidth and Height, which will give the resize algorithm a simple job. No need for 4K images at all in this app.

In release mode additional safeguards are removed from the code. That's why it crashes. The same erroneous situation exists in the debug mode, but here you are not aware if it because the safeguard kick in. (A well known example are arrays which are filled with zero's at initialization in debug mode, but kept with random numbers when in release mode, giving the programmer real nightmares)

By the way, is the code also crashing when playing the movies?

MyraBaba commented 3 years ago

Yes same thing happened when tested with the movies.

On 10 Feb 2021, at 14:19, Q-engineering notifications@github.com wrote:

I,m sorry to hear about all the efforts you are going though. I've just tested the software with a webcam and again no issues in release mode. Given the location where the code crashes (in a resize algorithm) try to reduce your webcam image to a smaller format. I've use

cv::VideoCapture cap(0);

cap.set(CAP_PROP_POS_WIDTH, 320); cap.set(CAP_PROP_POS_HEIGHT, 240); This is the same size as the RetinaWidth and Height, which will give the resize algorithm a simple job. No need for 4K images at all in this app.

In release mode additional safeguards are removed from the code. That's why it crashes. The same erroneous situation exists in the debug mode, but here you are not aware if it because the safeguard kick in. (A well known example are arrays which are filled with zero's at initialization in debug mode, but kept with random numbers when in release mode, giving the programmer real nightmares)

By the way, is the code also crashing when playing the movies?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Qengineering/Face-Recognition-Raspberry-Pi-64-bits/issues/1#issuecomment-776638753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFRZHZ276ZEXUYY36PL663S6JTVPANCNFSM4XLOQGAQ.

MyraBaba commented 3 years ago

Another interesting thing is that blur result is always "Nan"

MyraBaba commented 3 years ago

@Qengineering

Hi what do you thing for centerface at least its working on raspi we can go with it for a while.

I will sum up details for all soon ..

Best

MyraBaba commented 3 years ago

@Qengineering

I am switching ubuntu 20 4 bit to Rasbian 64 bit as described your blog. We will see what will be happen.

When I compiling the opencv at rasbian 64 bit I saw there is no VFP support ? and

`cat /proc/cpuinfo processor : 0 BogoMIPS : 108.00 Features : fp asimd evtstrm crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

processor : 1 BogoMIPS : 108.00 Features : fp asimd evtstrm crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

processor : 2 BogoMIPS : 108.00 Features : fp asimd evtstrm crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

processor : 3 BogoMIPS : 108.00 Features : fp asimd evtstrm crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

Hardware : BCM2835 Revision : c03111 Serial : 10000000913cba2b Model : Raspberry Pi 4 Model B Rev 1.1`

to be fastes as possible for dnn/nccn etc do we need VFP ? Than should we go with 32 bit Rasbian ? What you think ?

MyraBaba commented 3 years ago

@Qengineering

Raspbian OS 64 with default gcc8 all is worked there is no problem.

ubuntu 20 64 is the problem or gcc 10

FYI

Qengineering commented 3 years ago

Fixed bug in TBlur.cpp causing the NAN output image