basil mohamed
basil mohamed

Reputation: 47

is there any way to deploy custom ML models in flutter?

I am trying to create a flutter app using the ML model from the below link.

https://www.tensorflow.org/lite/models/style_transfer/overview

Upvotes: 0

Views: 6278

Answers (4)

Muhammad Rizwan
Muhammad Rizwan

Reputation: 177

I have used this style_transfer model in flutter app before. unfortunately, I've lost that code (I did not use git). But I can give suggestions on that.

For using this custom model you will have to use https://pub.dev/packages/tflite_flutter.

The trick here is you will have to see model's input shape (image_shape=(384,384,3), style_shape=(256,256,3) and output size (shape=(384,384,3) and also shape of bottleneck). You can resize image using https://pub.dev/packages/image.

with these two, you are good to go. Sorry for bad english and I know I am too much late but maybe someone else will find it useful.

Happy coding!

Edited: So I have found the code. I stored a copy of it in my google drive. I have uploaded it on github https://github.com/Rizwan2613/style-transfer. Please do read Readme file. Thanks

Upvotes: 4

yyoon
yyoon

Reputation: 3855

There is a recently published flutter plugin for integrating an arbitrary TFLite model.

https://pub.dev/packages/tflite_flutter

Please see the README of the pub package and see how you can bundle the .tflite models and how to load / run them in flutter.

There is a blog post on how to use this flutter plugin, but it uses a different model (text classification) as an example.

https://medium.com/@am15hg/text-classification-using-tensorflow-lite-plugin-for-flutter-3b92f6655982

Upvotes: 1

Farmaker
Farmaker

Reputation: 2790

I haven't played with Flutter but there are some promising articles article 1 article 2 article 3 that gives code snippets to insert tensorflow lite dependencies, to make assets folder and load models. You can check them and I hope you get a first idea how to proceed. Style transfer is a medium to hard coding project though. I suggest to start from simpler tasks as classification problems.

Happy coding

Upvotes: 3

Omer Gamliel
Omer Gamliel

Reputation: 506

You can upload custom tensorwflow model to firebase ML KIT (custom tab), and integrate with firebase API in your flutter project.

Upvotes: 1

Related Questions