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
Changes from 1 commit
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
9 changes: 7 additions & 2 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))

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

transform = Resize(size=(200,150))
fake_img = transform(fake_img)
print(fake_img.size)
# (150, 200)
Copy link
Member

@SigureMo SigureMo Mar 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

示例代码个人感觉完全对齐中文文档比较好吧(就是直接 copy,两面完全一致),而且目前英文文档的示例输出应当是 (268, 224)

另外不太建议对同一个 fake_img 连续 transform 两次,这样第二个用例可能会依赖第一个用例,建议 transform 后换一个变量名~感觉参考 paddle.vision.transform.resize 的中英文文档那样就可以~

看样子 paddle.vision.transform.resize 中英文文档也有和 PaddlePaddle/docs#4239 相似的问题呀,可以一起解决下下(๑>؂<๑)~~~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改,因为我的电脑抽取英文文档报错,所以没有对英文的api解释说明修改

具体修改内容如下:

  1. 给resize增加输出示例
  2. 由于Resize的develop中文文档和resize保持一致,所以对英文的Resize的注释部分的代码没有完全和中文保持一致,仅修改示例使得输出一致。

"""

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