Skip to content

Invalidate evaluation metrics on annotation bounding-box update#1628

Open
MalteEbner wants to merge 1 commit into
mainfrom
malte-invalidate-evaluation-object-detection
Open

Invalidate evaluation metrics on annotation bounding-box update#1628
MalteEbner wants to merge 1 commit into
mainfrom
malte-invalidate-evaluation-object-detection

Conversation

@MalteEbner

@MalteEbner MalteEbner commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Per-annotation model evaluation results are precomputed. When updating the bbox, they did not update. This PR deletes them, because they are invalid.

Split out of #1612; the segmentation-mask half follows in a separate PR.

Design decision: Delete them instead of marking them as stale

Delete the invalid rows. This is easiest and automatically makes all consumers work.

Marking stale would only be needed if we would want to recompute only the invalid evaluation metrics instead of directly all metrics. I don't see a need for that.

How has it been tested?

new unittests

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Summary by CodeRabbit

  • Bug Fixes

    • Updating an annotation’s bounding box now clears related evaluation metrics tied to the affected samples, so follow-up evaluations use the new bounding box values.
    • Ensures both annotation-level and sample-level evaluation metrics are refreshed accordingly.
  • Tests

    • Added coverage to verify that evaluation metrics are deleted when bounding boxes are updated.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cecd4b51-4126-426a-a56c-d874bd955811

📥 Commits

Reviewing files that changed from the base of the PR and between 8d8be61 and 005f60c.

📒 Files selected for processing (3)
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/__init__.py
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py
  • lightly_studio/tests/resolvers/annotations/test_annotations_update_bounding_box.py
✅ Files skipped from review due to trivial changes (1)
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/init.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py
  • lightly_studio/tests/resolvers/annotations/test_annotations_update_bounding_box.py

📝 Walkthrough

Walkthrough

Bounding box updates now delete evaluation annotation and sample metrics associated with the annotation before saving new coordinates. Tests create both metric types, perform the update, and verify their removal.

Changes

Bounding box metric invalidation

Layer / File(s) Summary
Invalidate metrics during bounding box updates
lightly_studio/src/lightly_studio/resolvers/annotation_resolver/__init__.py, lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py
The resolver exports and calls evaluation metric deletion for the annotation’s sample identifiers before updating and committing bounding box fields.
Validate metric deletion
lightly_studio/tests/resolvers/annotations/test_annotations_update_bounding_box.py
The test creates evaluation annotation and sample metrics, updates a ground-truth bounding box, and verifies that both metric collections are empty.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: IgorSusmelj, michal-lightly

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: invalidating evaluation metrics when a bounding box is updated.
Description check ✅ Passed The description covers what changed, why, how it was tested, and changelog status, matching the required template.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch malte-invalidate-evaluation-object-detection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce2372ac44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py (1)

12-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Import delete_annotation as a module here delete_evaluation_metrics is a direct function import from a non-allowlisted module. Import delete_annotation instead and call delete_annotation.delete_evaluation_metrics(...) to match the existing module import pattern.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py`
around lines 12 - 14, The direct import of delete_evaluation_metrics violates
the module import pattern. In update_bounding_box.py, import the
delete_annotation module instead and update all references to call
delete_annotation.delete_evaluation_metrics(...).

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py`:
- Around line 12-14: The direct import of delete_evaluation_metrics violates the
module import pattern. In update_bounding_box.py, import the delete_annotation
module instead and update all references to call
delete_annotation.delete_evaluation_metrics(...).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cc9e6e30-3b15-4482-9271-46584054448b

📥 Commits

Reviewing files that changed from the base of the PR and between c0235f5 and ce2372a.

📒 Files selected for processing (2)
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py
  • lightly_studio/tests/resolvers/annotations/test_annotations_update_bounding_box.py

@MalteEbner
MalteEbner force-pushed the malte-invalidate-evaluation-object-detection branch from ce2372a to 8d8be61 Compare July 10, 2026 15:24
Bounding-box updates mutate the object-detection detail row in place and
previously left the precomputed evaluation metrics (evaluation_annotation_metric,
evaluation_sample_metric) stale. Reuse the existing delete_evaluation_metrics()
helper so the affected rows are invalidated, matching the delete path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MalteEbner
MalteEbner force-pushed the malte-invalidate-evaluation-object-detection branch from 8d8be61 to 005f60c Compare July 10, 2026 15:27
@MalteEbner

Copy link
Copy Markdown
Contributor Author

/review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant