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

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video i am going to show you how to use yolo v4 object detection on android we are going to use yolo v4 tiny tf light yellow v4 tf light and custom yellow v4 tf light models so lets get started first of all we need to setup android studio go to the official website and download latest version install it with default options when installation is finished start android studio hit next click on standard hit next i'm going to select dark theme click next and then finish it's going to download a few things let it run in the background and meanwhile you should go to this github repository and clone it or download it as zip file a little disclaimer that i have forked this repository from this author so all the credits to the original author once the repository is cloned and the android studio has finished downloading bunch of stuff click on open existing project and then head over to the clone repository and there is a folder called android select it and hit ok now in the panel on the left hand side if we expand app we will see two folders called assets and java assets contains the existing eolo v4 tiny tf lite model while the java folder contains the codes to run object detection now right click on the tf lite file and open in explorer there are bunch of files here coco.txt contains the names of the classes on which yolo v4 was trained then there is a demo image to run object detection in mobile and of course the tiny yolo v4 model we are not going to change anything here and get straight back to android studio expand java and then open main activity file by double clicking on it then expand tf lite and open yolo v4 classifier file and finally open detector activity file now we will run tiny yellow v4 object detection for that go to yolo v4 classifier file and search for an option called is tiny the value is set to false by default change it to true and save the file then go to build then build bundles and click on build apk wait for android studio to build your file once it notifies you that it is done click on locate there you have it you can copy that in your mobile and install it like any other app i i'm going to show you how it performs on my mobile let's open the app and here we have the demo image so just tap on detect and it will perform object detection on this image it has detected a few objects but has missed quite a few that's understandable as it is tiny yolo v4 which is not much accurate and if we tap on camera mode it will run object detection on video stream of your camera it is detecting my laptop and person on the screen if we bring up this little panel here which shows the speed of object detection we see that its inference time is between 500 to 600 milliseconds for each frame which is a little bit slower than i expected because two frames per second is far from real time its accuracy is also quite low let's see how it performs on full version of your v4 model we converted the original yolo v4 to tf lite in this video and we also did fp16 quantization so we have got that file here i will copy the fp16 version of the file and paste it in the assets folder of our android app we do not need the tiny version of tflite model so i am going to delete it and lets also remove label map and detect files rest of the things remain the same lets go back to android studio and set the is tiny flag to false in yolo v4 classifier.java file now go to detectoractivity.java and change the tf model file name we have fp16 instead of fp32 so let's change that then let's go to mainactivity.java file and change the file name here as well click save again go to build and build apk when build is done install the apk on your mobile now this full version of yolo v4 is able to detect all the objects in the demo image and in camera mode well although it's more accurate but it takes between seven to eight seconds per frame for running inferencing which is horrible let's see how our custom model performs we are going to copy custom yellow v4 tflight model which we got as a result of this video paste in assets folder remove all previous files except coco.txt open coco.txt and we are going to edit it our custom ulo v4 model had just one class called john wick so i am going to remove all other class names and just insert john wick on first line save the file then i am going to put this vic.jpeg file for the demo in our mobile instead of kite.jpg now head back to android studio and change the tf lite file name to custom underscore yolo v4 underscore fp16.tflight in mainactivity.java file similarly rename the file name in detectoractivity.java file as well then head back to mainactivity.java file and search for kite.jpg and replace it with vic.jpeg that's it go to build and build apk again and install it on your mobile phone open the app and let's see how it performs on demo image it detects john wick and ignores neo so that's perfect on videos it is able to detect john wick but with the speed of one frame every seven seconds so if you are planning to run custom object detection using yolo v4 on android either go for yolo v4 tiny or use mobile net instead i will see you in next one [Music] you
Info
Channel: TheCodingBug
Views: 46,774
Rating: undefined out of 5
Keywords: tflite, tflite android tutorial, tflite object, tflite object detection android, object detection android app, tensorflow object detection, tflite android studio, object detection, tensorflow lite, yolov4 tflite, yolov4 object detection mobile, yolov4 android, custom yolov4 android, custom yolov4 tflite, tflite object detection, android tflite object detection, tflite yolov4, tflite yolov4 android, yolov4 android tutorial, object detection android, object detection tflite
Id: YzAjAS6Os8c
Channel Id: undefined
Length: 7min 10sec (430 seconds)
Published: Mon Jan 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.