We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
paddle2.3.0版本新增API: ResNeXt import不到
文档示例:https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/ResNeXt_cn.html#resnext
from paddle.vision.models import ResNeXt --------------------------------------------------------------------------- ImportError Traceback (most recent call last) /tmp/ipykernel_56773/3270776819.py in <module> ----> 1 from paddle.vision.models import ResNeXt ImportError: cannot import name 'ResNeXt' from 'paddle.vision.models' (/opt/anaconda3/lib/python3.7/site-packages/paddle/vision/models/__init__.py)
版本:paddlepaddle-gpu 2.3.0
我去翻了github上的源码,好像确实没有把这个API给暴露出来
No response
The text was updated successfully, but these errors were encountered:
您好,此问题属于产品技术BUG,我们会尽快改进,感谢您提出的宝贵意见,谢谢。
Sorry, something went wrong.
@chenqianhe
由于 2.3.0 发布前夕对 ResNeXt 系列的实现进行了重构,ResNeXt 这个 class 被删去了,但由于中文文档和 Release Note 仍然是 2.3.0rc 时期的内容,会略微滞后一些,因此给你带来困扰很抱歉~
关于 ResNeXt API 无法使用的问题,这里建议使用已经定义好的 resnext50_32x4d 等工厂函数,目前这些工厂函数不依托于 ResNeXt 这个 class API,而是直接复用已有的 ResNet class API(可查看源码了解详情)。
相应的,如果你有更为细致的定制需求的话,建议使用 ResNet 这个 class API,英文文档中示例代码也演示了如何通过 ResNet 实现 resnext50_32x4d。中文文档的话,目前由于 PR 尚未 merge,因此会滞后于英文文档,之后我再催催把那个 PR merge 了(๑><๑)。
示例代码这里搬运一下,以方便查看:
import paddle from paddle.vision.models import ResNet from paddle.vision.models.resnet import BottleneckBlock, BasicBlock # 现在 ResNet class API 既可以实现 ResNet 系列模型,也可以实现 ResNeXt、Wide ResNet 系列模型~ # 18 层的简易 ResNet resnet18 = ResNet(BasicBlock, 18) # 50 层的 ResNet resnet50 = ResNet(BottleneckBlock, 50) # Wide ResNet,参数 width 是默认值 64 的两倍 wide_resnet50_2 = ResNet(BottleneckBlock, 50, width=64*2) # ResNeXt,卷积时分组,参数 groups 是分组数,参数 width 是每组的 width resnext50_32x4d = ResNet(BottleneckBlock, 50, width=4, groups=32) x = paddle.rand([1, 3, 224, 224]) out = resnet18(x) print(out.shape) # [1, 1000]
LielinJiang
Successfully merging a pull request may close this issue.
bug描述 Describe the Bug
paddle2.3.0版本新增API: ResNeXt import不到
文档示例:https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/ResNeXt_cn.html#resnext
版本:paddlepaddle-gpu 2.3.0
我去翻了github上的源码,好像确实没有把这个API给暴露出来
其他补充信息 Additional Supplementary Information
No response
The text was updated successfully, but these errors were encountered: