我正在使用Pytorch2Keras转换签名验证 (https://github.com/luizgh/sigver)可以在Pytorch中使用以下代码在Keras中使用
from pytorch2keras.converter import pytorch_to_keras
state_dict, _, _ = torch.load('models/signet_f_lambda_0.95.pth')
base_model = SigNet().to(device).eval()
input_np = np.random.uniform(0, 1, (1,1,150,220))
input_var = Variable(torch.FloatTensor(input_np))
k_model = pytorch_to_keras(base_model, input_var, [(1, 150, 220)], verbose=True)
我遇到以下错误
TypeError Traceback (most recent call last)
----> 6 k_model = pytorch_to_keras(base_model, input_var, [(1, 150, 220)], verbose=True)
/pytorch2keras/converter.py in pytorch_to_keras(model, args, input_shapes, change_ordering, verbose, name_policy)
71 k_model = onnx_to_keras(onnx_model=onnx_model, input_names=input_names,
72 input_shapes=input_shapes, name_policy=name_policy,
---> 73 verbose=verbose, change_ordering=change_ordering)
74
75 return k_model
/onnx2keras/converter.py in onnx_to_keras(onnx_model, input_names, input_shapes, name_policy, verbose, change_ordering)
144 node_params,
145 layers,
--> 146 node_name
147 )
148
/onnx2keras/reshape_layers.py in convert_unsqueeze(node, params, layers, node_name)
151 layers[node_name] = np.expand_dims(layers[node.input[0]], params['axes'][0])
152 else:
--> 153 if len(params['axes'][0]) != 0:
154 raise AttributeError('Axes is not 0. Cannot unsqueeze')
155
TypeError: object of type 'int' has no len()
帮我解决问题