onnx推理时报错:
RuntimeError: Input must be a list of dictionaries or a single numpy array for input 'images'
找到原因啦,onnx输入的字典对应的值应该是numpy类型, 我的代码中是tensor类型,
torch.Size([1, 3, 320, 320]) {
'images': tensor([[[[-0.9451, -0.9529, -0.9373, ..., -0.1059, -0.1059, -0.1059],
[-0.9373, -0.9373, -0.9294, ..., -0.1059, -0.1059, -0.1059],
[-0.9451, -0.9294, -0.9373, ..., -0.1059, -0.1059, -0.1059],
输入数据
self.face_detect_img = torch.from_numpy(padded_img).unsqueeze(0)
修改为
self.face_detect_img = padded_img[np.newaxis, :]
即可,问题解决