test_image = 'images/hand.jpg' oriImg = cv2.imread(test_image) # B,G,R order w=body_estimation(oriImg)#直接存w0就行。 np.save('input.npy',oriImg) np.save('output.npy',w[0]) 记录pth的输入和输出以numpy形式存储。 import mindspore import numpy as np # 根据实际情况替换以下类路径 #from customized.path.to.mindspore.model import MindSporeNetwork import mindspore import numpy as np from model1 import * import numpy param_dict = mindspore.load_checkpoint('model1.ckpt') input_data = np.load('input.npy') output_benchmark = np.load('output1.npy') net=MindSporeModel() from mindspore import load_param_into_net load_param_into_net(net, param_dict) reshape = mindspore.ops.Reshape() input=mindspore.Tensor(input_data,mindspore.float32) candidate, subset = net(input) 用np.allclose判断是否完全相同。
标签:load,模型,pytorch,input,np,import,net,mindspore From: https://www.cnblogs.com/hahaah/p/16633169.html