-
Notifications
You must be signed in to change notification settings - Fork 43
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
"index out of bound exception" while reading the width and height from the input tensor #30
Comments
Can you provide the model and test code to reproduce the issue? As per following ticket: |
Hi team,
Below are the attached sample program used for running tflite model. When I
am trying with float model its working fine. I tried the quantised model in
mac but then also the same error message. detectq.tflite is my quantised
model.
Thanks,
Shubham Pandey
Vision Engineer
Surewash Ltd.
FLoat_Model_Program_Working.zip
<https://drive.google.com/a/surewash.com/file/d/1cntYYjxb4JD1P2ItW48gfc_UrpZK09aY/view?usp=drive_web>
Quantised_Model_Not_Working.zip
<https://drive.google.com/a/surewash.com/file/d/15qD9li7Ed6Us6PFt_lmdJ6kq47WdRZrI/view?usp=drive_web>
…On Thu, 6 Feb 2020 at 21:22, Emgu CV ***@***.***> wrote:
Can you provide the model and test code to reproduce the issue?
As per following ticket:
tensorflow/tensorflow#22532
<tensorflow/tensorflow#22532>
tflite on Windows do not implement quantization and is not able to load
quantized model. I believe Quantized model is only supported for macOS,
Linux, Android and iOS. If you are using TF Lite with Unity on Windows
editor you may not be able to load a quantized model. Try to develop on
with Unity on MacOS instead.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#30?email_source=notifications&email_token=ANUHGW3KU3HJXVE7TFEIBATRBR5THA5CNFSM4KQOXPHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELA2R4Y#issuecomment-583117043>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANUHGW4BLGSRGOLDYYBC72DRBR5THANCNFSM4KQOXPHA>
.
|
@ctheodorak Can you be more specific? This is similar to asking: I used the library and other components to build a product, but my product doesn't work. Why is it happening? ... we would not be able to provide a meaning answer. If you find a bug in a function, please point out the specific name of the function, provide the given input, what the function is returning right now and the expected output. We will be able to take a look. If you have a working tflite code in python, along with the model and demo images, we can provide consulting service to convert python code to C# for a fee. |
The model i gave you https://github.com/ctheodorak/DemoTflite/tree/master/samples/New%20folder |
@ShubhamSureWash
and got the output:
I don't have the "index out of bound exception" reported in your original post. |
It works fine with model provided with google sample but when I use it with my custom model it gives exception stated above. My model works fine in Sample project provided by TensorFlow in Android and iOS but it fails when tried to integrate with EMGU. In the above comment I have attached the sample code which I am using and also the my model. Emgu is working fine with my float model but its failing with my quantised model. Dose EMGU Unity plugin 1.13 supports TensorFlow 1.14 ? I have trained my model in TensorFlow 1.14. |
@ShubhamSureWash |
How i can make my scene run faster? |
@ShubhamSureWash Can you use the code I pasted above on your custom model? Paste the output here so we can see. I suspect your model's input tensor's only have a single dimension. Accessing the second or 3rd dimension will results in exception. |
@ctheodorak Profile your code, check how much time it is spent on preparing data for tflite and how much time is spend on inference. If inference cost the most time. Look up on tensorflow or tflite on how to speed up your model. |
I train the mobilenet_v2 quantized and i used your code and not parser = argparse.ArgumentParser() args = parser.parse_args() MODEL_NAME = args.modeldir IM_NAME = args.image if (IM_NAME and IM_DIR): if (not IM_NAME and not IM_DIR): pkg = importlib.util.find_spec('tensorflow') if use_TPU: CWD_PATH = os.getcwd() if IM_DIR: elif IM_NAME: PATH_TO_CKPT = os.path.join(CWD_PATH,MODEL_NAME,GRAPH_NAME) PATH_TO_LABELS = os.path.join(CWD_PATH,MODEL_NAME,LABELMAP_NAME) with open(PATH_TO_LABELS, 'r') as f: if labels[0] == '???': if use_TPU: interpreter.allocate_tensors() input_details = interpreter.get_input_details() floating_model = (input_details[0]['dtype'] == np.float32) input_mean = 127.5 for image_path in images:
them to be within image using max() and min()
cv2.destroyAllWindows()` |
Hi, I am trying to integrate the custom quantized Mobilenet SSD v2 model to unity. I am getting an "index out of bound exception" while reading the width and height from the input tensor using the following command.
int height = CocoSsdMobilenet._inputTensor.Dims[1];
I checked my model and it appears to be fine. Below is the screenshot of it.
if I am commenting these lines and initializing height and width as 300, on clicking on the play button unity engine is crashing with giving any exception. Please suggest.
Our quantized TFLite model works well in the sample project provided in Android Studio by TensorFlow but its giving exception here.
The text was updated successfully, but these errors were encountered: