khanhlvg / tflitedemo Goto Github PK
View Code? Open in Web Editor NEWSample app to showcase several TensorFlow Lite models
License: Apache License 2.0
Sample app to showcase several TensorFlow Lite models
License: Apache License 2.0
Hi, good work can you try this model https://github.com/pbaylies/stylegan-encoder
@khanhlvg Dear Khanh Le Viet,
I found your workshop for Build and deploy custom object detection model with TensorFlow Lite https://developers.google.com/codelabs/tflite-object-detection-android#0 I tested on different models that you mentioned https://tfhub.dev/tensorflow/collections/lite/task-library/object-detector/1 and it worked fine.
I have my dataset with different 4 labels (not like in COCO) which I trained with yolov5s model and then I converted my pt model to tflite format by using python export.py --weights yolov5s.pt --include tflite
https://github.com/ultralytics/yolov5/blob/master/export.py
I tested the tflite with detect.py script and it works fine on inference mode. It means there is no issue with the converted file.
Then I put my model in assets folder, I change the name of model in MainActivity.kt file inside of val detector = ObjectDetector.createFromFileAndOptions and app goes down when I try to do a detection. In attached you can find a report bug description while I was trying the app with my converted model. I was thinking maybe the error is due to different labels I have, normally there should be place where I can declare txt file with my labels, but I could not find in your MainActivity.kt.
This is my converted model in case if you would like to test on Android Studio, it detects delivery packages and pallets.
https://github.com/HripsimeS/Projects/blob/main/model.tflite
Can you help me to figure our what is the issue and why it does not work with my model. Look forward to hearing from you!
Dear Khanh,
Thanks for sharing your sample code! The android and colab code are very useful!
My question is related to the configuration to other segmentation models.
More specifically, I’d like to test with the deeplabv3 model on cityscapes data and have identified the following model on TF model Zoo mobilenetv3_small_cityscapes_trainfine
.
To convert the model to TF lite, I’ve used the following command:
tflite_convert \
--output_file=./deeplabv3_city.tflite \
--graph_def_file=./frozen_inference_graph.pb \
--input_arrays=ImageTensor \
--output_arrays=ExpandDims_1 \
--input_shapes=1,257,257,3 \
--inference_input_type=QUANTIZED_UINT8 \
--inference_type=FLOAT \
--mean_values=128 \
--std_dev_values=127
My question is two-fold:
When testing the converted model with your Colab, I get a ‘set tensor error’ with the following message Got tensor of type 0 but expected type 3 for input 3
regardless of the data type that I input (uint8, float32, int32, etc.) Do you have an intuition in terms of where the error could lie?
The goal would be to run the model on android with your sample code on segmentation. Do you have any advice on how the sample code should to be modified in order to run a different model like this?
Thank you for your time.
Sincerely,
Johan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.