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

Custom tflite model doesn't detect anything #226

Open
fransay opened this issue Jun 19, 2024 · 20 comments
Open

Custom tflite model doesn't detect anything #226

fransay opened this issue Jun 19, 2024 · 20 comments

Comments

@fransay
Copy link

fransay commented Jun 19, 2024

Hi peeps,

I have been trying to train a custom model for object detection using this package, i.e flutter_tflite, but have found no success. custom models when ingested into the example app does not detect anything. Below are the approaches I have taken so far:

  1. Training with tflite_model_maker
    model_spec = 'efficientDET_lite0'

  2. Tensorflow 2 Object Detection API
    model_spec = 'ssd_mobilenet_v1/v2' && 'ssd_resnet50'

  3. Ultrayltics
    model_spec = yolo v8, v7, v5 -> output to a tflite.

None of the above has led to success, I am not able to perform detection on my honor x6a using the example app found here:https://github.com/tensorflow/flutter-tflite/tree/main/example/live_object_detection_ssd_mobilenet

Any help on instructions to train a custom working model for live detection use cases will be meet with a ton of gratitude and appreciation. Looking forward for help.
Thanks.

@GustavoSantiago113
Copy link

On the yolov8 model I have used the flutter vision package: https://pub.dev/packages/flutter_vision. I hope it works for you too

@fransay
Copy link
Author

fransay commented Jun 26, 2024

@GustavoSantiago113 , thank you for your reply! Flutter vision is definitely a very great package by all standards, only limitation is the IOS support is not yet ready. Let's hope Yuri or any other contributor has sometime to enable support in that direction. It stand tall among the best plugins for object detection in flutter.
Again thank you very much for the suggestion.

@darwinOne
Copy link

Hi @fransay
Did you find the solution?
I had the same problem: not detecting anything with the yolov8 custom model.

@einsitang
Copy link

einsitang commented Aug 3, 2024

@fransay @darwinOne hello
same problem too , I got two yolov8 model(tflite format export) use on tflite_flutter , one is ok , by another is alway not detect , so I very sure the preprocess and postprocess function is correct, and I have checked that both models perform well in tensorflow python.

so did you find the solution or reason of the problem

@fransay
Copy link
Author

fransay commented Aug 3, 2024

@einsitang @darwinOne , ultralytics is promising to deliver a stable tool for the flutter ecosystem. https://github.com/ultralytics/yolo-flutter-app. It is still a work in progress, but much better and does support yolo model builds.
You can also see one from a bright korean dev, does support both pytorch and coreml. Here is it: https://github.com/spring98/flutter-yolo-realtime-plugin
Hope these resources help.

@einsitang
Copy link

Hope these resources help.

thank you, I try yolo-flutter-app before , but the output result has a big deviation, maybe I used the wrong way, so I need to adjust myself, that is why I write my own logic processing. In addition, I hope that if I change or add other models in the future, I can handle it myself, rather than just using yolo

@fransay
Copy link
Author

fransay commented Aug 3, 2024

@einsitang, you mean deviation of predictions from truth ?

@einsitang
Copy link

@einsitang, you mean deviation of predictions from truth ?

yes , I’am very sure the preprocess and postprocess is correct , because one model is output detection is right,but another is empty(they all output detections on python platform with same image)

@fransay
Copy link
Author

fransay commented Aug 3, 2024

It is an interesting issue you found, not sure if I've seen any issue similar to what you are encountering. For me, I found out that my inference speed on my honor x6a https://www.gsmarena.com/honor_x6a-12442.php, was quite low. Definitely there is a lot of work to be done on improving the package. I am yet to have a great experience with any of the machine learning packages, I have come across.
I don't know if I have enough time, I'd love to write my own package from scratch in Kotlin, and call utilities from flutter.

@einsitang
Copy link

I have been trying to train a custom model for object detection using this package, i.e flutter_tflite, but have found no success. custom models when ingested into the example app does not detect anything. Below are the approaches I have taken so far

so , your model detect work now ? seem your problem is about inference speed , that is performance problem, For performance optimization, the solution I can find so far is to quantify the model.

@fransay
Copy link
Author

fransay commented Aug 4, 2024

Custom detection doesn't work with flutter-tflite. Inference is also an add-on issue, ready to be tackled.

@fransay
Copy link
Author

fransay commented Aug 4, 2024

What techniques of quantification do you use ?

@einsitang
Copy link

I haven't done the quantification work yet , because the model can't detect and I have no idea how to fix

@einsitang
Copy link

I just solved the second model detect problem , if your problem is about yolov8 model , you can show the code , maybe I can help you

@fransay
Copy link
Author

fransay commented Aug 5, 2024

@einsitang I sent you a private mail ✉️ , can we continue from there ?

@einsitang
Copy link

@einsitang I sent you a private mail ✉️ , can we continue from there ?

You can email me, but I am not sure that I can solve the problem you encounter, only try

@fransay
Copy link
Author

fransay commented Aug 5, 2024

Sure, no problem!

@einsitang
Copy link

ok,you can find the email in my profile

@fransay
Copy link
Author

fransay commented Aug 5, 2024

ok,you can find the email in my profile

Sent. Thank you.
Try and check spam box, since I did send one yesterday, but seems you didn't get to see it.

@einsitang
Copy link

ok,you can find the email in my profile

Sent. Thank you. Try and check spam box, since I did send one yesterday, but seems you didn't get to see it.

I just found out you emailed me, and did found in spam box 😂

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

4 participants