jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.89k stars 641 forks source link

LED intensity only used for reference image / always 100% for recognition and live stream #3338

Open TheChatty opened 1 week ago

TheChatty commented 1 week ago

The Problem

In 15.7.0 (and below) LED intensity had no effect.

In 16.0.0-RC4 it has the desired effect for taking the reference image. At 20% it looks perfect. At 100% you can hardly recognize anything. After reboot all images for recognizing the reading are taken at 100%. Also live stream is using 100% which is way to much.

Version

16.0.0-RC4

Logfile

[0d00h00m04s] 2024-10-17T01:19:38 <INF> [SNTP] Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
[0d00h00m04s] 2024-10-17T01:19:38 <INF> [SNTP] time zone: +0200 Delta to UTC: 7200 seconds
[0d00h00m04s] 2024-10-17T01:19:38 <INF> [SNTP] Time is already set: 2024-10-17 01:19:38
[0d00h00m04s] 2024-10-17T01:19:38 <INF> [MAIN] CPU frequency: 160 MHz
[0d00h00m05s] 2024-10-17T01:19:38 <INF> [OTA] Start update process (/sdcard/firmware/AI-on-the-edge-device__update__16.0.0-RC4.zip)
[0d00h00m05s] 2024-10-17T01:19:38 <INF> [OTA] File: /sdcard/firmware/AI-on-the-edge-device__update__16.0.0-RC4.zip Filetype: ZIP
[0d00h00m05s] 2024-10-17T01:19:38 <INF> [OTA FILE] Files to be extracted: 97
[0d00h01m05s] 2024-10-17T01:20:38 <INF> [OTA] Files unzipped.
[0d00h01m05s] 2024-10-17T01:20:38 <INF> [OTA] Found firmware.bin
[0d00h01m22s] 2024-10-17T01:20:55 <INF> [OTA] Trigger reboot due to firmware update
[0d00h01m22s] 2024-10-17T01:20:55 <WRN> [OTA] Reboot in 5sec
[0d00h00m03s] 2024-10-17T01:21:05 <INF> [SNTP] Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
[0d00h00m03s] 2024-10-17T01:21:05 <INF> [SNTP] time zone: +0200 Delta to UTC: 7200 seconds
[0d00h00m03s] 2024-10-17T01:21:05 <INF> [SNTP] Time is already set: 2024-10-17 01:21:05
[0d00h00m03s] 2024-10-17T01:21:05 <INF> [MAIN] CPU frequency: 160 MHz
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [SDCARD] Folder/file presence check started...
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [SDCARD] Folder/file presence check successful
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [MAIN] Tag: '16.0.0-RC4', Release: 16.0.0-RC4 (Commit: 0a4560e+), Date/Time: 2024-10-06 22:22, Web UI: Release: 16.0.0-RC4 (Commit: 0a4560e+)
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [MAIN] Reset reason: Via esp_restart
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [WLANINI] SSID: Hinterhof
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [WLANINI] Password: XXXXXXXX
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [WLANINI] Hostname: watermeter
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [MAIN] WLAN config loaded, init WIFI...
[0d00h00m03s] 2024-10-17T01:21:06 <INF> [WIFI] Automatic interface config --> Use DHCP service
[0d00h00m04s] 2024-10-17T01:21:06 <INF> [WIFI] Set hostname to: watermeter
[0d00h00m04s] 2024-10-17T01:21:06 <INF> [WIFI] Init successful
[0d00h00m06s] 2024-10-17T01:21:09 <INF> [WIFI] Connected to: Hinterhof, RSSI: -72
[0d00h00m07s] 2024-10-17T01:21:10 <INF> [WIFI] Assigned IP: 192.168.178.71
[0d00h00m09s] 2024-10-17T01:21:12 <INF> [SNTP] Time is synced with NTP Server pool.ntp.org: 2024-10-17 01:21:12
[0d00h00m10s] 2024-10-17T01:21:12 <INF> [MAIN] Device info: CPU cores: 2, Chip revision: 300
[0d00h00m10s] 2024-10-17T01:21:12 <INF> [MAIN] SD card info: Name: SD32G, Capacity: 30028MB, Free: 29990MB
[0d00h00m12s] 2024-10-17T01:21:14 <INF> [MAIN] Initialization completed successfully
[0d00h00m15s] 2024-10-17T01:21:17 <INF> [TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m15s] 2024-10-17T01:21:18 <INF> [TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m15s] 2024-10-17T01:21:18 <INF> [LOGFILE] Set log level to ERROR
[0d00h01m33s] 2024-10-17T01:22:35 <ERR> [POSTPROC] main: Raw: 11445.3333, Value: , Status: Rate too high - Read: 11445.3333 - Pre: 484.7713 - Rate: 10960.5620
[0d00h06m33s] 2024-10-17T01:27:35 <ERR> [POSTPROC] main: Raw: 11444.3333, Value: , Status: Rate too high - Read: 11444.3333 - Pre: 484.7713 - Rate: 10959.5620
[0d00h11m33s] 2024-10-17T01:32:35 <ERR> [POSTPROC] main: Raw: 11444.3333, Value: , Status: Rate too high - Read: 11444.3333 - Pre: 484.7713 - Rate: 10959.5620
[0d00h00m02s] 2024-10-17T01:46:41 <INF> [SNTP] Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
[0d00h00m02s] 2024-10-17T01:46:41 <INF> [SNTP] time zone: +0200 Delta to UTC: 7200 seconds
[0d00h00m02s] 2024-10-17T01:46:41 <INF> [SNTP] Time is already set: 2024-10-17 01:46:41
[0d00h00m02s] 2024-10-17T01:46:41 <INF> [MAIN] CPU frequency: 160 MHz
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [SDCARD] Folder/file presence check started...
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [SDCARD] Folder/file presence check successful
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [MAIN] Tag: '16.0.0-RC4', Release: 16.0.0-RC4 (Commit: 0a4560e+), Date/Time: 2024-10-06 22:22, Web UI: Release: 16.0.0-RC4 (Commit: 0a4560e+)
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [MAIN] Reset reason: Via esp_restart
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [WLANINI] SSID: Hinterhof
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [WLANINI] Password: XXXXXXXX
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [WLANINI] Hostname: watermeter
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [MAIN] WLAN config loaded, init WIFI...
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [WIFI] Automatic interface config --> Use DHCP service
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [WIFI] Set hostname to: watermeter
[0d00h00m03s] 2024-10-17T01:46:42 <INF> [WIFI] Init successful
[0d00h00m06s] 2024-10-17T01:46:44 <INF> [WIFI] Connected to: Hinterhof, RSSI: -72
[0d00h00m07s] 2024-10-17T01:46:45 <INF> [WIFI] Assigned IP: 192.168.178.71
[0d00h00m08s] 2024-10-17T01:46:46 <INF> [SNTP] Time is synced with NTP Server pool.ntp.org: 2024-10-17 01:46:46
[0d00h00m09s] 2024-10-17T01:46:48 <INF> [MAIN] Device info: CPU cores: 2, Chip revision: 300
[0d00h00m09s] 2024-10-17T01:46:48 <INF> [MAIN] SD card info: Name: SD32G, Capacity: 30028MB, Free: 29990MB
[0d00h00m11s] 2024-10-17T01:46:50 <INF> [MAIN] Initialization completed successfully
[0d00h00m14s] 2024-10-17T01:46:52 <INF> [TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m14s] 2024-10-17T01:46:52 <INF> [TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m14s] 2024-10-17T01:46:53 <INF> [LOGFILE] Set log level to ERROR
[0d00h01m32s] 2024-10-17T01:48:11 <ERR> [POSTPROC] main: Raw: 003N4.3713, Value: , Status: Neg. Rate - Read: - Raw: 003N4.3713 - Pre: 484.7713
[0d00h06m31s] 2024-10-17T01:53:10 <ERR> [POSTPROC] main: Raw: 00434.3713, Value: , Status: Neg. Rate - Read: - Raw: 00434.3713 - Pre: 484.7713
[0d00h11m32s] 2024-10-17T01:58:11 <ERR> [POSTPROC] main: Raw: 00434.3713, Value: , Status: Neg. Rate - Read: - Raw: 00434.3713 - Pre: 484.7713

