-
Notifications
You must be signed in to change notification settings - Fork 5
Add support for occurrence tracking #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: deployments/ood.antenna.insectai.org
Are you sure you want to change the base?
Add support for occurrence tracking #863
Conversation
✅ Deploy Preview for antenna-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…on similarity vecto
ami/ml/tracking.py
Outdated
) | ||
|
||
|
||
def get_latest_feature_vector(detection: Detection): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure all detections use the same feature extraction algorithm for both captures. See the most_common_algorithm
function in the clustering function.
ami/ml/models/pipeline.py
Outdated
job_logger.info(f"Creating occurrences for {len(detections)} detections ") | ||
job_logger.info("type logger: " + str(type(job_logger))) | ||
|
||
assign_occurrences_by_tracking(detections=detections, logger=job_logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if all captures have been processed in a Session before calling assign_occurrences_by_tracking().
Add logging statement to say when a session is complete. But this check should only consider captures that are in the collection (not all captures).
@mohamedelabbas1996 Notes from our call
Other approaches:
Other notes: |
✅ Deploy Preview for antenna-ood ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@mohamedelabbas1996 can you make this a separate job for now? So it's optional to run, and possible to run on existing occurrences that have already been processed. It can be triggered from the Django admin, as a start. |
…/antenna into feat/restore-tracking
Thanks for the great work @mohamedelabbas1996, I started testing today. Here are some observations so far: The code checks if all captures in an event have been processed. Which makes sense however there are two caveats I am running into:
We really need a way to process a whole session at once! (quick actions or a filter in the new collection form). Maybe can be added to #800. Or for now perhaps we add a quick action from the Django admin. It's difficult to test tracking at the moment. Small TODOs (I will complete these or add more detail later.
|
a011a5f
to
3528f27
Compare
I just found this note in the
|
Summary
This PR introduces and adapts the occurrence tracking feature to the Antenna platform, ensuring it works seamlessly with the ML processing job flow.
List of Changes
-Introduced tracking as a separate job that can be triggered from the admin page.
Added a new field
next_detection
to the Detection model to link detections in temporal order within a session.Implemented checks to:
Run tracking only after all detections in an event are fully processed.
Skip events with human identifications to preserve valuable manually reviewed data in this v1 implementation.
Added a robust pair_detections algorithm that matches detections between consecutive frames based on feature similarity and spatial cost.
Old occurrences are deleted and reassigned based on the new tracking logic (when safe to do so).
Related Issues
#457
Detailed Description
Tracking is now a separate jonb that builds chains of related detections across consecutive source images within a session. These chains are constructed using a cost function that considers both feature vectors and spatial relationships.
The new Detection.next_detection field allows explicit, traceable linkage between detections and makes it easy to visualize or debug tracking chains.
Load a test project with synthetic data and occurrences.
Run the ML processing job on a selected collection.
Trigger the tracking job from admin page.
Verify in the occurrence list view that:
New occurrences have been created only for eligible sessions.
Some occurrences include multiple detections.
Detections are linked via the next_detection field.
Screenshots
Tracked occurrences with multiple detections


Deployment Notes
N/A
Checklist