pre_efficientnetv2-m.pth
PyTorch CNN
在线加载模型地址

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

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

调用模型的实现方法

import efficientnetv2_m 

import torch 

from flyai.utilsimport remote_helper


path = remote_helper.get_remote_data('https://www.flyai.com/m/pre_efficientnetv2-m.pth')   

self.net = efficientnetv2_m(num_classes) 

self.net.to(device) 

weights_dict = torch.load(path, map_location=device) 

load_weights_dict = {k: v for k, v in weights_dict.items() if self.net.state_dict()[k].numel() == v.numel()}

self.net.load_state_dict(load_weights_dict, strict=False)