Skip to content

fix(image): respect do_resize=False in ConvNeXT preprocessing - #771

Merged
joein merged 3 commits into
qdrant:mainfrom
RAMZI0TO99:fix/convnext-do-resize-split
Oct 5, 2026
Merged

joein merged 3 commits into
qdrant:mainfrom
RAMZI0TO99:fix/convnext-do-resize-split

Conversation

@RAMZI0TO99

Copy link
Copy Markdown
Contributor

The ConvNeXT branch adds resize and its coupled crop despite do_resize=False. For a patterned 96x160 input with target 224, the output becomes (3, 224, 224) rather than (3, 96, 160). Already-sized inputs can also have their pixels changed.

This skips ConvNeXT geometry when resizing is explicitly disabled. An omitted flag still defaults to enabled, and subsequent rescaling/normalization continue. Tests check shape and pixel preservation for portrait/landscape/already-sized inputs, targets 224/384/512, enabled and omitted flags, subsequent processing, and unchanged CLIP/SigLIP behavior.

Validation on Windows 11, Python 3.13.5, NumPy 2.3.5, FastEmbed 0.8.1:

  • 36 selected tests passed: python -m pytest -q tests/test_convnext_do_resize.py tests/test_image_transform.py.
  • Local diff-scoped AST docstring coverage: 8/8 functions (100%, above the reported 80% threshold). CodeRabbit's own result is separate.
  • Ruff 0.3.4 lint/format and staged whitespace checks passed.
  • Repository mypy and pyright checks passed on Python 3.13.5.

The full model/OS/Python CI matrix was not run locally.

Split from #766 following the maintainer's request for one PR per problem. This branch is based directly on current main and contains only this problem's production change and regression module.

@RAMZI0TO99
RAMZI0TO99 requested a review from joein as a code owner October 4, 2026 13:12
@coderabbitai

coderabbitai Bot commented Oct 4, 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: 499a9dcd-1aa5-4634-9726-58a1cbfd4d3c
📥 Commits

Reviewing files that changed from the base of the PR and between 02a1aad and 97e6734.

📒 Files selected for processing (1)
  • fastembed/image/transform/operators.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • fastembed/image/transform/operators.py

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


📝 Walkthrough

Walkthrough

ConvNextFeatureExtractor now defaults do_resize to true. When do_resize is false, it returns without adding resize or center-crop transforms.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 97e67

The resize flag now has the intended behavior. No actionable issue was established that would prevent merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to d3c40

The fix preserves default behavior and makes explicitly disabled resizing work as requested. Its security significance is limited to configurations that disable resizing, where caller-supplied image dimensions can now reach inference. No security finding was established, but downstream size limits and resource exposure remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Changed dimension reachability is conditional on a ConvNeXT configuration explicitly disabling resizing. Such configurations can now deliver caller-supplied dimensions to array construction and inference unless other transforms constrain them. Whether that increases service-level resource exposure depends on unavailable model and deployment controls.

Trust Boundaries and Controls

  • observed — Resize policy is read from the model directory's configuration file, whereas images enter through the embedding call. The inspected change honors that existing policy; it does not add a per-image resize-policy override. The omitted-flag path remains resize-enabled.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the change: ConvNeXT preprocessing now respects do_resize=False.
Description check ✅ Passed The description explains the ConvNeXT resize behavior, the intended fix, and the reported tests and validation. It is directly related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files.
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 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

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

@joein

joein commented Oct 5, 2026

Copy link
Copy Markdown
Member

Thanks @RAMZI0TO99! This is a good change for future models, since it makes ConvNeXT preprocessing respect do_resize the way HF does. It doesn't affect any of our current models.
I dropped the test module since the fix is a small guard.

@joein
joein merged commit 497800c into qdrant:main Oct 5, 2026
12 checks passed
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.

2 participants