# load net
num_classes = len(labelmap) + 1 # +1 for background
net = build_refinedet('test', int(args.input_size), num_classes) # initialize SSD
net.load_state_dict(torch.load(args.trained_model,map_location='cuda:0')) # model = torch.load(model_path, map_location='cuda:0')
net.eval()
print('Finished loading model!')
# 向模型中输入数据以得到模型参数
example = torch.rand(1,3,320,320).cuda()
traced_script_module = torch.jit.trace(net,example)
# 保存模型
traced_script_module.save("torch_script_eval.pt")
i want to make the refinedet model transform to libtorch,but it have a error about “RuntimeError: Attempted to trace Detect_RefineDet, but tracing of legacy functions is not supported”
Thank you for helping me!