Skip to content
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

An Issue when loading SlimNet model on Mobile GPU #44

Open
rose-jinyang opened this issue Jan 27, 2021 · 3 comments
Open

An Issue when loading SlimNet model on Mobile GPU #44

rose-jinyang opened this issue Jan 27, 2021 · 3 comments

Comments

@rose-jinyang
Copy link

Hello
How are you?
Thanks for contributing to this project.
I trained a model with SlimNet architecture on my dataset and got a TFlite model.
This TFlite model works well on the CPU.
I am going to use this TFLite model on mobile GPU.
When loading this model on Android GPU, I got the following issue.

Caused by: java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors.

So I searched for any solution but I did NOT find a correct solution yet.
tensorflow/tensorflow#38036

Could u help me?

@anilsathyan7
Copy link
Owner

Can you try the following code to fix the size of the model during conversion

# Fix the model input batch size to 1
input_name = float_model.input_names[0]
index = float_model.input_names.index(input_name)
float_model.inputs[index].set_shape([1, 512, 512, 3])


converter = tf.lite.TFLiteConverter.from_keras_model(float_model)
tflite_model = converter.convert()
open("slimnet_float.tflite", "wb").write(tflite_model)

@rose-jinyang
Copy link
Author

But I met the following issue.

image

Can u run the slimnet model on Phone GPU?

@anilsathyan7
Copy link
Owner

I tested it with mediapipe api in android(segmentation) and it worked at that time. I believe it uses the old gpu-delegate with OpenGL instead of OpenCL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants