Open RubensZimbres opened 1 month ago
I solved the problem:
First, create a cors_file.json:
[
{
"origin": ["https://your-website.com"],
"method": ["GET", "POST"],
"responseHeader": ["Content-Type", "Authorization"],
"maxAgeSeconds": 86400
}
]
Then:
gcloud storage buckets update gs://your-bucket-with-.tflite --cors-file=cors_file.json
However, my inference time is 5 seconds, much more than the milliseconds of the default model, EfficientNet.
How can I speed up inference? It looks like it's an incompatibility version between tflite-support and Tensorflow, that does not optimize the saved tflite model.
Hi @tyrmullen,
Do you have any suggestions for speeding up inference using the customized model instead of the default one in our Web Task API? Any advice would be greatly appreciated.
Thank you!!
@kuaashish I noticed that if you quantize the tflite model, a problem in signature shows up, then inference time goes to 2 seconds. If you do not quantize the model, inference time is 170 milliseconds.
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
No
OS Platform and Distribution
Ubuntu 22.04
Python Version
3.10
MediaPipe Model Maker version
I didn't use Modelmaker, I used a PyTorch Resnet model converted with ai-edge-torch
Task name (e.g. Image classification, Gesture recognition etc.)
Image classification
Describe the actual behavior
The tutorial at codepen works for the tflite model Efficientnet, but not the model customized with ai-edge-torch
Describe the expected behaviour
As the HTML code works for the supported model tflite Efficientnet, it was supposed to work also with the customized tflite model, given that the customized model successfully loads at the MediaPipe Studio web interface at https://mediapipe-studio.webapps.google.com/home, but not in my HTML page.
Standalone code/steps you may have used to try to get what you need
The VSCode debugger shows an error.
Chrome code inspection does show these errors:
Here's my code: