YOLOv4 TFLite Object Detection Android App Tutorial Using YOLOv4 Tiny, YOLOv4, and YOLOv4 Custom

  Рет қаралды 49,007

TheCodingBug

TheCodingBug

Күн бұрын

Make YOLOV4 TFLite Object Detection Mobile app for Android using YOLOv4 Tiny, YOLOV4, and custom trained YOLOv4 TFLite models. TFLite YOLOv4 Tiny model along with object detection android app code can be obtained from the GitHub repository linked below while we converted YOLOV4 and custom YOLOV4 to TFLite using one of our other tutorials linked below.
APK files for all three TFlite models are available for our Patreon supporters
Links:
github.com/har...
Want to discuss more?
►Join my discord: / discord
#TheCodingBug
#tflite
#yolov4
---------------------------------------------
► My Other Tutorials:
○Build and Install OpenCV 4.5.1 With CUDA GPU Support on Windows 10: • Build and Install Open...
○ Custom YOLOv4 Object Detection with TensorFlow and TFLite : • Custom Object Detectio...
○ Install TensorFlow GPU Under 90 Seconds: • Install TensorFlow GPU...
○ Install PyTorch GPU Under 90 Seconds: • Install PyTorch GPU on...
○ Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet): • YOLOv4 Custom Object D...
○ Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset): • YOLOv4 Custom Object D...
○ YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT: • YOLOv4 Object Detectio...
○ Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams: • Darknet YOLOv4 Object ...
○ Real-Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux: • YOLOv4 and YOLOv3 Obje...
○ Build and Install OpenCV 4.4.0 With CUDA (GPU) Support on Windows 10: • Build and Install Open...
○ Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6: • Install TensorFlow GPU...
○ Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows: • Object Tracking with T...
---------------------------------------------
► Follow us on Twitter: / bugcodingthe
► Support us on Patreon: / thecodingbug
---------------------------------------------
DISCLAIMER: Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you!

Пікірлер: 114
@TheCodingBug
@TheCodingBug 3 жыл бұрын
*My Other Tutorials* --------------------------------------------- Custom YOLOv4 Object Detection with TensorFlow and TFLite kzbin.info/www/bejne/rKu3dH2DZp2opa8 Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet) kzbin.info/www/bejne/Y3-oc2iGYrh_n5I Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset) kzbin.info/www/bejne/qXynqqaEqdObgJY YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT kzbin.info/www/bejne/qnTQdGqkrst9ppo Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams kzbin.info/www/bejne/fHaVeHWbgNqkpsU Real Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux kzbin.info/www/bejne/fJvcd2NpqsaqqaM Build and Install OpenCV With CUDA (GPU) Support on Windows 10 kzbin.info/www/bejne/qpu7nIpmYpmag6c Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6 kzbin.info/www/bejne/hp26aq13nJmWrpo Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows kzbin.info/www/bejne/fZLKenxrhaaYgck
@sagar8460830871
@sagar8460830871 2 жыл бұрын
Please make video on yolov5s android
@AK-pj7he
@AK-pj7he 2 жыл бұрын
sorry put my model i modified but i want TF_OD_API_INPUT_SIZE = 416; change TF_OD_API_INPUT_SIZE = 128; DetectorActivity---55--private static final int TF_OD_API_INPUT_SIZE = 128; YoloV4Classifier ---164---private static final int INPUT_SIZE = 128; MainActivity---73---public static final int TF_OD_API_INPUT_SIZE = 128; But I don't know where else can be modified, because there is a flashback problem at present,
@shiffin_chippe
@shiffin_chippe 3 жыл бұрын
Oh great so you did it🔥❤️ I think this is the first video on Yolov4 on Android
@TheCodingBug
@TheCodingBug 3 жыл бұрын
I believe so.
@joelbhaskarnadar7391
@joelbhaskarnadar7391 2 жыл бұрын
Which one is best yolov4 or yolov4 tiny for android Please clear my doubt
@archanakumar2315
@archanakumar2315 3 жыл бұрын
Can u do the same for YOLOV5
@evanv5471
@evanv5471 3 жыл бұрын
What are the changes to be made if we want to replace the kite image with an image/video uploaded from the mobile device itself? I believe creating a button to access the files/gallery will help choosing the required media. But what other changes are required for running the model on that media file? Thanks for the tutorial.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
No other changes would ne required in terms of model processing. Just assign the loaded image to same variable and it'll work.
@doctorpizza8518
@doctorpizza8518 6 ай бұрын
is it possible to save the detected objects in an array for example? or are they just labeled on the camera view
@avhieghaiylle123
@avhieghaiylle123 2 жыл бұрын
Is there a way to remove the tensorflow lite watermark at the upper corner of the screen during live detection?
@susanoo0217
@susanoo0217 2 жыл бұрын
remove the imageview in the xml file in the layout folder
@athukurianilkumar5352
@athukurianilkumar5352 2 жыл бұрын
if you trained object is detecting fine but what about un-trained object what it will show ? can you make a video on that.
@ojhag
@ojhag 3 жыл бұрын
@TheCodingBug I have an issue when i run tiny default version so it run. But when i put yolov4 416 f16 tflite file so app was crashed. it not opening. A while screen flash happens... Please reply me with solution..
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Make sure to set tiny=false when using default yolov4.
@ahmettopal9514
@ahmettopal9514 2 жыл бұрын
Hello, thank you for this helpful video. May I ask how we can crop the detected john wick?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
You have x and y coordinates for plotting the bbox. Just use them to do slicing of image array to get the pixels within those x and y coordinates.
@armughanaslam
@armughanaslam 2 жыл бұрын
hi thanks for the video! Can you tell me how I can use a different stream instead of the camera when I press the camera button? I want to implement it on an external esp32 camera feed.
@tomekderek
@tomekderek 3 жыл бұрын
I'm not sure if this app uses gpu maybe I missed something but after changing value isGPU to false anything was changed, my inference times were nearly the same Some update: java.lang.IllegalArgumentException: Internal error: Failed to run on the given Interpreter: Following operations are not supported by GPU delegate: EXP: Operation is not supported. SPLIT: Operation is not supported. SPLIT_V: Operation is not supported.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
When GPU is enabled, it adds the gpu delegate to the options. See: if (isGPU) { GpuDelegate gpuDelegate = new GpuDelegate(); options.addDelegate(gpuDelegate); } I am not sure about the error as for me, disabling GPU drops the FPS even further.
@fatmaelfayja6554
@fatmaelfayja6554 2 жыл бұрын
thanks for the tutorial, i clone tensorflow-yolov4-tflite but i didn't find the checkpionts folder so how i can train the model with my own data
@vinhnguyenthe8491
@vinhnguyenthe8491 2 жыл бұрын
Thanks for the tutorial is very clary! I have problem: I have successfully built, but when I turn on the application, it is out and unusable. Please help me!
@라이키-d2r
@라이키-d2r 2 жыл бұрын
did you fix that problem?
@hesron-sam
@hesron-sam 2 жыл бұрын
have you Fix the problem?
@granatapfel6661
@granatapfel6661 2 жыл бұрын
I thought only ssd models are supported by tensorflow lite??
@raffelravionaldo463
@raffelravionaldo463 2 жыл бұрын
When i want build it, android studio say "This project does not contain any App Engine modules", what should I do the fix it?
@kolibri5861
@kolibri5861 Жыл бұрын
question please i have a custom yolov8 and yolov7 model can it work with this app?
@hesron-sam
@hesron-sam 2 жыл бұрын
hello Sir, i currently developing similar objec detection applications similar to this video.. May i know what modifications that i should made if i want to specify the bonding box color in tensorflow lite (inside android studio) .. ie tomato = red and salad =green?. If that possible to make video on how to do it in android studio. Thank you for your comments 🙏🏻
@farhannurhakim4312
@farhannurhakim4312 Жыл бұрын
How to add label name when detect in MainActivity sir?
@세유닝
@세유닝 2 жыл бұрын
Hello! Thanks to you, I made a flame detector application using yolov4. However, I want to add an additional function, but I have a problem, so I'm asking this question! I want to add a function to blink a sound or screen when a flame is detected, but I'm not sure where to write the if statement in android java DetertorActivity. Can I get some help if it's okay with you? Thanks for the really nice video!!
@라이키-d2r
@라이키-d2r 2 жыл бұрын
고치지 않고 run했을때 저 깃헙 코드가 잘 돌아갔나요?
@granatapfel6661
@granatapfel6661 2 жыл бұрын
Thought only Ssd models are supported by TFLite?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
No. You can use any model. But SSD would give a better insight FPS on mobile devices.
@granatapfel6661
@granatapfel6661 2 жыл бұрын
@@TheCodingBug why the hell tensorflow repo says only Ssd models maybe you wrote your own converter and they didn't for other models?
@IndahSyahputri-kz1fg
@IndahSyahputri-kz1fg 2 жыл бұрын
thanks a lot for this great tutorial! can i switch the yolov4 to yolov3 using this code??
@TheCodingBug
@TheCodingBug 2 жыл бұрын
No. Its for YOLOv4 only I am afraid.
@IndahSyahputri-kz1fg
@IndahSyahputri-kz1fg 2 жыл бұрын
@@TheCodingBug oh unfortunately
@antimoiannucci2200
@antimoiannucci2200 2 жыл бұрын
Hi, I would like to add the FPS of the model on screen during the camera mode. How it's possibile to do it?
@abeermalkawi9812
@abeermalkawi9812 2 жыл бұрын
Many Thanks for the 100% accurate and correct tutorial. Please, how we can add voice output to this code to get voice feedback. I tried TTS object with speak statement but it crash the app. Please any help!!!!
@cristiandavidparramunoz6101
@cristiandavidparramunoz6101 3 жыл бұрын
Hi again, man. When I use yolov4-tiny detections in overlapping are bad? it looks like not using non.max suppression (multiple bounding box in each object). Do you know how can I improve that? By the I´ve seen "anchors_boxes" are not used.
@linjake2227
@linjake2227 2 жыл бұрын
My darknet model weight is 244MB. When converting to TensorFlow, size is 12.2MB and when converting back to tflite , size increases to 244MB. But detect.py works fine, is it normal?
@yinnungandylau1497
@yinnungandylau1497 Жыл бұрын
Hello sir, I use yolov5 to train a model and convert from .pt to .tflite, can I use it in tflite?
@tanumodi7513
@tanumodi7513 5 ай бұрын
have u used that, did it work ?
@cristiandavidparramunoz6101
@cristiandavidparramunoz6101 3 жыл бұрын
Thanks man, you're the first channel I've seen that implements YOLOv4 in android, your videos are so good! I have a question, I need to count objects in real time using an android device, I would like to know if it is possible to count objects with yolo in android, I've reading but I haven't found answers. Do you know some API for this problem? On the other hand, is there another way to count objects in real time (and offline) using an android device? Thank you in advance.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Thank you for your appreciation. Yes, you can do that. But with YOLO, it will be very slow. Try MobileNet on Android for real-time detections. You will also need to implement object tracking (so you don't count the same object twice). Then you would be able to keep a count of each object.
@cristiandavidparramunoz6101
@cristiandavidparramunoz6101 3 жыл бұрын
@@TheCodingBug Thank you very much!
@ojhag
@ojhag 3 жыл бұрын
Hyyyy u are able to run yolov4 416 version. So please help me.
@cristiandavidparramunoz6101
@cristiandavidparramunoz6101 3 жыл бұрын
@@ojhag hi, tell me, how can I help you?
@ojhag
@ojhag 3 жыл бұрын
U made yolov4-416-f16.tflite model APK. Which is 125 mb tflite data u use. So please share me that apk.
@lionardiursaputra8584
@lionardiursaputra8584 2 жыл бұрын
hii, whats ur device spesification ?
@Shuur4y
@Shuur4y Жыл бұрын
can you update this project for new versions of visual studio and java?
@ziyuye4641
@ziyuye4641 3 жыл бұрын
I use my own tflite, but it flashback when I open the apk on my phone, I don't know how to solve it
@TheCodingBug
@TheCodingBug 3 жыл бұрын
It seems the tflite file is not compatible with the app configuration. Make sure that tiny flag is set correctly i.e. false for yolo and true for yolov tiny.
@mirzaabdulrehman428
@mirzaabdulrehman428 3 жыл бұрын
how much frame rate will get after using yolo-v4 tiny ?
@suenandrew1970
@suenandrew1970 2 жыл бұрын
I tried to build a cutom detector following this tutorial. However, the app doesn't work and I noticed that there is a labelmap.txt file with all coco labels were created everytime that I built the apk. Is there anyone knows why or encountered the similar problem? thanks
@insaafarmy786
@insaafarmy786 2 жыл бұрын
Thank you so much❤ can we get full version file?
@falcondsasuke2911
@falcondsasuke2911 3 жыл бұрын
Hello... do u have any idea of how to implement the distance from object to camera?
@abeermalkawi9812
@abeermalkawi9812 2 жыл бұрын
Hi, did you got it? I need that too. Appreciate it if you can help.
@muhammadraza2401
@muhammadraza2401 Жыл бұрын
How can I deploy yolov7 on android using tflite ?
@avinashnair5064
@avinashnair5064 2 жыл бұрын
Can i use the custom yolov5 in the same code?
@ChrisLee-nf1yy
@ChrisLee-nf1yy 3 жыл бұрын
May I know where to find the dataset of these movie stars?
@TheCodingBug
@TheCodingBug 3 жыл бұрын
I created that dataset from scratch. You can find the tutorial here: kzbin.info/www/bejne/qXynqqaEqdObgJY
@randomvideos1011
@randomvideos1011 Жыл бұрын
Hi. If I avail phd in patreon do I have a access in any files that you make?
@TheCodingBug
@TheCodingBug Жыл бұрын
Yes
@randomvideos1011
@randomvideos1011 Жыл бұрын
@@TheCodingBug can i get your email sir?
@randomvideos1011
@randomvideos1011 Жыл бұрын
@@TheCodingBug i have offer
@TheCodingBug
@TheCodingBug Жыл бұрын
@@randomvideos1011 contact on LinkedIn please.
@dongivafoc4493
@dongivafoc4493 2 жыл бұрын
hi do you have by any chance a sample of code or tutorial for Dart?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
Hi. No I don't have expertise in Dart.
@Herin0923
@Herin0923 3 жыл бұрын
Thank you for the amazing video. I just succeed to run yolov4-tiny on Android but i was wondering if it is necessary to quantize the model or not. Accuracy of yolov4-tiny is pretty good but whenever i quantize the model (e.g fp16), the accuracy is almost 1 or 2%. could you tell me why do we need to quantize the model? Thank you.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Quantization reduces model size and memory requirements without compromising the accuracy much. So if computational cost is not the issue, the model shouldn't be quantized.
@AswinRamadasindian
@AswinRamadasindian 3 жыл бұрын
Life saver 🥰 Keep making such videos champ !
@TheCodingBug
@TheCodingBug 3 жыл бұрын
I am glad it was helpful.
@1ilfolletto8
@1ilfolletto8 3 жыл бұрын
Hi man, really great work. I'm trying to use it but it gives me this error when trying to open the app on the device : Internal error: Failed to apply delegate: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors. I've read online that could be somethink linked to the fixed shape..Or I read that could be also link to the fact that NNAPI is not supported..Could you help me with that? I would really appreciate it. Really good job by the way.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Try disabling GPU usage. useGpu=true for now. Set it to false.
@1ilfolletto8
@1ilfolletto8 3 жыл бұрын
@@TheCodingBug ok find it and the app now opens but the camera gives me this error : "Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 14083 (inference), pid 13960 (mples.detection)" and app crashes. I've given all the authorization for the camera usage
@1ilfolletto8
@1ilfolletto8 3 жыл бұрын
@@TheCodingBug Detect function on a image doesn't work either
@TheCodingBug
@TheCodingBug 3 жыл бұрын
@@1ilfolletto8 I am not sure about the error!! Maybe there is a compatibility issue with the mobile device.
@1ilfolletto8
@1ilfolletto8 3 жыл бұрын
@@TheCodingBug I can tell you that at the first installation of the app when i click on "camera" app open it for some second and then it interrupt..what do you suggest me?
@brendanevo4g
@brendanevo4g 2 жыл бұрын
Omgggggg thank you! Ive been workikg on this from scratch and igather a little more little by littler. Started a whole hardware build on a pi3+ and i havent coded sincecollege like 10 years ago this intensely. Lol If you are able to see this, i was wondering if you had any recomendations on best overall simple hardware (like a pi) and software deploymeny. Like apk or raspberry pi linux. Im building a custom network of computers or nodes really that each have a microphoe. They would listen for a very distint sound and decible level etc Thank you for any advice you have! Just lrave a comment on one of my videos or here or etc Or email? Thank you again!
@andrewkozhemyakin5857
@andrewkozhemyakin5857 3 жыл бұрын
what to do if the program does not have Build Bundles/APK?
@yaropaithiyam4058
@yaropaithiyam4058 3 жыл бұрын
Update sdk manager And avd manager according to ur phone
@Alpha-hj2ss
@Alpha-hj2ss 3 жыл бұрын
Great Tutorial and Thank you very much
@marutinaik8948
@marutinaik8948 Жыл бұрын
This comes under machine learning or not pls reply... 🥲
@jackli5165
@jackli5165 2 жыл бұрын
this app not working for android 12
@Lhdtskon
@Lhdtskon 3 жыл бұрын
I need help I need like this but for yolov5 pytorch please help me
@varshinesr2421
@varshinesr2421 2 жыл бұрын
did you find a way? Please help me
@harissaeed5811
@harissaeed5811 2 жыл бұрын
how to add voice in it?
@marouaneghoulami4108
@marouaneghoulami4108 3 жыл бұрын
You could use Yolo v4 tiny with CameraX with no problem. But the effect is the same, the only difference is if yolo v4 tiny have one frame per second for example this wont effect CameraX as it would always bring new frames to the user preview. But i agree mobilenet will perform better Thanks
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Thank you for sharing the excellent information.
@세유닝
@세유닝 2 жыл бұрын
very very thank you ㅠㅠㅠ i love you
@atrangitrader
@atrangitrader 3 жыл бұрын
I will not working. After building APK. APK not working. Camera button and detection button both are not working. When I press it app will crash.
@吳易珊-w7r
@吳易珊-w7r 2 жыл бұрын
me too can help me?
@sathyanirmanifernando
@sathyanirmanifernando 3 жыл бұрын
Great !!!!!!!!! Thank you !!!!!!!!!
@arnoldrivera3288
@arnoldrivera3288 3 жыл бұрын
I don't see checkpoint folder in the git :(
@TheCodingBug
@TheCodingBug 3 жыл бұрын
It's not there. You only have pretrained tflite model in assests folder. Checkpoints could be created using the method shown in previous videos.
@arnoldrivera3288
@arnoldrivera3288 3 жыл бұрын
@@TheCodingBug Oh I see thank you.
@arnoldrivera3288
@arnoldrivera3288 3 жыл бұрын
@@TheCodingBug Question, does the speed of detecting objects are based on our gpu right? If I have low gpu then the detection would likely be slower?
@TheCodingBug
@TheCodingBug 3 жыл бұрын
@@arnoldrivera3288 yes it'd be slower.
@arnoldrivera3288
@arnoldrivera3288 3 жыл бұрын
Hello, I added screwdriver on the coco.txt but I got an error -org.tensorflow.lite.examples.detection E/ion: ioctl c0044901 failed with code -1: Invalid argument How can I add new objects to detect without removing the defaults?
@TheCodingBug
@TheCodingBug 3 жыл бұрын
You'll have to retrain the model with new classes.
@arnoldrivera3288
@arnoldrivera3288 3 жыл бұрын
@@TheCodingBug do you have a tutorial on how can I do that? Sorry so new to this tech
@한호-c8c
@한호-c8c 3 жыл бұрын
감사합니다
@adithiajo5028
@adithiajo5028 3 жыл бұрын
try detectron 2 using mobile phone bro
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Thank you for your input. I will try to use it.
@brunoklar
@brunoklar 2 жыл бұрын
Please, I tried to create the apk but it displays the error below. Can anyone help me what could be useful? thanks! Some problems were found with the configuration of task ':app:downloadZipFile' (type 'Download'). - In plugin 'de.undercouch.download' type 'de.undercouch.gradle.tasks.download.Download' property 'acceptAnyCertificate' is missing an input or output annotation. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights.
@toantran5842
@toantran5842 3 жыл бұрын
Is there any way that I can use my own custom object detector on IOS or iPhone? Do we have to make it tflite to quantization file?
@TheCodingBug
@TheCodingBug 3 жыл бұрын
You can use tflite file on iOS as well but you'll have to develop app for it separately.
@toantran5842
@toantran5842 3 жыл бұрын
Thanks a lot. We actually ran successfully the sample (pre-trained model) provided from IOS on GitHub. We tried to put our tflite model in but it does not work somehow. Do we need to build any app in this case?
@toantran5842
@toantran5842 3 жыл бұрын
🙏
@TheCodingBug
@TheCodingBug 3 жыл бұрын
@@toantran5842 make sure that the parameters (such as input image size, output dims of model) of demo app are compatible with current model.
YOLOv8 Custom Object Detection | Step by Step Tutorial
15:52
TheCodingBug
Рет қаралды 177 М.
World‘s Strongest Man VS Apple
01:00
Browney
Рет қаралды 54 МЛН
Every parent is like this ❤️💚💚💜💙
00:10
Like Asiya
Рет қаралды 26 МЛН
AI Landmark Recognition With Tensorflow Lite and CameraX on Android
34:28
Build Android App with TensorFlow Lite Machine Learning Model
7:58
MammothInteractive
Рет қаралды 13 М.
Object Detection in 10 minutes with YOLOv5 & Python!
10:45
Rob Mulla
Рет қаралды 271 М.
Train a custom object detection model using your data
12:10
TensorFlow
Рет қаралды 205 М.
Raspberry Pi Object Detection Tutorial
9:20
Sam Westby Tech
Рет қаралды 81 М.
TFLite Object Detection Android App Tutorial | TensorFlow Object Detection
16:15
World‘s Strongest Man VS Apple
01:00
Browney
Рет қаралды 54 МЛН