Skip to content

fix: lower detection threshold and improve IR camera timing for Lenovo#38

Open
amletoflorio wants to merge 2 commits intoVladush:masterfrom
amletoflorio:fix/lenovo-ir-camera
Open

fix: lower detection threshold and improve IR camera timing for Lenovo#38
amletoflorio wants to merge 2 commits intoVladush:masterfrom
amletoflorio:fix/lenovo-ir-camera

Conversation

@amletoflorio
Copy link
Copy Markdown

Problem

On Lenovo laptops with IR cameras, enrollment fails with:
ENROLL_FAIL Found 0 faces in ir. Expecting exactly 1.

Root causes

  1. detection_threshold = 0.9 is too high for IR cameras — YuNet scores
    rarely exceed 0.7 on grayscale/low-contrast IR images.
  2. IR_TRIGGER_DELAY_MS = 200ms is too short for Lenovo IR emitters,
    resulting in near-black frames (brightness ~14/255) at capture time.
  3. Insufficient warmup frames for IR exposure stabilization.

Changes

  • Lower DEFAULT_DETECTION_THRESHOLD from 0.9 to 0.6
  • Increase IR_TRIGGER_DELAY_MS from 200ms to 1500ms
  • Increase CAMERA_WARMUP_FRAMES (10→15) and CAMERA_WARMUP_DELAY_MS (100→200ms)
  • Always save failed enrollment frame with brightness + YuNet score in logs
  • Add docs/LENOVO_IR_DEBUG.md with full troubleshooting guide

Tested on

Lenovo laptop, Ubuntu 26.04, kernel 7.x, IR camera on /dev/video2

@amletoflorio amletoflorio requested a review from Vladush as a code owner April 14, 2026 08:58
@Vladush
Copy link
Copy Markdown
Owner

Vladush commented Apr 14, 2026

@amletoflorio Thanks for opening the PR. I'll take a look on it as soon as my schedule will allow me that.
In the mean time - please note, that the whole development and main testing was done on my Lenovo Yoga Pro 7 (14ASP9) - so all defaults are working perfectly fine here. Also checked on Lenovo Thinkpad and worked fine too.
So, changing defaults, which can be adjusted in config and may be different on each system - may not be the best idea.

- Lower DEFAULT_DETECTION_THRESHOLD from 0.9 to 0.6
- Increase IR_TRIGGER_DELAY_MS from 200ms to 1500ms
- Increase CAMERA_WARMUP_FRAMES (10->15) and CAMERA_WARMUP_DELAY_MS (100->200ms)
- Always save failed enrollment frame with brightness and score info
- Add YuNet face score logging to help diagnose threshold issues
- Add docs/LENOVO_IR_DEBUG.md with full troubleshooting guide

Tested on Lenovo with Ubuntu 26.04, /dev/video2 IR camera.
@amletoflorio amletoflorio force-pushed the fix/lenovo-ir-camera branch from 59e3450 to 7cc2ba1 Compare April 14, 2026 09:07
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

Successfully merging this pull request may close these issues.

2 participants