Skip to content

Face Detection in CameraWebServer Example Not Working in 1.0.2 #2731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xgarb opened this issue May 1, 2019 · 29 comments
Closed

Face Detection in CameraWebServer Example Not Working in 1.0.2 #2731

xgarb opened this issue May 1, 2019 · 29 comments

Comments

@xgarb
Copy link

xgarb commented May 1, 2019

Faces aren't detected in the CameraWebServer example in 1.0.2. I tested with an Ai-Thinker and an ESP-EYE and there is nothing in the serial monitor or in the stream.

Works great when I rolled back to 1.0.1 with the previous example.

@crackpot1977
Copy link

Hi.
Not your solution, but:
I have the same problem :-(

@sconwayaus
Copy link

I was able to repeat the OP issue.

Hardware: AI-Thinker ESP32-CAM
Built the CameraWebServer example in the Ardunio IDE using 1.0.2 and 1.0.1.
1.0.2, face detection was not working.
1.0.1, face detection working

@me-no-dev
Copy link
Member

Hey, can you please install 1.0.3-rc1 from the development package manager link and give it a try?

@crackpot1977
Copy link

Hi.
Unfortunately no solution for me.
1.0.1 => working
1.0.2 & 1.0.3-rc1 => not working

@eggnot
Copy link

eggnot commented May 18, 2019

IMG_20190519_001921_s

1.0.1 - working
1.0.2 - not working

@MohamadBay
Copy link

ESP-eye Face detection and recognition is not working
1.0.1 not working
1.0.2 not working
a other member has the same Problem : #2817

any idea??

@rikki78
Copy link

rikki78 commented Jul 27, 2019

Same here. I have an AI thinker board. Is it possible to use that with the previous release 1.0.1 somehow? I'm using platformIO.

@rikki78
Copy link

rikki78 commented Jul 28, 2019

I've got it to work by switching to Arduino IDE 1.0.1. The AI thinker board is not supported, but the ESP32 Wrover module also works

@andytion
Copy link

andytion commented Aug 5, 2019

hey,guts,i think i figure out how to fix this.
in the old version mtmn_config init code is something like

mtmn_config.min_face = 80; mtmn_config.pyramid = 0.8; mtmn_config.p_threshold.score = 0.1; mtmn_config.p_threshold.nms = 0.9; mtmn_config.r_threshold.candidate_number = 10; mtmn_config.r_threshold.score = 0.2; mtmn_config.r_threshold.nms = 0.8; mtmn_config.r_threshold.candidate_number = 5; mtmn_config.o_threshold.score = 0.3; mtmn_config.o_threshold.nms = 0.7; mtmn_config.o_threshold.candidate_number = 3;

and in the new version.there is some new values had been add in the struct mtmn_config_t.
and a new function.
mtmn_init_config()

and i use this function to init my mtmn_config. face_detect() work finaly.

@omathurin
Copy link

I confirm andytion's solution worked for me: I'm on 1.0.2 and I just added a call to mtmn_init_config() to initialize the mtmn_config variable in the file app_httpd.cpp:
mtmn_config = mtmn_init_config()

And I managed to see faces detected in the stream (green rectangle around the face) - as expected.

Screenshot from 2019-08-10 10-32-43

@privet971
Copy link

privet971 commented Aug 10, 2019

Thanks to andytion and omathurin..... face detection is ok even in 1.0.3rc1

But ......It's not lasting very long, after a few seconds, he made a reset :

MJPG: 6472B 39ms (25.6fps), AVG: 39ms (25.6fps), 0+0+0+0=0 0
MJPG: 6536B 37ms (27.0fps), AVG: 39ms (25.6fps), 0+0+0+0=0 0
MJPG: 6440B 40ms (25.0fps), AVG: 39ms (25.6fps), 0+0+0+0=0 0
MJPG: 6464B 512ms (2.0fps), AVG: 62ms (16.1fps), 141+322+0+0=464 0
CORRUPT HEAP: Bad tail at 0x3f91a883. Expected 0xbaad5678 got 0xbaad5600
assertion "head != NULL" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/multi_heap_poisoning.c", line 214, function: multi_heap_free
abort() was called at PC 0x400dd32b on core 1

Backtrace: 0x40091648:0x3ffdcb00 0x40091879:0x3ffdcb20 0x400dd32b:0x3ffdcb40 0x400912bd:0x3ffdcb70 0x40087e7a:0x3ffdcb90 0x40089485:0x3ffdcbb0 0x4000bec7:0x3ffdcbd0 0x400e9195:0x3ffdcbf0 0x400e4c77:0x3ffdcc10 0x400e55e6:0x3ffdcc90 0x400d31ee:0x3ffdccf0 0x4012e3ad:0x3ffdcea0 0x4012d601:0x3ffdced0 0x4012d6dd:0x3ffdcf60 0x4012dae8:0x3ffdcf80 0x4012cbf2:0x3ffdcfa0 0x4012cc44:0x3ffdcfe0 0x4008d5e5:0x3ffdd000

Rebooting...

Any ideas to fix that ?

@rvdbreemen
Copy link

First big thanks, that fix by andytion works for me too.

But then after flashing and running the software, the face recoginition at least is happening. Then just like privet971, the same thing happens here, after a few frame it just died with a corrupt heap error.

Logs:
..
WiFi connected
Starting web server on port: '80'
Starting stream server on port: '81'
Camera Ready! Use 'http://192.168.88.35' to connect
MJPG: 9291B 305ms (3.3fps), AVG: 305ms (3.3fps), 136+91+0+0=228 0
MJPG: 9316B 244ms (4.1fps), AVG: 274ms (3.6fps), 136+88+0+0=224 0
MJPG: 9333B 250ms (4.0fps), AVG: 266ms (3.8fps), 139+89+0+0=229 0
MJPG: 9323B 285ms (3.5fps), AVG: 271ms (3.7fps), 138+129+0+0=268 0
MJPG: 9298B 297ms (3.4fps), AVG: 276ms (3.6fps), 139+129+0+0=269 0
CORRUPT HEAP: Bad head at 0x3ffded74. Expected 0xabba1234 got 0x00000000
assertion "head != NULL" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/multi_heap_poisoning.c", line 214, function: multi_heap_free
abort() was called at PC 0x400dd6cb on core 1

Backtrace: 0x40091b44:0x3ffdc8d0 0x40091d75:0x3ffdc8f0 0x400dd6cb:0x3ffdc910 0x400917b9:0x3ffdc940 0x4008840a:0x3ffdc960 0x400899b5:0x3ffdc980 0x4000bec7:0x3ffdc9a0 0x400e9bb1:0x3ffdc9c0 0x400d2f96:0x3ffdc9e0 0x4012b445:0x3ffdcb90 0x4012a699:0x3ffdcbc0 0x4012a775:0x3ffdcc50 0x4012ab80:0x3ffdcc70 0x40129cb6:0x3ffdcc90 0x40129d08:0x3ffdccd0 0x4008dae1:0x3ffdccf0

Rebooting...

But it just rebooted, and then it toke samples again and it started working. There must be something going on, it happened after I tried to add my first face (myself) and then it .

Now it's been running for a few minutes without any issue. Just noticed that the ESP is getting quite hot, maybe running it on 3.3V is better, but it initially would not work at that voltage, so I switched to 5V.

Anyway, just wanted to let you all know!

@rvdbreemen
Copy link

And there it is again:
CORRUPT HEAP: Bad tail at 0x3ffdfcc4. Expected 0xbaad5678 got 0x00000000
assertion "head != NULL" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/multi_heap_poisoning.c", line 214, function: multi_heap_free
abort() was called at PC 0x400dd6cb on core 0

Backtrace: 0x40091b44:0x3ffd41d0 0x40091d75:0x3ffd41f0 0x400dd6cb:0x3ffd4210 0x400917b9:0x3ffd4240 0x4008840a:0x3ffd4260 0x400899b5:0x3ffd4280 0x4000bec7:0x3ffd42a0 0x4008e96b:0x3ffd42c0 0x4010dcb5:0x3ffd42e0 0x4010f499:0x3ffd4300 0x4010fec3:0x3ffd4330 0x400fd379:0x3ffd4350 0x4008dae1:0x3ffd4380

Rebooting...

So the code still has bugs that needs killing ;-)

