resnext101_32x4d_gn-ac3bb84e.pth
PyTorch Res2Net
在线加载模型地址

确定自己使用的框架并导入对应的库。导入库实现样例代码可参考 文档中心-预训练模型使用教程

在代码中实现加载预训练模型地址

调用模型的实现方法

import torchvisionfrom flyai.utils import remote_helper 

 path=remote_helper.get_remote_data("https://www.flyai.com/m/resnext101_32x4d_gn-ac3bb84e.pth")  

 model = torchvision.models.res2net101(pretrained = False) # model = torchvision.models.res2net101(pretrained = True) # 这行代码与上面等同,只不过一个是调用FlyAI提供的预训练模型地址,一个是外网的地址model.load_state_dict(torch.load(path)# 将其中的层直接替换为我们需要的层即可  model.fc = nn.Linear(2048,200)