Repository navigation
fix: preserve center crop size with odd padding - #746
Conversation
|
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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The padding correction and batch-shape regression test present no identified merge-blocking risk; merge after normal checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Closes #745.
center_cropreturns an undersized image when an input dimension needs an odd number of padding pixels: a 3×3 input cropped to 4×4 currently remains 3×3. With resizing disabled, this can leave differently sized images with inconsistent shapes and preventOnnxImageModelfrom constructing its input batch.Round the leading padding up so it offsets the floor-rounded crop origin. Add regression coverage for PIL and NumPy inputs, odd/even padding, mixed crop/pad axes, and pixel alignment against Pillow's crop result. Two preprocessing tests also cover batches with square and rectangular crop configurations.
Validation
pytest -q tests/test_image_transform.py tests/test_common.py tests/test_preprocessor_utils.py tests/test_postprocess.py— 68 passed.pyright tests/type_stub.pyreported no errors or warnings.All Submissions
pad2squarepath.AI assistance was used for investigation, implementation, and local test execution.