Guard sequence matching against anchor jumps

Open
#739 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
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
fastapi, postgresql, python

Research direction

Start by reading issues #662 and #730, then locate the sequence matching logic and the test_best_matching_sequence cases mentioned here. Check how candidate selection handles box size ratios, intersections, and SEQUENCE_BBOX_TOLERANCE; calibrate any default against production data. Done means the regressions are covered and matches no longer jump to an aberrant box under the described conditions.

Written by the indexing model from the issue text.

Description

Follow-up to #662 and #730.

#730 attaches a bbox to the best-matching sequence instead of the first one. It does not address the third weakness of #662: once an aberrant bbox is attached, the sequence's anchor moves onto it and later boxes follow. Geometry alone also cannot settle some cases, two of which are pinned in test_best_matching_sequence:

  • a plume fading back to a small box, 0.05 from a same-sized neighbour, goes to the neighbour;
  • a large plume centred exactly on a new small box beats a same-sized neighbour shifted by 75 % of its width.

Proposal

Reject or demote a match when the new box does not look like the sequence's last real box:

  • Size ratio. If the new box area is more than N times the last box area (or less than 1/N), require a real intersection rather than tolerated edge contact. In the July case the giant box was ~1000x fire A's last box and matched it through a single edge.
  • No edge contact under competition. When several sequences are candidates, require a positive intersection. Keep SEQUENCE_BBOX_TOLERANCE for the single-candidate case only.

N should be calibrated on production data before choosing a default.

Out of scope: median-of-K inertia from #662, which changes the latest-bbox query and deserves its own discussion.

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.