Add preserve_border flag to vjepa2_preprocessor (default off) to avoid extra border trimming during eval#73
Add preserve_border flag to vjepa2_preprocessor (default off) to avoid extra border trimming during eval#73Lightet wants to merge 1 commit intofacebookresearch:mainfrom
Conversation
…rue, avoid unnecessary pixel cropping
|
Hi @Lightet! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
Introduce a boolean flag preserve_border in vjepa2_preprocessor (default: False).
When set to True, the eval resize step uses short_side_size = crop_size instead of the ImageNet-style crop_size * 256/224, which otherwise guarantees extra border pixels are trimmed by the subsequent CenterCrop.
Default behavior is unchanged.
Motivation
The current eval transform:
always resizes the short side to a size larger than the crop_size(e.g., 256→292) and then center-crops back to crop_size, discarding border pixels.
Some downstream video tasks are sensitive to peripheral content. preserve_border=True avoids this fixed extra trimming while keeping the output shape the same.
Change
Minimal diff
The key change is in evals/video_classification_frozen/utils.py:
Usage
Impact