Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix paddle.vision.transforms.Resize en docs #40719

Merged
merged 4 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/paddle/vision/transforms/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ def resize(img, size, interpolation='bilinear'):

converted_img = F.resize(fake_img, 224)
print(converted_img.size)
# (262, 224)

converted_img = F.resize(fake_img, (200, 150))
print(converted_img.size)
# (150, 200)
"""
if not (_is_pil_image(img) or _is_numpy_image(img) or
_is_tensor_image(img)):
Expand Down
15 changes: 10 additions & 5 deletions python/paddle/vision/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,17 @@ class Resize(BaseTransform):
from PIL import Image
from paddle.vision.transforms import Resize

transform = Resize(size=224)

fake_img = Image.fromarray((np.random.rand(100, 120, 3) * 255.).astype(np.uint8))
fake_img = Image.fromarray((np.random.rand(256, 300, 3) * 255.).astype(np.uint8))

fake_img = transform(fake_img)
print(fake_img.size)
transform = Resize(size=224)
converted_img = transform(fake_img)
print(converted_img.size)
# (262, 224)

transform = Resize(size=(200,150))
converted_img = transform(fake_img)
print(converted_img.size)
# (150, 200)
"""

def __init__(self, size, interpolation='bilinear', keys=None):
Expand Down