@andytion
Copy link

That happened to me,too. First of all, i suspect is something wrong in my code? But after i debug and test around for a while. I doubt that is there something wrong in the official code? And i try the lastest master branch. After that the annouying multi_heap_free abort() gone finaly.You guys can give it a try~~;-P

@pfeerick
Copy link
Contributor

pfeerick commented Oct 13, 2019

Both face detection and face recognition work fine for me with the provided CameraWebServer example using 1.0.4 of this core on both the Arduino IDE and PlatformIO... so perhaps this has now actually been fixed?

I'm using an AI-Thinker ESP32-CAM, so my configuration was as follows:

In the main sketch, set my WiFI SSID and Password, comment out //#define CAMERA_MODEL_WROVER_KIT and uncomment #define CAMERA_MODEL_AI_THINKER

On the Arduino IDE, I have the board configured as an ESP32 Wrover Module with a HUGE APP (3MB NO OTA/1MB SPIFFs) partition scheme. Everything else at defaults. On PlatformIO, I used the esp32-cam board type which worked as-is.

Unless faults can be reproduced against the 1.0.4 core, with the stock example (with configuration changes only), hopefully this and the related #2817 can be closed now.

@me-no-dev
Copy link
Member

all should be good now :) was not working before on 1.0.2 because we did not notice a change in esp-face that made the app compile but not work at the end.

