mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #335] preprocess _transfrom function #290
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#290
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sherlock666 on GitHub (Mar 10, 2023).
Original GitHub issue: https://github.com/openai/CLIP/issues/335
For preprocess:
Compose(
Resize(size=224, interpolation=bicubic, max_size=None, antialias=None)
CenterCrop(size=(224, 224))
<function _convert_image_to_rgb at 0x7f6d51348af0>
ToTensor()
Normalize(mean=(0.48145466, 0.4578275, 0.40821073), std=(0.26862954, 0.26130258, 0.27577711))
)
I don't understand that why the code uses CenterCrop with size 224,224
when image is already resized to 224,224? (Resize(size=224, interpolation=bicubic, max_size=None, antialias=None))
what's the use for CenterCrop here? is it neccesary to do centercrop here?
thanks!!
@shreydan commented on GitHub (Mar 14, 2023):
torchvision docs: Resize
_transform(n_px)takes in a single n_px value equal to the input_resolution of the image model. So as per the docs, the smaller edge on image becomes n_px long. Then a final CenterCrop for n_px*n_px image.Sequenceinstead ofList#485