Skip to content

Update ViTMatte Node - #72

Open
demoulinv wants to merge 2 commits into
mainfrom
bugfix/vitMatteProcessing
Open

Update ViTMatte Node#72
demoulinv wants to merge 2 commits into
mainfrom
bugfix/vitMatteProcessing

Conversation

@demoulinv

Copy link
Copy Markdown
Collaborator

This pull request adds an option to limit the inference size in the ViTMatte node, improving flexibility and efficiency when processing images. The main changes introduce a new parameter to enable or disable automatic resizing of input images and trimaps, and adjust the inference pipeline to respect this setting.

Parameter and UI changes:

  • Added a new boolean parameter limitInferenceSize to the ViTMatte node, allowing users to enable or disable automatic resizing of input images and trimaps for inference. The inferenceSize parameter is now only enabled if limitInferenceSize is True.

Inference pipeline logic:

  • Updated the processChunk method to check the limitInferenceSize parameter and conditionally resize the input image and trimap only when this option is enabled.
  • Modified the data preparation for inference: when resizing is disabled, the original image and trimap are used without resizing; when enabled, both are resized to the specified inference size.
  • Adjusted the post-processing step to resize the output matte only if resizing was applied during inference, ensuring correct output dimensions.

@demoulinv
demoulinv requested a balanced review from Copilot August 21, 2026 12:35
@demoulinv demoulinv self-assigned this Aug 21, 2026

Copilot AI 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.

Pull request overview

Adds configurable ViTMatte inference resizing while preserving output dimensions.

Changes:

  • Adds limitInferenceSize and conditionally enables inferenceSize.
  • Supports full-resolution inference when resizing is disabled.
  • Conditionally restores matte dimensions after inference.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread meshroom/vitMatte/ViTMatte.py Outdated
Comment on lines +403 to +405
if limitedSize:
matte = cv2.resize(matte, (w_inference, h_inference))
box_matteRGB = cv2.resize(box_matteRGB, (w_inference, h_inference), interpolation=cv2.INTER_LINEAR)
@demoulinv
demoulinv requested a review from cbentejac August 21, 2026 13:56
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