@eKselent-Tech
Copy link

ESP32 Reboots, i have been facing this issue. i switched to older board version of ESP32 Board under Boards Manager. This Solved my issue.

@VishalGMeshram37
Copy link

Hello Everyone
I am Vishal, i am facing the problem with ESp32 cam. I have installed ESP32 version2.0.1, but was not able to detect or recognise the face, I have used the ESp32 Cam model with FTDI convertor, and Blue Downloading cable which is recomended, i have also installed every version of ESP32 ( fromver 1.0.1 to 2.0.1), but apart from video streaming nothing is happening, please suggest the corrections , Thanking you

@xgarb
Copy link
Author

xgarb commented Nov 16, 2021

There's no detection or recognition in 2.0.1. Definitely works in 1.0.4. Maybe you need more light on your face or a different distance from the camera.

@me-no-dev
Copy link
Member

something have changed in the API of the face recognition lib. Will update the example and make it work

@VishalGMeshram37
Copy link

VishalGMeshram37 commented Nov 20, 2021

When rolled back to 1.0.4 i got this msg.

Error msg

Arduino: 1.8.15 (Windows 10), Board: "ESP32 Wrover Module, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), QIO, 80MHz, 921600, None"

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t bmp_handler(httpd_req_t*)':

app_httpd.cpp:308:39: error: 'struct camera_fb_t' has no member named 'timestamp'

 snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);

                                   ^

app_httpd.cpp:308:61: error: 'struct camera_fb_t' has no member named 'timestamp'

 snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);

                                                         ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t capture_handler(httpd_req_t*)':

app_httpd.cpp:370:39: error: 'struct camera_fb_t' has no member named 'timestamp'

 snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);

                                   ^

app_httpd.cpp:370:61: error: 'struct camera_fb_t' has no member named 'timestamp'

 snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);

                                                         ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t stream_handler(httpd_req_t*)':

app_httpd.cpp:463:20: error: aggregate 'stream_handler(httpd_req_t*)::timeval _timestamp' has incomplete type and cannot be defined

 struct timeval _timestamp;

                ^

app_httpd.cpp:514:37: error: 'struct camera_fb_t' has no member named 'timestamp'

         _timestamp.tv_sec = fb->timestamp.tv_sec;

                                 ^

app_httpd.cpp:515:37: error: 'struct camera_fb_t' has no member named 'timestamp'

        _timestamp.tv_usec = fb->timestamp.tv_usec;

                                 ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'int print_reg(char*, sensor_t*, uint16_t, uint32_t)':

