Skip to content

Conversation

guozixu2001
Copy link
Contributor

  1. 修复 torchvision.datasets.VOCDetection torchvision.ops.DeformConv2d 的对应关系中的问题
  2. 新增 33 个和内置模型相关的 torchvision 和 paddle.vision 的对应关系
torchvision.models.alexnet
torchvision.models.densenet121
torchvision.models.densenet161
torchvision.models.densenet169
torchvision.models.densenet201
torchvision.models.googlenet
torchvision.models.inception_v3
torchvision.models.mobilenet_v2
torchvision.models.mobilenet_v3_large
torchvision.models.mobilenet_v3_small
torchvision.models.resnet101
torchvision.models.resnet152
torchvision.models.resnet18
torchvision.models.resnet34
torchvision.models.resnet50
torchvision.models.resnext101_64x4d
torchvision.models.resnext50_32x4d
torchvision.models.shufflenet_v2_x0_5
torchvision.models.shufflenet_v2_x1_0
torchvision.models.shufflenet_v2_x1_5
torchvision.models.shufflenet_v2_x2_0
torchvision.models.squeezenet1_0
torchvision.models.squeezenet1_1
torchvision.models.vgg11
torchvision.models.vgg11_bn
torchvision.models.vgg13
torchvision.models.vgg13_bn
torchvision.models.vgg16
torchvision.models.vgg16_bn
torchvision.models.vgg19
torchvision.models.vgg19_bn
torchvision.models.wide_resnet101_2
torchvision.models.wide_resnet50_2

Copy link

paddle-bot bot commented Nov 13, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6959.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具


| torchvision | PaddlePaddle | 备注 |
| ----------- | ------------ | ---- |
| weights | pretrained | 预训练权重,Paddle 参数 pretrained 为 bool 类型,PyTorch 参数 weights 为 VGG11_BN_Weights 类型,需要转写。|
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个应该就只能是 VGG11_BN_Weights.DEFAULT吧,也就只有一个选择,本质是还是一个bool,推测是paddle相关的开发者简化了这里的设计

是不是判断kwargs中有weights参数,就设置pretrained为True,反之就为False

Copy link
Contributor Author

Choose a reason for hiding this comment

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

有的模型是可以选择的,比如 mobilenet_v2 就可以选择 MobileNet_V2_Weights.IMAGENET1K_V1 或者 MobileNet_V2_Weights.IMAGENET1K_V2
https://pytorch.org/vision/stable/models/generated/torchvision.models.mobilenet_v2.html?highlight=mobilenet_v2#torchvision.models.mobilenet_v2

Copy link
Collaborator

Choose a reason for hiding this comment

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

有的模型是可以选择的,比如 mobilenet_v2 就可以选择 MobileNet_V2_Weights.IMAGENET1K_V1 或者 MobileNet_V2_Weights.IMAGENET1K_V2 https://pytorch.org/vision/stable/models/generated/torchvision.models.mobilenet_v2.html?highlight=mobilenet_v2#torchvision.models.mobilenet_v2

能选择的多吗,那这种就在映射文档里描述一下吧。

写Matcher的时候 还是直接转就行了,因为paddle是唯一的数据集,这个差异比较小就暂不处理了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不是很多。好的 👌

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

  1. progress问题
  2. batch_norm问题

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010
Copy link
Collaborator

@guozixu2001 后续在编写Matcher或单测时发现有问题需及时更正

@zhwesky2010 zhwesky2010 merged commit eef9748 into PaddlePaddle:develop Nov 18, 2024
2 checks passed
WSBG pushed a commit to WSBG/docs that referenced this pull request Nov 27, 2024
* add conversion rules for built-in models of torchvision

* fix typo

* add torchvision in pytorch_api_mapping_cn.md

* fix failed link in pytorch_api_mapping_cn.md

* fix content id order

* add description for torchvision model weights in conversion rules

* add conversion examples for torchvision built-in model

* fix issues about 'batch_norm' and 'progress'

* update conversion examples to focus to ignore batch norm para
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants