-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deformable DETR] RuntimeError: tensorflow/lite/kernels/gather.cc:132 indices_has_only_positive_elements was not true.gather index out of boundsNode number 5885 (GATHER) failed to invoke. #275
Comments
First, I know that there is a bug in the [GridSample] GridSample operation gives different outputs between onnx and tflite models #274 The model is too large and it will take time to fix the bugs. Once we break ONNX down into smaller components, it may be faster to investigate. (You don't have to do anything in particular, but it is going to take me a very long time to do my research.) |
Hi, @PINTO0309. I sincerely appreciate your assistance. Thanks to your guidance, I was able to successfully match the output of ONNX and TFLite. However, I am currently facing an error while performing inference using the TFLite model. the error that I encountered: Inference script: TFLITE_PATH = 'one_input_simple_float16.tflite'
interpreter = tf.lite.Interpreter(model_path=TFLITE_PATH)
interpreter.allocate_tensors() ## This is the point where the error occurs. ##
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
input = torch.randn(input_details[0]['shape'].tolist())
interpreter.set_tensor(
input_details[0]['index'],
input
)
interpreter.invoke() Could you please advise me on how to solve this issue? I apologize for bothering you. |
I am pleased to inform you that I have successfully completed the conversion process. Your assistance has been invaluable to me, and I cannot thank you enough for your help. Thank you so much. |
Hi @PINTO0309! I could see that all outputs matched when I used How can I solve this problem? Below is my inference scripts: import torch
import numpy as np
import tensorflow as tf
TFLITE_PATH = '/data/ojw/_/one_input_simple_float32.tflite'
# Load the TFLite model and allocate tensors.
interpreter = tf.lite.Interpreter(model_path=TFLITE_PATH)
interpreter.allocate_tensors()
# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
input = my_input
interpreter.set_tensor(
input_details[0]['index'],
np.transpose(input.cpu(), (0,2,3,1)).numpy()
)
interpreter.invoke()
print(
'max_score : ', torch.Tensor(interpreter.get_tensor(output_details[0]['index'])).cuda().sigmoid().max()
)
# postprocess
tmp = []
for i in range(12):
tmp.append(torch.Tensor(interpreter.get_tensor(output_details[i]['index'])).cuda()) I'm so sorry to bothring you. |
I would like to see a separate issue for a topic that differs from the original issue. Mixing multiple topics in a closed issue is confusing to other engineers. |
Issue Type
Others
onnx2tf version number
1.8.3
onnx version number
1.13.1
tensorflow version number
2.12.0rc0
Download URL for ONNX
https://drive.google.com/file/d/1vPjV012QsZXt72VySjXG4hbeEnzdUHi7/view?usp=sharing
Parameter Replacement JSON
replace.json
Description
HI, @PINTO0309. I am a researcher at a Korean IT company, and I have been working on converting Deformable DETR into a TFLite model for product development purposes. After many attempts, I was finally able to generate the TFLite model. Unfortunately, I have run into an error while trying to perform inference with the model.
For this model, the following fails:
problem
1-1) the error I get
I believe that the error may have originated from
tensorflow/lite/kernels/gather.cc
, as it seems to occur when the index value of the gather op with number 5885 is below 0.1-2) tensorflow/lite/kernels/gather.cc
1-3) op name
1-4) log
Upon examining the log, it appears that only the shape parameter of the
reshape op
has an index value lower than zero.In reshape op
1-5) Attempt
I am attempting the following method, but I am unable to resolve the error.
1-6) Script
I'm experiencing some trouble with an error that has been persisting since March. I was wondering if you could kindly assist me with this issue? I would be very grateful for your help in resolving this matter.
The text was updated successfully, but these errors were encountered: