Skip to content

Handle empty per-image boxes in MMDetection COCO conversion - #3271

Open
dajiaohuang wants to merge 1 commit into
activeloopai:mainfrom
dajiaohuang:fix-mmdet-empty-coco-boxes-3266
Open

dajiaohuang wants to merge 1 commit into
activeloopai:mainfrom
dajiaohuang:fix-mmdet-empty-coco-boxes-3266

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 7, 2026 •

Copy link
Copy Markdown

Impact: Bug fix. ### Description: Fixes #3266. Initialize an empty (0, 4) box result for images with no boxes in the two affected converters, preventing unbound locals and stale boxes from a previous image. Validation: git diff --check passed. No tests or builds were run per assignment. ### Things to be aware of: The fix is scoped to the reported call path and preserves the existing API. ### Things to worry about: Tests and runtime validation were not run. ### Additional Context: No additional dependency or migration changes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of images with no bounding boxes during format conversion, preserving the expected empty box shape and data type.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2bfccc5-0b2c-459a-a68f-e676b7b72eb5
📥 Commits

Reviewing files that changed from the base of the PR and between f432041 and da3f2cd.

📒 Files selected for processing (1)
  • python/deeplake/integrations/mmdet/mmdet_dataset_.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The Pascal fractional and YOLO pixel box converters now assign an empty (0, 4) array with the input dtype when an image has no boxes. Non-empty conversion paths are unchanged.

Changes

Empty Box Converters

Layer / File(s) Summary
Empty array assignment
python/deeplake/integrations/mmdet/mmdet_dataset_.py
pascal_frac_2_coco_pixel and yolo_pixel_2_coco_pixel assign an empty (0, 4) array with the input dtype for empty per-image box arrays.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to da3f2

Boxless images in mixed datasets now produce empty results instead of failing or reusing stale boxes. No introduced merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: handling empty per-image boxes in the MMDetection COCO conversion.
Description check ✅ Passed The description covers the bug-fix impact, linked issue, affected converters, expected behavior, implementation scope, validation status, concerns, and additional context. It is complete enough despit…
Linked Issues check ✅ Passed The PR addresses issue #3266 in both affected converters. pascal_frac_2_coco_pixel and yolo_pixel_2_coco_pixel now create an empty (0, 4) array for empty per-image boxes. This prevents an unboun…
Out of Scope Changes check ✅ Passed The reported changes are limited to python/deeplake/integrations/mmdet/mmdet_dataset_.py and the two converter paths named by issue #3266. The changes support the requested empty-box behavior and do…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each box with care,
Empty rows still find an array there.
Four columns wait, their dtype stays,
No stale boxes cross image ways.
The converters hop along their way.

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

This branch has not been deployed

No deployments
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.

[BUG] MMDetection COCO box converters fail on empty per-image boxes

1 participant