Skip to content

Latest commit

 

History

History

res2net

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

res2net

Input --> Output

Convert

pt --> torchscript --> pnnx --> ncnn

import os
import torch
import timm
# 0. pt模型下载及初始化
model = timm.create_model('res2net101_26w_4s', pretrained=True)
model.eval()

x = torch.randn(1, 3, 224, 224)  # 224起步
# # 1. pt --> torchscript
traced_script_module = torch.jit.trace(model, x, strict=False)
traced_script_module.save("ts.pt")

# # 2. ts --> pnnx --> ncnn
os.system("pnnx ts.pt inputshape=[1,3,224,224]")

Example project

Reference