app_httpd.cpp:812:47: error: 'sensor_t {aka struct _sensor}' has no member named 'get_reg'

 return sprintf(p, "\"0x%x\":%u,", reg, s->get_reg(s, reg, mask));

                                           ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t status_handler(httpd_req_t*)':

app_httpd.cpp:823:21: error: 'OV5640_PID' was not declared in this scope

 if(s->id.PID == OV5640_PID || s->id.PID == OV3660_PID){

                 ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t xclk_handler(httpd_req_t*)':

app_httpd.cpp:916:18: error: 'sensor_t {aka struct _sensor}' has no member named 'set_xclk'

 int res = s->set_xclk(s, LEDC_TIMER_0, xclk);

              ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t reg_handler(httpd_req_t*)':

app_httpd.cpp:950:18: error: 'sensor_t {aka struct _sensor}' has no member named 'set_reg'

 int res = s->set_reg(s, reg, mask, val);

              ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t greg_handler(httpd_req_t*)':

app_httpd.cpp:979:18: error: 'sensor_t {aka struct _sensor}' has no member named 'get_reg'

 int res = s->get_reg(s, reg, mask);

              ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t pll_handler(httpd_req_t*)':

app_httpd.cpp:1020:18: error: 'sensor_t {aka struct _sensor}' has no member named 'set_pll'

 int res = s->set_pll(s, bypass, mul, sys, root, pre, seld5, pclken, pclk);

              ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t win_handler(httpd_req_t*)':

app_httpd.cpp:1053:18: error: 'sensor_t {aka struct _sensor}' has no member named 'set_res_raw'

 int res = s->set_res_raw(s, startX, startY, endX, endY, offsetX, offsetY, totalX, totalY, outputX, outputY, scale, binning);

              ^

C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_999774\app_httpd.cpp: In function 'esp_err_t index_handler(httpd_req_t*)':

app_httpd.cpp:1070:33: error: 'OV5640_PID' was not declared in this scope

     } else if (s->id.PID == OV5640_PID) {

                             ^

Multiple libraries were found for "WiFi.h"

Used: C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi

Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

Not used: C:\Users\User\Documents\Arduino\libraries\WiFi

exit status 1

'struct camera_fb_t' has no member named 'timestamp'

@VishalGMeshram37
Copy link

VishalGMeshram37 commented Nov 20, 2021

And No error with 2.0.1 versions, but no face recognition or detection , please guide me further how to solve this issue

@me-no-dev
Copy link
Member

did you run an example from newer Arduino on older version? That would explain the error :)

@VishalGMeshram37
Copy link

NO everything is latest

@xgarb
Copy link
Author

xgarb commented Nov 24, 2021

You need to use v 1.0.4 (or 5, probably) of the ESP32 Hardware libraries and load the CameraWebServer example as here: https://robotzero.one/esp32-cam-arduino-ide/ You can't use the examples from a different hardware library.

Pretty sure fb->timestamp doesn't exist in the v1.0.4 so you must be using the new example with the old library.

@bigowash
Copy link

bigowash commented Nov 27, 2021

Does face detection not work with version 2.0.1 of ESP32?

I have followed various tutorials on working with ESP32 Cam and every feature in the websever seems to work but when I activate the face detection, there is no rectangle drawn around my face. I have tried various rooms with different lighting and different faces. I have tried other versions of ESP32 (1.0.5 and 1.0.6) with their various CameraWebServer files, unsuccessfully. What should I do?

@xgarb
Copy link
Author

xgarb commented Nov 27, 2021

Nope: #5878

1.0.4 definitely works.

@tro-nic
Copy link

tro-nic commented Jul 27, 2022

Nope: #5878

1.0.4 definitely works.

Yeeeeeees...! FD and FR work 1.0.4

@Gabriel-create-code
Copy link

I am having a similar issue, instead of the intruder alert text I see in the tutorials I just get yellow dots on my face and i am unable to enroll my face can anyone help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests