diff --git a/python/paddle/vision/transforms/functional.py b/python/paddle/vision/transforms/functional.py index 3087d5c3ed57702e9bd4d8de7a9a2273876101c7..8caab964bf87bb0a6621c4c3f86995dc36f548d9 100644 --- a/python/paddle/vision/transforms/functional.py +++ b/python/paddle/vision/transforms/functional.py @@ -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)): diff --git a/python/paddle/vision/transforms/transforms.py b/python/paddle/vision/transforms/transforms.py index 9fd200bf0344d58d6a2705d768afffc7ce92dcc2..a22f8a2ab40499c01ead49a8020fa73e8aef7a10 100644 --- a/python/paddle/vision/transforms/transforms.py +++ b/python/paddle/vision/transforms/transforms.py @@ -395,12 +395,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):