Train Object Detection for Android | Build Realtime Object Detection Apps with Tensorflow Lite

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign object detection models on your custom data sets and then you can use those models inside Android with both images and the live camera footage apart from that you will learn to integrate existing object detection models inside Android applications so we will learn to use SSD mobile net model efficient debt models and the YOLO model family inside Android with both images and the live camera footage so the course is divided into three main parts and the first part is about training custom object detection model then in the second part you will learn to integrate that model inside Android and the third part is about using pre-trained object detection models in Android so if you are someone who want to train and use object detection models in Android then you can take all three parts of this course and if you are an iOS Developer then you can just take the first part and learn to train a custom object detection model for iOS but the integration of that model inside iOS application is not included in this course and if you are a machine learning engineer who want to integrate his existing object detection models in Android then you can also take this course object detection is a computer vision technique that allows us to identify and locate objects in image or video and in real word it is being used for variety of use cases like video surveillance crowd counting anomaly detection in agriculture and health care and inside self-driving cars so we can use the power of object detection and build smart Android applications the first part is about data collection and annotation and in this part we will learn to collect the data set for training and object detection model after that we will learn to annotate that data set using Robo flow and other such tools after that we will learn to train our object detection model using the data set we collected and annotated after training the model we will test it to check the model performance and accuracy then we will convert this model into a TF Lite format so that we can use it inside our mobile applications after training the model and converting it into a TF Lite formade we will learn to use that model inside Android with both images and the live camera footage apart from training our custom object detection model and using it inside Android we will learn to use existing object detection models inside Android with both images and the live camera footage page so in that section we will explore three popular families of object detection models and use them inside Android applications and those families are SSD mobile net models efficient debt models and the YOLO model family so after completing this course you can train object detection models on your custom data sets and use those models inside Android applications apart from that you will be able to use existing object detection models in Android and build powerful applications the course also comes with the ready to use codes so if you want to use existing object detection models inside your applications then you can take the pre-built codes available in this course and customize them based upon your requirements and for your safety the course comes with the 30 days money back guarantee so you don't not have anything to lose here so what are you waiting for join the course now and start training your object detection model for Android [Music] welcome to this lecture in this lecture we will cover some basic introduction of object detection and its use cases so what is object detection object detection is a computer vision technique that allows us to identify and locate objects in images or video for example if an image contains two cats and a person then with object detection model we can detect all these three things at once so when we will pass this image to our object detection model it will gonna detect that two cats are present inside this picture along with the person and our model will also gonna return that where in the image these objects are present so using object detection we can get the things present in an image along with their location object detection is mostly confused with image recognition or image classification but there is a big difference image recognition assigns a label to whole image for example if we pass this dog image to our image classification or recognition model then our model will gonna assign label dog to this whole image similarly if we will pass a picture where two dogs are present then our image recognition model will gonna still return the label dock for that image because that model assigns the label to the whole image on the other hand when we will pass this picture to our object detection model our model will gonna detect that where in this picture the dog is present and similarly if we pass an image with two dogs then our model will gonna detect that two dogs are present and it will gonna also show us the location that where those dogs are present so in that way of object detection provides more information about an image than image recognition so hopefully you got the point that what is the difference between image recognition and object detection image recognition assigned the label to the whole image on the other hand object detection model draws a box around each object and assign a label to that work so there are number of use cases and applications of object detection in real world and some of them are video surveillance crowd counting and anomaly detection in video surveillance object detection model can track multiple people at once in real time so it can be used in stores and factories for security worker performance and safety and for measuring retail for traffic and more so object detection can be used in stores and factories for smart video surveillance crowd counting is another valuable application of objective action for densely populated areas like theme parks malls and City squares object detection can help businesses and municipalities more effectively measure different kind of traffic and that traffic can be unfold in vehicle or otherwise so using object detection model we can count the number of peoples so it can be used for measuring that how many people entered in a theme park mall or in a city square and later that information can be used for various analysis anomaly detection is another use case of object detection which can be applied in agriculture and Healthcare in agriculture we can use object detection model for detecting plant diseases and this will gonna allow Farmers to take in-time actions and increase their crop yield and in healthcare object detection could be used to treat conditions that have specific and unique symptoms one such example is treatment of acne an object detection model could locate and identify instance of acne in seconds similarly it can be used for detection of tumors in human body so apart from above mentioned sectors object detection can be used in different sectors of human life and in this course we will learn to train our custom object detection models and then we are gonna build smart Android applications using those models so hopefully you will be excited to learn something new and valuable welcome to this lecture in this lecture we will see how an object detection model is trained as now we know that an object detection model can recognize the things and also locate the position of those things but how we can train our custom object detection model so suppose that we want to train an object detection model to recognize several fruits like watermelon pineapple kiwi and Apple so to train this model we firstly need to collect images of these fruits in different scenarios and that process is called data collection so in data collection we collect images of the objects which we want our model to recognize so in our case we will collect 100 images of watermelon pineapple kiwi and apple and after collecting the data we will take each image one by one and draw a rectangle around each fruit and assign a label to it and that process is called Data annotation so after collecting the data we need to annotate it and for annotating there are several online tools using which we can easily annotate the data and it is necessary to annotate the data so that our model can learn where an object is present in the image while training and after data set collection and annotation the next step is model training so in this step we will take our annotated data and pass it to our machine learning algorithm and we will get our trained machine learning model so in our case this machine learning algorithm will be a python code using which we will train our model so we will pass our annotated data to this algorithm and we will get our trained model and now we can test this model so that we can check whether our model is accurate or not so what we are gonna do is to pass some sample data set or some sample image to this model and this model should detect the objects present in that image like in our case when we will pass this apple image to this model it should return the label Apple along with the location of this apple in this image and that process is called Model testing or model evaluation so after training and evaluating our model the next step is is converting this model into a TF flight format so that we can use it inside our Android application and that process is called Model conversion and using tensorflow Lite Library we will convert our model into a tflight format so once we will get our TF Lite model we can use it inside Android application with both images and the live camera footage so we are gonna build two applications in that section firstly we are gonna build an application in which user will be able to choose images from gallery or capture images using camera inside Android and then we will pass this chosen or captured image to our object detection model and our model will gonna return the results and then based upon the results returned by the model we will draw the rectangles around detected objects and secondly we will build a real-time object detection application in which we will use our model with the live camera footage so we are gonna detect these fruits using the live camera footage so the whole process can be divided into five major parts data collection data annotation model training model evaluation and conversion and finally building our Android applications foreign welcome to this lecture in this lecture we will start the first part of our model training process and that is data collection data collection is a process of collecting data for training machine learning models in case of object detection this data is in the form of images so we need to collect images of the items that we want to detect like in our case we want to train an object detection model to recognize several fruits so we need to collect the images of those fruits and that process is called data collection there are several ways to collect the data set the first one is that instead of collecting the images by ourselves we will take some publicly available data set so we can take an entire data set and train our model on it or we can just take the existing images of those data set and annotate them by ourselves and then train our model so the first way is use an existing data set the second way is web scripting in that process we will write some scripts to collect the data automatically so we don't have to capture or download the images from Google one by one we can just write the scripts and collect the images of a particular type and the Third Way is taking the photographs so in that way we just take a camera and capture the images by ourselves and form our data set so that's the third way that we will collect the entire data set by ourselves and the fourth way is data augmented equation it is actually a data processing step instead of a data collection so in that augmentation we will take the existing images of a particular data set and we rotate and scale them and form new images and this process is called Data augmentation so by that way we can increase the number of images inside our data set because we will rotate and scale the existing images and increase the number of images inside our data set so these are the four common ways to collect our data set and here are few things to remember when collecting images the first thing is the size of the object in the images so our data set should contain both small and the large images of the object if an object is usually large in the data set then our model will perform worse in the cases when the same type of object appears small so it means that when collecting the images for our data set we should choose such images where the object is being appeared both in smaller and larger size if our data set only contain the images where the object is present in large size then while testing the model our model will not gonna perform well when the object appears small in the testing image so it means that while collecting the images for our data set we should select the images where the object is appearing both in small and larger size if all the images contain an object in larger size then our model will not gonna perform well for the smaller size and same is the case with the smaller size like if we collect all the images where the apple is being appeared small then our model will not gonna perform well when the Apple will appear large when we are testing the model so that's the first thing to remember when collecting the data the second thing is the number of images there should be around 150 to 500 images of each class to get good results while training the model and if the images for a particular object is less than 150 then we can perform that augmentation and we can increase the number of images for that object automatically and the third thing is avoid diagonal items diagonally position object especially thin ones such as a pen or road marker will take up a significantly smaller bounding box area than their surrounding background so it means that we should avoid the images of the objects where the object is being positioned diagonally because when we will annotate such images then the bounding box will gonna take a lot of extra space like you can see in the image that the bridge is present at a very small area as compared to the background so this will have a negative effect while training the model so we should not collect such type of images so these are the things you need to keep in mind while collecting the data and inside our next lecture we will start the data collection process for our fruit recognition model so see you in the next lecture [Music] welcome to this lecture in this lecture we will start the data collection process for our fruit recognition model so as we learned inside our previous lecture that there are several ways to collect the data so one way is to collect the images by ourselves so we can either capture the images by ourselves or we can take the images from Google one by one but this thing will gonna take a lot of time so instead of that we will stick with the first approach which is using an existing data set but keep in mind that we will just use the images of an existing data set but we will annotate them by ourselves so the question is from where we can get existing data sets and one such site is kaggle Kegel is the world largest data science Community where you can find free resources related to data science and machine learning so open your browser and type kaggle click on the first link which is this kaggle.com so that is the home page for kaggle and here you can search for data science related materials as we are looking for a fruits data set so we can type fruits in the search bar so I'm gonna type fruits and similarly if we are looking for a movies data set then we can type movies there and here in the results you can see several tabs the first one is notebooks so there are more than 2400 code notebooks where fruit is mentioned similarly there are 215 data sets which are related to fruit so just click on this data set tab so that we can see the list of data sets so now you can see all the data sets here and the Minor Details are mentioned like when this data set is published and what is the size of that data set so you can scroll down and see these details similarly if you further want to look at the details you can click on any of the data set like in our case we will use this fruits and vegetable IMI recognition data set so just click on it and here you can see several other details like what are the classes or what type of objects this data set contains so there you can see that this data set contain fruits which are banana apple kiwi orange and so on and it includes the vegetable like like carrot onion potato and so on similarly you can see the number of images for each class so there are 100 images for training the model for each class 10 images for testing the model after training and the 10 validation images which will be used to evaluate the model performance while draining so these are the three things and we will explore them further later so the data set looks good and include all the four classes for which we want to train the model so it includes this kiwi watermelon pineapple and apple so we will use it so after you will verify the detail of the data set and you want to use it you can simply download it by clicking on this download button and it will gonna ask you to attach your Facebook or Google account with it so here we will attach our Google account and you can do the same or you can either sign in using your email Facebook or Yahoo so we will use our Google account so after attaching your Google account you can click on the download button again and the data set will start downloading so here you can see that the data set downloading started so now let's wait so that our download will complete so our data set is downloaded and now let's firstly unzip this zip file so the extraction completed so let's firstly visit this folder so there you can see that there are three folders inside it and the train folder contain the images for training the test folder contain the testing images and the validation folder contain the images which will be used for validating the model during training so firstly let's look at our training folder so there you can see that it contains separate folder for each type of object which is present inside this data set like this Apple folder contain all the images of Apple so you can look at these images for training the model similarly let's explore another class like we will open this watermelon folder and it contain all the images of watermelon in different scenarios similarly the third class we will use is pineapple and you will find this folder here so let's open it so as you can see that it contain all the pineapple images and the fourth class we will use is kiwi so let's look at the images for kiwi as well so there you can see the Kiwi images so these are the four objects for which we will train our fruit recognition model and if you want to include more objects like you want to train the object detection model on 10 fruits then you can choose more classes from here but for now we will train the model on these fruits this apple kiwi pineapple and watermelon so for now we will delete the other folders so I'm gonna select them so I'm gonna select them all and then I'm gonna unselect this watermelon pineapple kiwi and Apple and we are gonna delete the extra folders similarly we will do the same for the validation and the test folder so we are going to select them all and then we will select our unselect our water Manner and pineapple kiwi and apple and then we will delete the remaining folders and finally for the test folder so now we just cleaned our data set and we removed the extra classes similarly if you want to include some more images you can take those images from Google or you can capture the images by yourself and you can include them inside our data set for example you can include the images inside this training folder like the images for the Apple will go inside this Apple folder and the images for the remaining objects will go inside their respective folders so here our data collection process is completed and the next thing is annotating the data so that we can use it for training our object detection model and we are gonna start that process inside our next lecture but for now we just downloaded the data set from kaggle and we explored that data set that it contain the images of the respective rules so now inside our next lecture we will start the data annotation process so see you in the next lecture foreign we will start the second part of our model training process and that is data annotation for training an object detection model we need a data set and the data set consists of images for training and object detection model so as a first step we collected the images of those rules and the next step is annotating that data so in data annotation we take each of the collected image and draw a rectangle around it after that we assign a label to that rectangle based upon the object present inside it so for an image which contain an apple we will draw the rectangle around that apple and assign a label Apple to it and we will do the same for watermelon that we draw a rectangle around it and assign a label water well into it so that process is called Data annotation so while annotating the data for draining our object detection model we need to keep several things in mind the first one is pixel perfectite Mass so it means that we should draw the rectangle or the bounding box around an object in such a way that the edges of bounding box should touch the outermost pixel of the object that is being labeled so that's the first thing you need to keep in mind the second thing is about data collection but it is also relatable to data annotation that there should be both smaller and the larger images of an object should be included in the data set so that our model will be trained effectively and it will perform well both for the small and the larger currencies of the object so for smaller Apple the bounding box will be small and for larger Apple the bounding box will be large and the third thing is again this diagonal items so we should avoid the diagonal items because in that case when we draw our bounding box around that item the background is included in larger proportion so as you can see in case of this bridge the bridge area is very small and the background is very large in the bounding box so this will gonna give an so this will so this can affect the performance of our model while training so we should avoid such images where the object is present diagonally so now the question arises how we will draw the bounding box around the images so in this course we will be using roboflow for annotating the data set roboflow is a computer vision developer framework for better data collection and annotation so we can just upload our data set on roboflow and then inside roboflow editor we can open the image one by one and draw a rectangle around each object and assign a label to it and it's a very simple process so inside our next lecture we will explore robot flow and we will start the data annotation process for training our fruit recognition model so see you in the next lecture [Music] welcome to this lecture as inside our previous lecture we just covered the introduction of data annotation and now in this lecture we will explore Robo flow and we will start the data notation process so open your browser and type Robo flow here in the search result click on the link which is this roboflow.com so that's the home page for robo flow and there you can see you can upload your data set here organize it then annotated and after that it also provide the facility to train the model and also you can deploy the model but we will just upload our data set organize it and then we will perform The annotation for training our model and after that we will train our model using a different approach so we will not use Robo flow for training our model so here in order to use roboflow firstly you need to attach your Google account so click on the sign in so here you can sign up with your work email or you can sign in using your Google account or GitHub account so I'm gonna use my Google account so now our dashboard is open so in your case it may look different because here I already have a workspace and in your case you will not have any workspace if you have logged in into Robo flow dashboard for the first time so here the first step is creating a new workspace so click on the add workspace button and then here you need to choose the category so here we will choose it like for school and then we will enter the workspace name so I'm gonna enter WS2 and in your case you can name it with any name that you like after that if you want to include some other members inside this workspace you can write their emails here or you can simply skip this step and then here there are two options the first one is for community and that is free so here if you choose that thing then you can easily upload your data set and annotate it for free and if you choose the business category then some portion of this business plan is free so we will stick with this community approach and in that case our data set will be available publicly but that is not a problem for us now so here we can choose community and click this create public workspace so now our workspace is created and the next step is creating a new project so click on this create new project and then here you need to click on the skip tutorial and then here you can type the project name so I'm gonna name it like fruits and after that you need to choose the project type as we want to annotate the data for object detection so we will choose this project type to object detection and then you need to add the letters like what type of thing you are predicting so as we are predicting fruit so I'm gonna write fruits here and then click create public project so now our project is created and the next step is uploading our data so here in order to upload the data you can just simply drag drop the images which is present inside our folders or you can open the Explorer from roboflow dashboard so here we will simply click on the select folder and after that we will navigate to the folder which contain our data set so in my case I have it inside course folder and the archive so we can simply select this archive folder and then click upload and it will gonna upload all the images which is present inside the subfolders of this archive so here you can see that the uploading is started so it will gonna firstly process all those images and after that it will gonna upload them on roboflow so let's wait for the processing to finish so now the processing is completed so you can see all the images so there are total 328 images inside these four folders so when you will scroll down then you can see all those images here so here you can also notice this annotated and not annotated tab so all these images are not annotated so there are 328 non undertated images and there is no image in this annotated tab so we have to annotate all these images but before that we need to upload them and for that purpose just click on this finish uploading and it will gonna start uploading these images on roboflow so there you can see that the time it will gonna take to upload all these images on roboflow so now all the images are uploaded and the next thing is assigning those images to the person who can narrate them as in our case we will annotate them by ourselves so we don't need to do anything but if you want The annotation to be done by someone else like your friend then you can invite it here by clicking on this invite teammate so you can see that roboflow is a complete platform using which you can not just only annotate the data but you can perform several other useful functions including this collaboration with team so here for now we will click on this assign images so here you can see a notated and unannotated images so all the images are not annotated similarly you can add Specific Instructions here and you can also reassign it to someone else and after that you can see all the unknown rotated images inside this unannotated tab [Music] so here let's start annotating the images by clicking on the first image so here we will start annotating this big watermelon so what we will do is that keep the cursor here at this point and then press the left key and after that by pressing this left key start dragging and drag it to a point so that this whole watermelon is covered inside this bounding bar so now you can see that the watermelon is almost covered and you need to keep in mind the first point or the first thing we need to keep in mind while annotating that this bounding box should be Pixel Perfect so we will try we will try to do that so here leave the rectangle here and after that you need to assign a label to this rectangle just as we learned that while annotating the data we take each image and draw a rectangle around it and then we assign a label to that rectangle based upon the object present inside it so as this rectangle is containing a watermelon so we will create a new class named watermelon and we will assign the label watermelon to this rectangle so water melon and after that we will click on this create watermelon class so now this rectangle is assigned a label watermelon similarly we have to do it for this little piece of watermelon so move the cursor here and then press the left key and drag and here select this piece and choose the class and now you can see that we already created this watermelon class so we can simply select it and if the class is not there like when we will start annotating the apple images so in that case we need to create a new class for the first time only so now we move to the next image so here you can see that there are several pieces of watermelon including this whole watermelon so firstly let's annotate this whole watermelon and you can notice one thing that this whole watermelon is not completely visible so in that case we have to suppose that at which part of the image this watermelon is extended so this is the part it is visible but we will suppose it is extended at this part so that's the case when the whole object is not present so we have to consider that at that particular point this watermelon is present so we will select it and choose the label similarly we have to do it for all these small pieces so firstly we will do it for this piece and choose watermelon similarly we have to do it for the second piece and we have to suppose that it is extended at that point select the class similarly you can just also select the class by pressing enter so here for the third piece we will suppose it and press enter and the watermelon will be chosen and now we will do it for a final piece or there is also one more left so we will select it and then for this piece and press enter similarly let's move to the next image and it includes a lot of watermelon so we have to do it for them and if this thing is frustrating for you then you can also get the annotated data which is also shared in the course resources so you can just take that annotated data where all these images are already annotated and though the notations are done by me otherwise you have to annotate them one by one like in this case we will annotate this image so we will select this watermelon for now and press enter similarly we will repeat the process for each of the watermelon which is available here and you can also skip several watermelons here but this will gonna impact the model performance similarly as I'm working on a separate PC so my annotations are not Pixel Perfect in that case as you can see but you have to ensure that your annotations are Pixel Perfect like the bounding box you'd only include the object not in the corners are two should not be too far away from the corners of the object similarly let's do it for this watermelon and this small portion and now let's move to the next image and they are a single watermelon is present so let's annotate it and now let's look at the other images and we will only annotate those which are a little bit confusing for you otherwise you have to annotate all these images by yourself or you can take the notated data so here you can see that now four Images are annotated and the unrated images are 324. so in the unannotated images let's select this pineapple image for now so that we can cover that how we will annotate the rest so here now we have a pineapple so we will try to enclose it in a box and now we need to create a new class because it is not a watermelon and we haven't created our pineapple class so we will name it pineapple and we will click on this create pineapple class so now our pineapple class is created and now let's move to the next image which again creates contains a water pineapple so we will select it and now in the classes we have two classes watermelon and pineapple as we are annotating a pineapple so we will click on them and there is one problem you may face and that is wrong annotation so for example if by mistake I enclose it here and choose the class watermelon so as it's a pineapple so we have to change it so for that purpose you have to choose this drag tool from here and click on the center of this annotation and then you can simply change it to pineapple so now The annotation is changed so here you can again move to the bounding box view by clicking on this bounding box and similarly you can undo the changes using this undo button and redo them also so it is a complete tool similarly let's scroll further down and we will annotate several kiwis like these so we will draw a rectangle around kiwi part and we will create a class EV here because it's not already there so create class kiwi similarly we will annotate this second portion of kiwi now there are three classes but we will select TV here and now for this whole key which is hidden so we will suppose that it is extended it till that part of the image and then we will select EV and by that way we have to annotate the rest of the data so now let's do it for an apple like for this image so here we will start the annotations of Apple like that and we will create a new class Apple here so click on this create Apple class and now we will annotate the second Apple so now you can see that we have annotated for all four classes but we have 318 images left on which we need to perform The annotation so you have to annotate the Rest by yourself or you can take the annotated data which is present inside course resources and there is also a lecture which will gonna guide you that how you can take this annotated data by yourself so if you want to do it by yourself let's complete The annotation and we will see once this una rotated is 0 and the annotated is 320a so let's skip to that part foreign so now we completed The annotation of our data set so there you can see that all the images are now annotated and hopefully you have done this annotation part by yourself and here let's look at several images where a notation is little bit tricky like in this case where watermelon is in smaller size or in larger size so there you can see that even we annotated this watermelon and this annotation is not Pixel Perfect but you should try to achieve Pixel Perfect annotation similarly let's look at some of other sample images like these apples which are hanging on a tree so there you can see that we annotated these apples which are quite clear so you can see they are hanging on a tree and we annotated them and same is the case with the other images so we annotated all the occurrences of fruits and maybe we have missed in some cases but that was by mistake so we should not we should not left any part of the image where a fruit is clear and we haven't annotated it so you should make sure that so after annotation we have 299 images because we have deleted several images because some of them are diagonally positioned objects so as we learned while learning the introduction of a notation that we should not include such images so I have removed several images from them so here after a notation the next step is exporting this data so that we can download this annotated data and use it for model training and for that purpose we need to click on this generate here so that we can generate a version of our data set so here you will see the information of the data do you just annotated so firstly there are 299 images maybe they will be different in your case and the classes R4 because we are detecting four classes and you should make sure that while annotating you do not create any extra Clause because if you by mistake like you have a spelling mistake like you have apple with the capital A and apple with a smaller a then this will be considered a separate class so you should make sure that you have four classes here and if you have like five to six classes then you need to go inside this annotated section again and there you have to see what extra class you created so you have to like redo that annotation hopefully you understand that so here we will go to the generate again and after that you will see this trends of test sublet section so here you can choose that how many images you want in the training set how many in the testing set and how many in the validation so generally there are eight in training 10 percent in validation and 10 percent in testing so we have done that and if you want to change this ratio you can click on the rebalance and here you can select the number of validation and testing images so here for now we will keep them like 32 for validation 31 for testing and 236 for training so click save and after that click continue and the next section is processing as for now we don't want to add any processing step here but here if you want you can change the image size right now the images will be of size 460 by 16 by 416 so you can here change the image size and like you can make it 180 by 180 or any other thing but for our case let's keep it like that and similarly you can explore other processing steps like you can make the images grayscale and auto adjust contrast or things like that but we will not do anything like that for now and we will click continue and the next thing should be familiar for you and that is augmentation so we have already looked at augmentation that when we have less images during preparing our data set we can increase the number of images by applying augmentation so in augmentation our existing images are actually rotated or scaled and we can increase our training images using that so here when we will click on this add augmentation step so here you can see there are several options like we can rotate the image we can crop the image and generate new images we can change the saturation brightness exposure and so on and by using all these ways we can simply increase the number of images as for now we have 236 for training so what we can do apply augmentation and we can increase the number of images so here for now let's add this rotation so I'm gonna click on it and then here you can specify the angle to which the images will be rotated so by default it's 16 the 15 degree so when you will increase this angle the images will be rotated so now if we have an Apple image then there will be two more images generated using by applying this tab one will be rotated left by 26 degree and one will be rotated right by 26 degree so by using that way our data set will gonna increase so here let's apply the you can say the rotation with 15 degree and click apply and now our data set images will gonna increase similarly we can add another augmentation step if we want but for now we will skip that and after that click continue and now here by clicking on this generate we can generate a version which we can export later and train our model on it so here we will click on this student rate and now this version is being created so there you can see the version that now our data set or the training set contains 683 images and the validation set contain 32 and the testing set contain 31 so we need to increase this validation and testing set images and we will do that later when we will export those images so here you can see that by applying augmentation we have increased our images and when you will look at these images you will see that our existing images will be rotated to the left or to the right and you can also see that our annotations are also rotated as per our image and the next step is exporting those images or simply exporting this version so that we can download it and then use it for model training so in order to do it we need to Simply click on this export button and then here we need to select the formula to which we want to export so for our case we will export it into a pascal work format which is a popular format for preparing data set for object detection so we will choose this particle work here and then we will download the zip to computer so select it and click continue and the zip file will be generated and it will be downloaded so there you can see that our downloaded is just starting similarly you can generate new version and download it so here you can click on this generate new version and here you can if for example if you want to download a new version with the size 720 by 720 so in order to do that we will change the size here so we will click apply and our image will be resized and after that we will add the augmentation if we want like here we can remove this previous augmentation or add new like let's try to rotate it by 90 degree so clockwise and anti-clockwise and we will also select this upside down and then we will click apply so now our new augmentation step is applied so let's remove this previous one and now click continue and now here we will click on this generate and our new version will be generated so similarly you can generate any number of version as you like and then you can use them for training the model so here our new version is generated and it contains 565 training images 32 validation and 31 testing so here similarly we can export this version as well so here choose the format to Pascal work and download zip to computer and then click continue so there you can see that now the downloading started again and here now the data set size is increased because we have changed the image size to from 416 to 720 and we will use the second version for training our model so let's wait for this download to be completed and then we will analyze it [Music] welcome to this lecture as in the previous sections we collected the data for model training and we have notated that data and now we come to the part where we will train our object detection model using the data set we collected and annotated so as we know that in order to train the object detection model we firstly have our annotated data set and then we will pass this data set to our machine learning algorithm and in our case this machine learning algorithm will be a python code provided by Google so we will simply pass this data set to that algorithm and we will get our trained model and obviously inside our upcoming lectures we will learn that how we will pass this data to this machine learning algorithm and trainable model so once we will get our train model we can convert it into a mobile compatible format and we can also pass the testing data to the screen model and check the performance of that model so that's the whole flow and now we come to the part where we will pass this annotated data to this machine learning algorithm so as I already mentioned in this course this machine learning algorithm is a code provided by Google to retrain popular existing object detection models so instead of training a model from scratch we will take existing object detection models which is already trained on thousands of images and we will retrain those models on our custom data set and that process is called transfer learning so it is a very useful process that instead of training a model from scratch we will take some existing object detection model which is already trained on a lot of data and we will just retrain that model on our own data set and we will get the model we are looking for so in our case we can take the SSD mobile net officiate net YOLO or other such popular existing object detection models and we will train them on our data set and the output model will only gonna detect the objects which are included inside our custom data set so inside our upcoming lectures these are some major things which we will learn firstly we will explore Google collab which is a platform we will use for training our model so we will open our machine learning algorithm code on Google collab and pass our data to it and train the model and after exploring Google collab we will get our code file which contain the code for our machine learning algorithm and we will upload it on Google call app after that we will explore the code which is present inside this code file and then we will start the model training and after training the model we will convert the trained model into a mobile compatible format which is tensorflow I8 and then we will test and optimize that model so these are some major things we will cover inside our upcoming lectures so see you in the next lecture [Music] welcome to this lecture in this lecture we will explore Google collab which is a platform we will use for training our object detection model so what is Google collab it is a platform provided by Google to run python code in your browser without installing anything on your PC so we can simply open this platform inside our browser and run python code on it so let's explore Google collab so inside your browser go to Google and type Google collab in the search result go to this research.google.com Cola battery so click on it so that's the home page for Google app and here we can read the details like Google collab allows you to write and execute python code in your browser with zero configuration because we don't need to configure or to install anything the access to GPU free of charge and we can use the powerful GPU you processors for free and it also provides the feature of easy sharing that we can simply share the link with anyone and he can see the same notebook within seconds so these are some major benefits that Google collab provides so using this Google collab we can run both simple and advanced python code which will be used during data science machine learning or inside other resource taking tasks so in order to run the python code we can create several different cells here similar to the one here so there you can see that simple python code is written so firstly we assign this calculation to this variable and then we are printing it so here we can run this cell by clicking on this run button and it will gonna ask you to attach your Google account with this Google app and in order to do it you can simply sign in with your Google account so here we will click on the sign in button and here we can add the email and the password of our Google account so now we attached our Google account with this collab and there once you will sign in you can see your recent notebooks so now we can run this cell by clicking on this run button so there you can see that we get the output similarly we can run this cell as well and we got the output here and here we can add and remove these cells like we can click on this code and a new cell will be added similarly in order to add the commands we can add this text cell so when you will click on this text then this cell will be created and there you can write the commands and those commands may be large and small in size and you can customize them using these properties for example if I write Section 1 and I put a hash before it then it will be appear like that similarly if we put two hashes then it will gonna be appear a little bit smaller and when we will increase the number of hashes the size will gonna reduce so that's the case with Google collab that you can add python cells for running the code and you can also add the commands between those cells similarly when you will scroll down you can see this section of data science so using this Google collab you can use the power of popular python libraries like numpy matplotlib and others and perform data science related operations like here you can simply visualize the data using a matplotlib library which is used to plot the data and analyze it for data size operations similarly you can see this machine learning section which is providing the information about machine learning and we will be using this Google collab for training our object detection model so what we will gonna do is to upload our code file on this Google app by going into this file and then we will click on this upload notebook and we will upload our code which is present inside course resources but obviously we will do that inside our upcoming lectures so see you in the next lecture [Music] welcome to this lecture as previously we collected our fruits data set and then we perform The annotation using Robo flow and after annotating the data we downloaded this data so that is our downloaded data so it contains three folder this test strain and validation and as now we are starting the model training so we need to firstly upload this data on Google Drive and we are uploading it on Google Drive because we are using Google collab for training our model and it will be a lot easier for us to retrain the model quickly once we have our data set on Google collab because our Google collab will gonna access the data from Google Drive very easily so open your browser and go to your Google Drive so I'm gonna type Google Drive so click on this my drive so now here inside this mild drive folder we will create a new folder so right click on it and create this new folder and we will name this folder fruits and you can choose any name that you like but later inside our code notebook you have to use this folder name so it's better that you name it like fruits and after that just click on this create button and this folder will be created so there you can see our fruits folder so now let's open this folder so now here inside this folder we will upload our annotated data set so here we have our data set folders so I'm gonna select all these three folders and we will leave these two files and I'm gonna drop them here so there you can see that the uploading start here so why we are uploading our data on Google Drive the reason is when we will use Google collab we will create notebooks there a notebook is a simple python file created on Google collab or it is also created on Jupiter notebook which is also an ID or platform for running python code so here whenever we will run our code a session is assigned to that code and whenever that session expired all the data that we uploaded in that particular notebook will be removed so here inside this Google app we can also upload our fruits data set like we can paste it here but once our section will be expired that data will be deleted so it means that in the next session like tomorrow we have to upload it again so that's why in order to save the time and also in order to save and in order to avoid the problem problem of uploading the data again and again in case we want to train the model multiple times we are uploading it on Google Drive so that our data is already there on Google Drive and we don't have to upload it on Google collab again and again so that's the reason why we are uploading our data on Google Drive so now let's wait for the data to be uploaded so now the data set is uploaded successfully and there you can see all these three folders test screen and validation and inside our next lecture we will upload our code Notebook on this Google app and we will start training our model so see you in the next lecture [Music] thank you
Info
Channel: Mobile Machine Learning Academy
Views: 9,254
Rating: undefined out of 5
Keywords: object detection android, train object detection model for android, tensorflow lite, train custom object detection model, android object detection, object detection for android, object detection android app java, object detection android app, custom object detection android app, real time object detection android app, object detection android app tutorial, object detection android studio java, android object detection tensorflow, build an android app for custom object detection
Id: xqUpq1iT6FA
Channel Id: undefined
Length: 63min 18sec (3798 seconds)
Published: Sat Oct 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.