Deploy Ml model on android | android project java | android studio | cat dog app

  Рет қаралды 44,724

ProgrammingHut

ProgrammingHut

Күн бұрын

this video is all about deploying your machine learning / deep learning model on the Android app using Java language.
by using this step by step guide you can deploy pretty much any deep learning model.
first step is to convert you are model to TFlite model.
second is to create basic gui.
third is to import the model and create backend functionality.
make sure you have latest version of Android studio installed.
if you want to follow along with this part you may use this model.
drive.google.c...
all the code is here
github.com/Paw...
THANKS FOR WATCHING...
LIKE + SHARE + SUBSCRIBE = support :)
contact me : 📞
facebook :
/ proogramminghub
twitter 🐦 :
/ programming_hut
github :
github.com/Paw...
discord :
/ discord
linkedin :
/ programminghut
youtube ❤️:
/ programminghutofficial
keys:
deploy ml model on Android,deep learning model on Android,machine learning Android app,deep learning Android app,how to deploy machine learning model,deployment of ml,machine learning model on Android

Пікірлер: 94
@aguelejoseph5753
@aguelejoseph5753 Жыл бұрын
YOU DID A REALLY REALLY GREAT JOB. Although i am doing something different and more complex but you have given me the headstart that I need. Thank you soo much.
@yogietrypambudi6187
@yogietrypambudi6187 3 жыл бұрын
wow what a good idea to using tensorflow for deep learning app android. but i"ve question when you click predict show the number accuracy data. it"s accurate?
@programming_hut
@programming_hut 3 жыл бұрын
I don't really understood what you meant. I think you want to show the confidence of prediction right ? btw thanks for your compliments ...
@greenheart3880
@greenheart3880 3 жыл бұрын
explained it in really easy way THANKS 👍
@paragbharadia2895
@paragbharadia2895 2 жыл бұрын
Sir, at 0:46 which software/ide did you open?
@programming_hut
@programming_hut 2 жыл бұрын
It’s sublime
@ronixbhaskar8263
@ronixbhaskar8263 2 жыл бұрын
Which software have been used ??
@Sweety-rx8zq
@Sweety-rx8zq 2 жыл бұрын
Why extension is as .h5? Any help would be appreciated
@egamomusu
@egamomusu Жыл бұрын
Thank you..however the trained model is not available anymore in the given google drive link at the description section. Could you please upload the model again ? Thank you
@matovushafik2372
@matovushafik2372 3 жыл бұрын
why is it that my app crashes whenever i click the predict button, anyways, great work, thank you
@jeffr_ac
@jeffr_ac Жыл бұрын
Did It work?
@lavanyal9418
@lavanyal9418 Жыл бұрын
I also have same problem.Did you resolve your problem?If yes please let me know the solution
@andrearomeroramos6586
@andrearomeroramos6586 Жыл бұрын
Hello!!! Could you pass me the code of your model please, the drive link does not work
@tauseefrehman2
@tauseefrehman2 2 жыл бұрын
Is this work for every kind of ML model?
@shivamdubey4783
@shivamdubey4783 2 жыл бұрын
sir do we need to learn java for this coz i only know python and tensorflow
@programming_hut
@programming_hut 2 жыл бұрын
Yes basic understanding of java is required
@swathinagiri3003
@swathinagiri3003 9 ай бұрын
I have used same program but instead of getting output the application is automatically closing
@arushsingh5489
@arushsingh5489 2 жыл бұрын
Hey! How do I print my predicted label if I don't want to see numerical predictions?
@ismail_..
@ismail_.. 2 жыл бұрын
Hello sir,Can I use Kotlin language instead of java in tensorflow lite projects?
@programming_hut
@programming_hut 2 жыл бұрын
Yes
@__dekana__
@__dekana__ 11 ай бұрын
You are the best!!!!
@gloriamasengo
@gloriamasengo Жыл бұрын
Hi can you show me how to display 5 classes not 2, the model is only showing me for 2
@Sara-fp1zw
@Sara-fp1zw 2 жыл бұрын
that was nice thankyou!!!
@m.abdullahkamran8805
@m.abdullahkamran8805 2 жыл бұрын
Hey Sir I am getting wrong output from tflite model when I converted it from keras model. Although output is perfectly fine when I use the same input in keras model.
@AtticEdits
@AtticEdits 6 ай бұрын
Me too😢
@fawniaavissa9711
@fawniaavissa9711 Жыл бұрын
thankyou 8:35
@kirtipatidar261
@kirtipatidar261 2 жыл бұрын
hey can you tell me which linux-distro do you use
@programming_hut
@programming_hut 2 жыл бұрын
Linux mint
@localbus7008
@localbus7008 3 жыл бұрын
Sir i cant find modeltfLite file in your github
@LAJianoran
@LAJianoran Жыл бұрын
it shuts off when I use my model
@localbus7008
@localbus7008 3 жыл бұрын
I can't understand the folders hierarchy..
@amirayasmine8490
@amirayasmine8490 3 жыл бұрын
thank you so much that was very helpful
@programming_hut
@programming_hut 3 жыл бұрын
glad you liked it
@seymatezcan4058
@seymatezcan4058 3 жыл бұрын
Hello thank you for this video I have a question: How can I create model.tflite file on Jupyter notebook?
@rushidesai2836
@rushidesai2836 3 жыл бұрын
Use Tensorflow with Python
@programming_hut
@programming_hut 3 жыл бұрын
try this kzbin.info/www/bejne/fZaqnXqHbZWgkMk
@rhk1991
@rhk1991 3 жыл бұрын
thank you kind sir, i really need this one.
@Jerrod2444
@Jerrod2444 3 жыл бұрын
hi sir, how to get my output result if my result is String ?
@nishilraiyarela5141
@nishilraiyarela5141 2 жыл бұрын
Thanks it works
@islembenamar1355
@islembenamar1355 2 жыл бұрын
how i can see the label for images ??
@muhammadtalha2493
@muhammadtalha2493 3 жыл бұрын
hello sir, when i click the predict button application automatically close will u help ??
@programming_hut
@programming_hut 3 жыл бұрын
what are inputs and outputs, if its image then what is input image size , if possible can you share code
@muhammadtalha2493
@muhammadtalha2493 3 жыл бұрын
@@programming_hut i also train a model on googlecolab with cnn and then convert it in to tflite like the way You told and it happens the same when u clicked the predict button application shytdown
@muhammadtalha2493
@muhammadtalha2493 3 жыл бұрын
image size is (200,200,3)
@muhammadtalha2493
@muhammadtalha2493 3 жыл бұрын
@@programming_hut from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.preprocessing import image from tensorflow.keras.optimizers import RMSprop import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from keras.models import Sequential from tensorflow.keras import layers from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Dropout #from keras.utils import to_categorical import numpy as np import os from keras import backend as K import cv2 from google.colab import drive drive.mount('/content/gdrive') cv2.imread("/content/gdrive/MyDrive/checkTest/training/diseased/0a01cc10-3892-4311-9c48-0ac6ab3c7c43___RS_GLSp 9352_270deg.JPG").shape train = ImageDataGenerator(rescale = 1/255) validation = ImageDataGenerator(rescale = 1/255) train_dataset = train.flow_from_directory( '/content/gdrive/MyDrive/checkTest/training', target_size=(200, 200), batch_size=3, class_mode = 'binary') validation_dataset = validation.flow_from_directory( '/content/gdrive/MyDrive/checkTest/validation', target_size=(200, 200), batch_size=3, class_mode = 'binary') train_dataset.class_indices model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(16,(3,3), activation='relu', input_shape = (200,200,3)), tf.keras.layers.MaxPool2D(2,2), # tf.keras.layers.Conv2D(32, (3,3), activation = 'relu'), tf.keras.layers.MaxPool2D(2,2), # tf.keras.layers.Conv2D(64, (3,3), activation = 'relu'), tf.keras.layers.MaxPool2D(2,2), # tf.keras.layers.Flatten(), # tf.keras.layers.Dense(512, activation = 'relu'), # tf.keras.layers.Dense(1, activation = 'sigmoid') ]) model.compile(loss = 'binary_crossentropy', optimizer = RMSprop(learning_rate = 0.001), metrics = ['accuracy']) model_fit = model.fit(train_dataset, steps_per_epoch = 3, epochs = 50, validation_data = validation_dataset) dir_path = '/content/gdrive/MyDrive/checkTest/testing' for i in os.listdir(dir_path): img = image.load_img(dir_path+'//'+i, target_size= (200,200)) plt.imshow(img) plt.show() X = image.img_to_array(img) X = np.expand_dims(X,axis = 0) images = np.vstack([X]) val = model.predict(images) if val == 0: print ("The leaf has disease") else: print ("The leaf is Healthy")
@programming_hut
@programming_hut 3 жыл бұрын
so did you resized your bitmap accordingly in android studio
@codewithchando971
@codewithchando971 3 жыл бұрын
How I can Get the Confidence Value of The Prediction? Extra Code that's I need to add?
@programming_hut
@programming_hut 3 жыл бұрын
the outputFeature variable contains the confidence of each class
@m.abdullahkamran8805
@m.abdullahkamran8805 2 жыл бұрын
Sir how to normalize bitmap. My model takes pixel values from 0-1 but in android studio when i save image in bitmap it stores values from 0-255 in bitmap. Kindly tell how to covert bitmap values from 0-1.
@Alex-bx6jf
@Alex-bx6jf 2 жыл бұрын
train the model without normalization or you can add pre-processing layers to the model itself during training
@m.abdullahkamran8805
@m.abdullahkamran8805 2 жыл бұрын
@@Alex-bx6jf It is reducing overall accuracy of the model.
@sarasaleh6751
@sarasaleh6751 3 жыл бұрын
HI ,thank u for the this great video , but i can't upload my model it is bigger than 200 MB , is there is another way of upload or I should paste my model in assets .? thanks
@programming_hut
@programming_hut 3 жыл бұрын
you can use api methods btw what your model do
@sarasaleh6751
@sarasaleh6751 3 жыл бұрын
@@programming_hut thank u , I don’t know how to use api methods .. my model it to recognize images type .. from an image
@programming_hut
@programming_hut 3 жыл бұрын
may be this could help converting ml model to api : kzbin.info/www/bejne/bYXIaKWug5qeaMk how to make api android app : kzbin.info/www/bejne/n6GropyjbM2in9E
@nitesharu1269
@nitesharu1269 3 жыл бұрын
can a pkl file be used in android studio
@antapratama4735
@antapratama4735 3 жыл бұрын
How to see name output with labels.txt and %predict?
@safalghalegurung425
@safalghalegurung425 3 жыл бұрын
hello sir im having trouble with model having multiple class can you make video on it as well?
@safalghalegurung425
@safalghalegurung425 3 жыл бұрын
there seems to be a video but its in kotlin and i am working on java project.
@programming_hut
@programming_hut 3 жыл бұрын
are you looking for this ----> kzbin.info/www/bejne/bHbVk3mHl52EiZo
@safalghalegurung425
@safalghalegurung425 3 жыл бұрын
@@programming_hut well yes it is but i want it in java and this tutorial is based in kotlin.
@arsalanahmed3488
@arsalanahmed3488 3 жыл бұрын
Can we use a teachable machine file here? using this method?
@programming_hut
@programming_hut 3 жыл бұрын
as far as it is tflite it should work... I never tried but it should work
@arsalanahmed3488
@arsalanahmed3488 3 жыл бұрын
@@programming_hut i trying to use it
@programming_hut
@programming_hut 3 жыл бұрын
@@arsalanahmed3488 so did you got any error
@arsalanahmed3488
@arsalanahmed3488 3 жыл бұрын
@@programming_hut i don't test it yet if it will be successfully run i will inform you
@arsalanahmed3488
@arsalanahmed3488 3 жыл бұрын
@@programming_hut it's working proper but please let me know it's showing the result in number i don't want to show in number
@Yussel_UG
@Yussel_UG 3 жыл бұрын
¡Gracias!
@programming_hut
@programming_hut 3 жыл бұрын
Thanks 🙏
@AshutoshKumar-yn6wf
@AshutoshKumar-yn6wf 3 жыл бұрын
Hey bro can u tell me how to use full 1000 list of tensorflow in this code
@saifchowdhury9728
@saifchowdhury9728 3 жыл бұрын
how can I add labels.txt code in this apps?
@sivanit3150
@sivanit3150 3 жыл бұрын
The video is too excellent!!!! But I'm getting error while using start activity for result, it says it is deprecated... What should i do now... Any suggestions... Also I'm getting an error as when i click on predict button, the app closes... I'm bit confused as to what would cause this. Thanks for your suggestion in advance!!
@sureshxoela7273
@sureshxoela7273 3 жыл бұрын
Thanks
@handhikayp
@handhikayp 3 жыл бұрын
Sir, your drive links seems that you already remove the project into trash, can you renew the link? thanks
@programming_hut
@programming_hut 3 жыл бұрын
I'll see
@saipadmasree2048
@saipadmasree2048 3 жыл бұрын
sir how can i create h5 file for my project?
@deveshreekadu4087
@deveshreekadu4087 3 жыл бұрын
Plz upload TFLite file on github As it is not available on drive
@programming_hut
@programming_hut 3 жыл бұрын
I'll see if i still have it on my laptop
@robertgermia5758
@robertgermia5758 3 жыл бұрын
I used my model with leaf images for prediction. It successfully worked when I use leaf image. But it also gives prediction results for any image ex:-pencil. Can you please tell me how to validate only to predict the leaf images? I hope you will reply. Thank you. i think it is in if probability score > threshold value but I didn't have idead how to do it.
@programming_hut
@programming_hut 3 жыл бұрын
when you trained your model you need add one more class called unknown and in that add whatever unknown images you can get . again train it and then try. I hope this could work.
@dwiencabalquinto5545
@dwiencabalquinto5545 Жыл бұрын
did you solve your problem?
@davidcoyle958
@davidcoyle958 3 жыл бұрын
I assume this will work for any tflite model?
@programming_hut
@programming_hut 3 жыл бұрын
yes as far as follow same steps
@davidcoyle958
@davidcoyle958 3 жыл бұрын
@@programming_hut great thank u bro
@saquelainmokhtar6016
@saquelainmokhtar6016 3 жыл бұрын
thanks
@ywf98
@ywf98 3 жыл бұрын
thanks
Deploy ml model using flask | heroku | server | ML model to API
11:14
ЛУЧШИЙ ФОКУС + секрет! #shorts
00:12
Роман Magic
Рет қаралды 26 МЛН
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 21 МЛН
Deploy Machine Learning Models using Flask
14:52
Jay
Рет қаралды 117 М.
AI Landmark Recognition With Tensorflow Lite and CameraX on Android
34:28
Object detection app using YOLOv8 and Android
13:50
Code With Aarohi
Рет қаралды 25 М.
Simple Machine Learning GUI App with Taipy and Tensorflow
30:52
Python Simplified
Рет қаралды 174 М.
Build an Android app to recognize flowers
21:07
Android Developers
Рет қаралды 51 М.
Building a Mobile App in 2024: The BEST Technologies
13:31
Dan Ilies
Рет қаралды 87 М.