Open zhang0557kui opened 2 years ago
Hi @zhang0557kui thank you for reporting this issue. Could you help to attach the model that triggers the error? It seems to me that the model raised our semantic assumption somehow.
Hi @zhang0557kui thank you for reporting this issue. Could you help to attach the model that triggers the error? It seems to me that the model raised our semantic assumption somehow.
Same issue when trying to convert palm_detection_full.
It maybe a PReLu related issue https://github.com/NVIDIA/TensorRT/issues/310
same issue when converting this model: https://github.com/google/mediapipe/tree/master/mediapipe/modules/face_landmark/face_landmark.tflite
I solved this probelm temporary by changing this two files in your lib code:
# tflite2onnx/tensor.py
...
def transform(self):
assert(self.status.parsed)
assert(self.layout is not None)
if self.isInitializer:
data = self.data.reshape(self.shape)
self.shape = self.layout.transform(self.shape)
if(len(self.shape)<4):
self.data = data.transpose([2,0,1])
else:
self.data = data.transpose(self.layout.perm)
else:
self.shape = self.layout.transform(self.shape)
...
and
# tflite2onnx/layout.py
...
def transform(input, ilayout: str, olayout: str):
if (ilayout == olayout):
return input
perm = getPerm(ilayout, olayout)
if(len(input) < 4):
# print(input)
transfrom_axis = [input[2], input[0], input[1]]
# transfrom_axis = [input[0], input[2], input[1]]
else:
transfrom_axis = [input[p] for p in perm]
return transfrom_axis
...
By the way, I have another problem when converting another model: https://github.com/google/mediapipe/tree/master/mediapipe/modules/face_landmark/face_landmark_with_attention.tflite cuz there's some "CUSTOM" ops, such as No.192, No.193. Is there any solutions to convert this tflite model?
thx.
@crazySyaoran Glad to hear that you resolved this issue!
I was assuming the two inputs of PReLU have the same rank, but they should be broadcastable. I think we can share the Binary.fakeBroadcast()
with PReLU. Do you have time to try if the fakeBroadcast
works for PReLU?
For custom ops, unfortunality, tflite2onnx
cannot convert such ops as of now. But it's encouraged to introduce a design for custome operators and bridge to ONNX. As first step, we can take the custom op as blackbox - we don't care what the semantic of it, but only track the tensors of it.
File "D:\anaconda3\lib\site-packages\tflite2onnx\layout.py", line 27, in transform output = transform(input, self.source, self.target) File "D:\anaconda3\lib\site-packages\tflite2onnx\layout.py", line 16, in transform transfrom_axis = [input[p] for p in perm] File "D:\anaconda3\lib\site-packages\tflite2onnx\layout.py", line 16, in
transfrom_axis = [input[p] for p in perm]
IndexError: list index out of range
python-BaseException