Expected Behavior

Use configured LED intensity in all places (= reference / recognition / live stream).

Screenshots

image image image

Additional Context

No response

caco3 commented 6 days ago

@Slider0007 or @SybexX Does one of you know where the issue lies? I guess it is a regression since we extended the CAM control.

SybexX commented 6 days ago

@caco3 maybe at this point: Unbenannt

The LEDIntensity is only set when starting the ESP (read config.ini / in ClassFlowTakeImage.cpp) and when you change it on the web UI (in MainFlowControl.cpp), so I suspect it's a timing problem. I think I read somewhere that with "LEDC_AUTO_CLK" the stability of the PWM-frequency is not guaranteed and problems may arise.

Slider0007 commented 6 days ago

LED intensity is controlled by adapting the duty cycle and not clock config. The clock source was not changed at all the last versions and is the same in 15.7 and 16.0.

I assume it's related to the recent cam config changes --> @SybexX

In 15.7.0 (and below) LED intensity had no effect.

This sentence from @TheChatty I do not understand at all...

TheChatty commented 5 days ago

In 15.7.0 (and below) LED intensity had no effect.

This sentence from @TheChatty I do not understand at all...

In versions up to 15.7 changing the intensity had no effect.

In version 16.0.0-RC4 changing the intensity has an effect during reference image creation only.

TheChatty commented 4 days ago

I went back to /edit_reference.html and lowered LED intensity even more to 5%, saved settings and new reference image. And now it is working as expected. New images look "exactly" like the reference image. Recognition is working.

When I now try to create a new reference image at 20% intensity... it is again much to bright. So it looks like my 3-days-old image was taken at a lower intensity but in settings I saved it to 20%? I guess we can only close this issue.

SybexX commented 4 days ago

@TheChatty In version 15.7.0 CamGainceiling was set to x4, since many complained about the image being too dark, in version 16.0.0 it was increased to x8 (the higher CamGainceiling is set, the brighter the image becomes).