Device temporal scores: model version, separate threshold, minimum frames

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

Maintainers usually reply within 7 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
fastapi, postgresql, python

Research direction

Read the implementation of POST /detections, pyroclient.create_detection, and the worker branch that handles device scores, along with the existing temporal_model_version, TEMPORAL_MODEL_THRESHOLD, and MIN_FRAMES settings. Check how the engine’s 11-frame window fills early in an event before deciding where the minimum-frame rule belongs. Done means device scores can carry a model version, use their own threshold, and follow a clearly chosen minimum-frame rule.

Written by the indexing model from the issue text.

Description

Follow-up of #723, which stores the temporal score computed on the device with engine as provenance and applies TEMPORAL_MODEL_THRESHOLD to it.

Three things were left out of that PR to keep it small:

  • Model version. The engine sends no version with its scores, so temporal_model_version stays NULL for device scores. We cannot tell which release produced a score or spot calibration drift. Proposal: an optional temporal_model_version form field on POST /detections (and the matching pyroclient.create_detection parameter), stored in the existing column. pyro-engine side: send the version reported by pyro_temporal_api /health.
  • Separate threshold. The device model and the API model share TEMPORAL_MODEL_THRESHOLD, but their scores are not necessarily comparable. Proposal: a DEVICE_TEMPORAL_MODEL_THRESHOLD setting, defaulting to TEMPORAL_MODEL_THRESHOLD, used by the worker's device branch only.
  • Minimum frames. MIN_FRAMES does not apply to device scores: the engine scores its own window (11 frames, pyronear/pyro-engine#415) and sends a score with every frame once an alert is ongoing, so a sequence can validate on its creation frame. Decide whether the engine must score a minimum number of frames before sending scores, or whether the API should require a minimum here. Needs a look at how many frames the engine window holds early in an event.

No migration for the first two.

Dominant language
Python
Stars
31
Forks
15
Avg merge
7d 18h
Merged PRs (30d)
17

Getting set up

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.

More from pyronear/pyro-api

All issues in pyronear/pyro-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.