pyro-api icon indicating copy to clipboard operation
pyro-api copied to clipboard

Triangulation inside API

Open MateoLostanlen opened this issue 3 months ago • 3 comments

For the past few months we have been able to localize fires through triangulation. Until now this code has been running on the platform, but I propose to migrate it to the API because (1) it makes more sense and (2) its migration to the new platform would otherwise be quite complex

The code works as follows:

For all sequences, if they overlap in time and if their detection cones intersect, they potentially represent the same event (Phase 1 in the code)

Once we have candidates, we filter triangulations with more than 2 detections. Since our azimuth estimation is not very precise, 3 sequences may represent the same alert without forming a strict triple intersection (see example image). In this case, we use Phase 2 to accept these triple triangulations within a margin distance

Screenshot 2025-09-26 at 09 08 07

MateoLostanlen avatar Sep 25 '25 11:09 MateoLostanlen

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.67%. Comparing base (9cba4af) to head (6872a90).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #516      +/-   ##
==========================================
+ Coverage   84.07%   93.67%   +9.59%     
==========================================
  Files          39        3      -36     
  Lines        1212       79    -1133     
==========================================
- Hits         1019       74     -945     
+ Misses        193        5     -188     
Flag Coverage Δ
backend ?
client 93.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 26 '25 07:09 codecov[bot]

Thanks! Feature-wise

  • I agree this should be done on the backend because this is the only entity that receives all detections + has access to history.
  • For this reason, I think we should run the code as a background tasks after a detection is created if some conditions are met :) (more or so, we a camera position is set, we should be able to know if its point of view can intersect any other)

Product-wise I think this is also the time to consider all general cases for the near future. Events we'll likely have:

  • automatic detection from our camera with only a picture + azimuth + range
  • user pinpointing a location (seeing the picture and knowing the location, they can confidently say the visible part of the fire is near GPS coordinate XYZ) Callback/background:
  • this triangulation for automatic detection
  • modification of the location by the user We'll have a very solid product + roadmap if we can handle all those

Code-wise: can you elaborate on the changes you made to facilitate the review? :)

frgfm avatar Sep 26 '25 11:09 frgfm