Skip to content

Preserve YOLO box dimensions in MMDetection conversion - #3178

Open
dajiaohuang wants to merge 3 commits into
activeloopai:mainfrom
dajiaohuang:fix-mmdet-yolo-box-scaling
Open

dajiaohuang wants to merge 3 commits into
activeloopai:mainfrom
dajiaohuang:fix-mmdet-yolo-box-scaling

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 2, 2026 •

Copy link
Copy Markdown

Fixes #3177.

Use the actual half-width and half-height when converting YOLO center/size boxes into LTRB coordinates. This preserves odd and subpixel dimensions. Alias the imported helper so the integration wrapper calls the helper instead of recursively calling itself.

Validation at e3bc9838005a821ee56a416449f382fdb95d5226: git diff --check passed. The published dispatcher reproduced RecursionError; focused checks of the actual checkout's import binding and conversion functions pass pixel, fractional and empty-array cases. The helper and its two existing NumPy regressions are unchanged from their previously passing revision. The complete module and MMDetection runtime were not exercised: mmcv and mmdet are unavailable. Native integration acceptance remains unverified.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 3c6617cf-ca31-452f-b0ca-ccc60c98f49b

📥 Commits

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

📒 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; 2 remain after this review.


📝 Walkthrough

Walkthrough

The YOLO-to-Pascal pixel conversion now uses exact half-widths and half-heights to calculate box edges. Odd-sized boxes can produce fractional edge coordinates.

Changes

YOLO box conversion

Layer / File(s) Summary
Calculate box edges
python/deeplake/integrations/mmdet/mmdet_dataset_.py
yolo_pixel_2_pascal_pixel uses exact half-widths and half-heights instead of flooring them. Odd-sized boxes can produce fractional edge coordinates.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to a1bbc

Odd-sized boxes retain their intended dimensions, and the supported MMDetection pipeline preserves fractional box coordinates. No merge-blocking issue remains.

Architecture Summary

Architecture risk: 🔵 Low · up to a1bbc

The change affects 1 system.

Changed systems: python

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — python (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in python/deeplake/integrations/mmdet/mmdet_dataset_.py: yolo_pixel_2_pascal_pixel no longer floors half the box width and height before calculating the top-left and bottom-right edges; it uses exact halves, allowing fractional coordinates for odd dimensions.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR #3178 addresses the coding requirement in issue #3177. In python/deeplake/integrations/mmdet/mmdet_dataset_.py, yolo_pixel_2_pascal_pixel now computes LTRB edges with the actual half-width and …
Out of Scope Changes check ✅ Passed The reported change is limited to the conversion logic identified by issue #3177. The four added and four removed lines support the requested dimension-preservation behavior. No unrelated implementati…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Title check ✅ Passed The title clearly describes the main change: preserving YOLO box dimensions during MMDetection conversion.
Description check ✅ Passed The description explains the conversion change, links the issue, describes validation, and states the unverified MMDetection runtime limitation. It does not use the template headings or impact checkli…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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
No rounded halves can shrink it there
Odd edges keep their measured place
Fractions land with quiet grace
The carrots wait; the bounds are right
Then off I hop into the night

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

@khustup2

khustup2 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

This changes behavior in a maintenance-only integration (MM/Labelbox/COCO) rather than fixing a defect, and it has no owner review or integration run behind it. Holding it: it needs the integration owner to decide whether the new behavior is wanted. No action needed from you now.

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.

MMDetection YOLO boxes shrink during pixel conversion

2 participants