pyronear / pyronear/pyro-engine

Add configurable night detection strategy for cameras without IR support

Open
#387 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
19
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Context

Our detection models are trained primarily on daytime images and are not intended to run during the night. Running inference on night images leads to a some false positives.

Current behavior

Night detection currently relies on the camera IR mode (automatic IR detection) to determine when to stop the inference loop.

This assumption does not hold for all cameras, especially third-party cameras that are not installed by Pyronear, as they may not expose or support IR information. In these cases, inference continues throughout the night, resulting in unnecessary detections.

Proposed solution

Make the night detection strategy configurable on a per-camera basis.

One possible strategy is to rely on a sunrise/sunset service using the camera coordinates to determine whether it is currently night. This was the historical implementation and may still exist in the repository (see https://github.com/pyronear/pyro-engine/blob/ecf3a5ab86d42f7b7a279e7629637c87219c7d68/pyroengine/core.py#L34)

As part of this task:

  • Investigate whether the historical sunrise/sunset implementation is still present in the repository.
  • Reuse it if possible; otherwise, reimplement an equivalent solution.
  • Add a configurable parameter to the camera configuration to select the night detection strategy.

Example (to be discussed):

night_detection_strategy: ir
# or
night_detection_strategy: sunrise_sunset

Acceptance criteria

  • A working alternative night detection strategy is available for cameras without IR support.
  • The night detection strategy is configurable in the camera configuration.
  • Existing IR-based behavior remains unchanged.
  • Inference is not executed during night periods for cameras using the configured strategy, reducing night-time false positives.
  • Automated tests are added where appropriate (the repository currently has limited test coverage, making this a good opportunity to improve it).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the historical sunrise/sunset implementation in pyroengine/core.py at the referenced commit, then locate the current camera configuration and inference loop. Add a per-camera strategy setting while preserving IR behavior, and add tests for both strategies and night-time inference suppression. Done means the alternative works without IR support and is configurable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.