Automatic Number Plate Recognition, OCR Web App in Python | OCR online

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome back in this lecture we will discuss about project architecture we will use the following architecture to develop the project first we will start with images in this module we will collect the images from different sources then we will label each and every image of the vehicle manually this process is time taken and very important step the whole process is depend on this module then we will do data preprocessing like normalization transformation etc with the clean data we will train an image with powerful deep learning model for the object reduction that is for detecting or recognizing number plate once a model gets trained we will store the model in frozen format this whole process comes under labeling and training phase in the next step we will work on production our deep learning model here we will take a validation data or data we want to test we will apply the same data pre-processing technique that was applied to the data while in the training phase in order to get the object action for number plate or vehicles we will restore the model that was saved and pass the image to the restored model now this model will return the object action or position of number plate which is also known as region of interest roi with this we complete the module 2 of the project and get the number plate from the image now we will start working on module 3. in model 3 we will send the region of interest image to ocr aka optical character recognition and return the text from the image here we are using the google tester app to do that which is absolutely free now finally we will pipeline the entire model which is our end of the module 3. in the module 4 we will start present the project by creating a web application in flask where the idea is user uploads a vehicle image from the front end and the backend or the server side model process it and returns the vehicle number with this your project is ready so this is the architecture we are going to follow to build the entire project in the next lecture we will talk more about this project thank you very much hello everyone welcome back in this lesson we are talking about how to get the data for bill or model for object action for that go to google and type cars with number plate and click on search now click on images here you can see the car images with number plate or license plates are visible download the images wherever you can see the number plates clearly something like this now right click and click on save as and save it in your respective folder something like this repeat the process and collect as many images as you can you can also use any other data sources to collect the data we will continue in the next lesson on how to deal with this data thank you very much hello everyone welcome back hope you have downloaded the data if you want you can also download the data which i downloaded and label in the resources now in this lesson we will see how to label the image this process is very important step i'm warning you as this is a manual process i request you to be patient while doing this process if you made any mistake it will affect your deep learning model which you are training in the upcoming sessions alright let us get started let us go to google and type label img and click on the first link which gives you the github you can also find the github url in the description once you are in the page the code which is the open source and it is graphical user interface which is used for annotations it is written in python and uses qt for graphical interface now let's download the code done we will continue in the next lesson on necessary installations for the annotation tool that was downloaded thank you very much hello everyone welcome back now in this lesson we will see necessary settings and installations required for image annotation tool first extract the file that were in the zip in the same directory go to the url where you have downloaded the annotation tool code scroll down where you can see the dependencies to be installed follow the instructions based upon your operating system for example i'm using windows plus anaconda so i will use the following instructions now open the anaconda prompt and navigate to the label image directory now copy and paste the following commands given in the instructions and install it now open the gui using the following command that's it we will continue the next lecture more on this hello everyone welcome back now in this lesson we will see how to label images using annotation tool first open image directory by click on open directory button and go to image folder where you have all the images here you can see image opened and list of images in the file list as shown here you can also open whatever image name you want by click on path of the image path here you can see the different methods of labeling image one pascal vivoc to yellow three create ml in this lesson i will show you how to label image using pascal voc now click on create checkbox and draw rectangle box on the object you are interested in our project our interest is license place or number plate so draw the bounding box or rectangle box around the number plate and label the box as number plate now click on save button to save the label information in xml and save that's it now click on next image and repeat the process 1. create rectangle box label it save it and repeat this process is manual process you should be extremely careful while doing this process we will continue the next lecture meanwhile label all the images you have hello everyone welcome back in the previous lesson we saw how to label images for object detection and i did this for all the images that i was collected you can download the images and xml file in the resources now let's open and try to understand the xml as you can see tags like folder file name path source object etc this and all call elements you are interested in the object element where actual information about the label is present like x-men x max y min y max these are the outputs of the deep learning model now in this lesson we will see how to parse the label information and save it in csv now open unkunda prompt and go to the path of your current working directory and open jupiter notebook click on new python3 rename the notebook as zero one underscore xml underscore csv now import the necessary libraries to parse the data from xml and save it in csv first import pandas as pd import xml dot a3 dot element 3 as x e t also import glob by from glob import global this library is used to extract the file path go to home and image here the files we need to extract with xml is there now write down the following to extract the path of xml files path equal to glob open paranthesis within a string dot forward slash images forward slash start dot xml the meaning of this is to extract all files in the list with an extension dot xml and print the path as you can see all the files of the extension xml is stored in the list path now we will write a code to pass the information from xml let's consider first xml file with path of 0 and assigned to the variable file name now pass with xml elementary info equal to xet.parse give the file name now get the root done now let's open the xml file as we know our objective is to parse the values in the object element where actual bounding box values are there now let's write the code member underscore object equal to root dot find since the element that i need to pass is object so object now labels underscore info equal to members dot fine the object that i'm interested is bnd box let's find it now pass all the elements in the bnd box like x-men x-max y-min y-max using the following command x-men equal to labels underscore info dot find of x min dot text since the value that was there is with the data type string we need to convert that into increaser using the type casting command end similarly pass the remaining values in the bounding box that is x max y min y max now print the values let's check the values we extract is correct or not for that open the first file and verify the values and of course we extract all values in xml let's do it for all xml files and save it in the dictionary so let's write for loop for file name in path colon let's put the indentation and comment the file name on top of the for loop create a dictionary name label dict equal to dict open parenthesis file path equal to empty list comma x-men equal to empty list comma x max equal to empty list comma y min equal to empty list comma y max is empty list now update all the values into the dictionary label tick square braces file path dot append file name and repeat the process for x-men label underscore dictionary of x-men dot append x-men and repeat the process for x max y min y max execute it let's print label underscore dict as we can see we saved all the data now convert dictionary into pandas data frame df equal to pt dot data frame of label underscore dict perfect we got all the values in the data frame now save the data frame in csv df dot to csv within a string labels dot csv specify index equal to false execute it now you can find the csv file in your current working directory let's open it excellent now we have all the information saved in the csv we will continue in the next module on data pre-processing until then happy learning hello everyone welcome back in the previous lecture we have seen how to label our images and also we have seen how to convert xml to csv which is basically the output and if this is what the labels.csv which we have converted where you can see what we have is the file path xmin max and y min to send all our labels for the corresponding xml file so what we'll do now is that let's load this labels.csv and do the necessary operations that go to new python 3 and what i'll do is that i'll rename this notebook as object deduction 0 to object deduction all right so the first step what i'll do here is that let me import necessary libraries for doing the object action first let's import numpy snp also import pandas spd import matplotlib dot pi plot splt and also import os os stands for operating system import cv2 computer vision and so on so at the moment we will import these libraries execute it done so now what we will do is that let's load this labels.csv import i'm sorry so df is equal to pd dot read since that is a csv file and that is what my labels dot csv and df dot head and here you can see this and all the delay data what we have with us file path x min x max y min y max are the data points of the particular image so which basically defines the bounding box and the this information we got in the n1.xml file so like this we have all the xml files out there here so if you look into this xml file and here we have the images and this is what the xml file we have and also we can look into the elements what we have is that there is a file name is there and the file name is n1.jpg so in order to read an image what we require is basically required the file name so for that what we require is that like you know based upon this xml i want to read an image or i want to read the i want to get the file name so for that i can use this xml dot elementary so let's also import that from or i can import xml dot e3 dot element elementary as x e t so this is what i just want to do and um here if you see that in the in any xml file i have a element called file name so this is what the element i'm basically interested here so in order to get that we need to pass the data so xct dot pass and uh what i want to do on it what i exactly want to do the paths here so let's do one thing let me take the path 0 and this is what my file name and which is nothing but my path 0 for that i can take df of file path where i'll get all the paths here and uh i'm interested in the uh zero and basically i'm interested in the zero zeroth element so here we go you can see that zeroth file path okay so now let me pass this file name here and after that get root you can get the root dot find in that root what element i just want to find here is file name find file name so that's it so if i find the file name and in this i just want to extract the text that's it guys so this is how i can able to extract the text so what i'll do here is that let me write down a simple function here so i can write down a simple function and limit ask for get file name in order to get the file name my input to this is file name and i just want to this is what will get the file name of image okay so in order to get so we have got the file name of this using the following uh following command we can get the file name but i just want the file path here instead of getting the file name i just want the file path of image because i just want to read it in opencv which where i can't give directly the file name i want to give the file path to it so in order to get the file path as we know that my images are there in this images folder so i just want to give the images path here for that i'll use os dot path dot join and let's set the path here the path is images so this is what the folder where my images are there and now just pass this file name to it file name image to it so that's it so what i'll do now i'll return the file path execute it now let's test this get file name of file name and as you can see we got our file name and also we got our respective folder now what we will do we will apply this function to all the file path that we have so for that let me take this df file name and dot apply we just need to apply this function and okay we just need to provide the file name here okay we already got the file name oh this is the file path it's not the file name this is the file path for this file path i just want to apply the get file name and execute it done now you can see that we got all we got applied to all the images and also we got the file name and also we appended the path to it so what i can do here is that i can simply what i can do here is that i can simply convert that into a list and uh here we go we got like you know this is what my images path so this is what my images are executed done so we have all the images part now in a list in the next lecture we will continue more on this thank you very much hello everyone welcome back so now what we will do in this lecture we will read an image and i will we test what are the output which we got is correct or not means what we try to do is that we will try to draw the bounding box which you have extracted on top of that to verify our images called correct bounding box so for that let's read our data or let's read our image first so let's read the image so we can use the cv2 to read an image so basically i'm trying to verify so what i'm doing here is that like you know verify image and output all right so let's read an image img is equal to cv to dot m read and just provide the name of the image so here we have like you know image path which is what my image path of 0 which will give you the file path file underscore path alright so this is what the file underscore path so let's pass it to our cv2 dot in read and as we know that this will read in bgr format and also what we will do is that let's try to visualize this so for that i can do like you know cb2 dot i can provide like you know aim show and we can show the image by just giving the this is what my example image example image and the array is img and now cv2 dot i can wait key i can put the weight key of zero and after that cv2 dot destroy all windows so if i press any button like escape or if i press into like it will charge to be destroyed so that's what the image that that was the settings have been set up now executed and here go we got one window let's click on this okay so we can't able to clearly visualize it so what i'll do let's press escape and let me write something here so cb2 dot and here it mentioned the name window and the window name is that example and the settings i want to provide is cv2 dot window normal so if i set this spa if i if i set the settings what i can do is that i can able to resize it let's execute it here we go now this is what the image what we have so let me uh resize this so that for the clear visualizations this is good like you know this is what the image and this is for this image let's see how uh i got the output so the aim output what we have is that like in the coordinates nothing but like you know x-men is 1 0 9 6 9 3 and x max is 1 3 9 6 six ymin is six four five and y max is seven two seven okay so this and all my values so what i can do now scroll down so this is what the actual coordinates of the bounding box so let's draw the bounding box so in order to draw the rectangle it is my i can use cv2.rectangle and for what image i want to draw a rectangle which is nothing but the same image img and we need to specify the two points these two points are the diagonal points so obviously we have the x min and x max and y min and y max so we can mention the diagonal points with respect to that so point one will be x-min and y-min so x-men is one zero nine three and y-min is six four five and similarly i can provide the x-max and similarly i can provide the x max and also the y max so x max is 1 3 9 6 and y max is 727 so this is what the points what we have and the color i just want to specify the color here so the color i can specify is green color so basically 0 255 comma 0 is a green color and the thickness is of 3 pixels so that's it so this is what the bounding box what we got so let me copy this code okay i can copy this code and paste here so that i can visualize my image in a window alright so let's execute it here we go and this is what the window and for this car this is what the expected output there you can see the green rectangle box which is nothing but the bounding box and this is what the box i'm expecting from the model and as you can see my my model has been sorry my data is correct i just verified if you want you can also verify for a few more images so we will continue in the next lecture more on this thank you very much hello everyone welcome back in this lecture we will see how to do the data preprocessing so let's import the libraries like train test split from sklearn and modules like load image image to array from tensorflow so let's import it scale on dot pre-processing sorry from dot model selection import train test split and also let's import like you know from tensorflow dot keras dot we have preprocessing dot image and we have the two modules one is load image and image to array execute it so now what i want to do basically i just want to load an image and convert that into array so this load module is basically used to set the target size basically which is what useful for the object detection models all right so first step what we will do is that let's get our output this means let's cut get our uh target values as you can see this is my what my target values the target values is x min x max y min and y max so let me take this and i just want only the target values in order to get that i can use i lock i want all rows and one column by this i can get all the values here in order to con in order to get in the in the array i can get i can give like you know y values and this is what my labels executed so in the labels i got an all the values in an array now let's uh do it for all the images so first before that obviously we know that like you know all the images are there in the image path now what i can do is that let me take the image path and this is what the first image is what i just want to take it here so i can pass it d0 in order to get the first image now let's uh read an image so cvt dot in read and i can pass it the array i can pass it the path image now what i can do is that i can get i can save that in an array is image array done so let's get like you know height and width of an image so we know that number of rows is basically define the height and number of columns will define the width of an image so h comma w comma d basically depth nothing but r g b which has depth is basically 3 for all colored images so i can use this in img underscore arr dot shape in order to get the height and width of an array now what i can do is that i can use this load module to set the target size so basically i'm using this for the normalization purpose so let's do the pre-processing by just setting the target size using the load module so here what i can do is that let's load uh image which is nothing but load image now what is the path i just wanted to load is image so the image is the part i just want to basically load it comma and here you can see that the target size is important for me so target size is basically used for the object detection model and we have the different models like inception mobilenet arsenate or the different models are there and all the pre-10 models which was developed for the fixed size so here i'm using the size of 224 comma 224 which is stable and most widely used size and now let's convert that into array so this is load image array and you can you can convert that image into array using image to array so i can use this image to array model so that i can convert that into my target size so what i can do i can pass it my lore image so that's it so here i can able to get like you know load image array and let's do some normalization to labels so in order to do the normalization to the labels what i can do is that basically i'm having the width and height so as you can see we have the labels and this is what the labels we have let me take the zero and this is what the corresponding labels and the let me take this first and in order to get this for the automation v i and d uh i can specify the zero and this is what my int so that i can get the exact index position of the label and the first one what you'll get is the x-men and this is what my x-max and y min and y max so this and all the values and basically i'm getting getting here now in order to normalize our data or normalize our models basically x should be normalized by the width and y should be normalized with the height so let's do that so n x min basically normalized x min and x max is normalized x max is uh is equal to x min divided by width x max divided by width and similarly let's calculate my y min and y min and n y max so in order to do that this is basically divided by the height and height done so now what we can do is that we can get the values so let's say like you know label norm basically normalized labels and that's equal to n x-men and max n y min and y max so this is what we have and we can able to get all the images let's execute it and we have like you know a label norm and where this label norm is consists of the like you know normalized labels and the load image array is what consists of our image so all right so we have like all the data has been available and we have normalized all the information as you can see here is that load image array and the values that was there in the load image array it is in the float values and the range is between 0 to 255. so in order to normalize this what i can do here is that i can divide a norm load image array and this is what the normalized load image array i can divide like you know the original array with 255 so this is what the normalization i can do it for norm normalization i can do it for my my input and this is for the normalized output so that's it so we have the data for the normalization for my input and the normalization for the output so done so what we can do is now is that like you know we can apply to all the data that we have with us so for that i can run a loop for i or i and d and basically i and d uh could be the index position so i can do like you know for i and d okay i can i n d n so this is what my image path so this is what the image path and how many times i want to generate it you can use the length of this so the length of this is 225 so let's do it for ing it's in range of length of my i think length of this image path and put a colon and let's maintain the indentation here let's execute it now what i'm going to do here is that i just want to append all my arrays and also all append all my uh input and also output so for that i can do one thing let me put a data and an empty list and also i can take it like you know output in in my empty list so i can append all the values so what i can do here is that data dot append i can open my knob load image array and also output i can append all my label knob so that's it let's execute it so it'll take some time and we'll continue the next lecture more on this thank you very much hello everyone welcome back in the previous lecture what we have seen uh is that we have did some data preprocessing so now what we are trying to do is that let's try to split the data into training and testing so before that so this is what the outputs what we got in the previous session so in the previous lesson what we have seen is that this is what the output normalized image and this is what the corresponding output all right so what we have is that we have the data and also the output in an array so what i can do is that let me take this x is what might convert that into array using np dot alright i can use simply doing that i can convert that into data into array and what i can do here is that let me uh put the d type you should be very specific in that and i can specify like you know np dot load 32 bit now also do it for y so we can convert that into array np dot array and this is what my data and here what you can see is that d type equal to np dot float and here it is floor 32 execute it and you can look into the shape of the x and shape of y and as you can see we have 225 images and each image is 24 by 24 by 3. and similarly for y oh it is not data this should be my output let's execute it execute it again and here we go we have 225 images and we have four outputs in this case we have the four outputs that is x min x max y min and y max so this and all the four outputs we have and basically we're trying to build some regression model anyway so first step what we will do in this select selection this lesson is that we will try to split the data into training and testing so we have already imported the module called training and testing i'll make use of this so first step is extreme comma x test and also y train comma y test and that's going to be equal to train test with module of just pass x comma y x comma y and my train size is eighty percent i'm just taking eighty percent is what my train size and rest twenty percent is what my test size and i can also use my random state to be something like zero now let's uh look into the shape of each and every array extrane.shape comma x test dot shape y train dot shape y test dot shape and here we go we have 180 training images and 45 test images similarly for the at white train it is 180 comma 4 and 45 comma 4. so that's it in the next lecture we will see more on this thank you very much hello everyone welcome back in the previous lecture we have seen how to split the data into two parts that is training and testing now in this lesson we will see how to train our deep learning model so the model that we are trying to use is mobile net so first step is that let's import few libraries so for that i can go to from tensorflow dot keras dot there are already the predefined models already there so i can use a predefined models from tensile flow tensar flow.keras dot application i can import there are a bunch of predefined models are already there the most powerful models are mobilenet and we can also use some other powerful methods like encryption models so inshaption v3 is also one of the most powerful model and also we can also use that inception rsnet v2 so all the three models are very very powerful model for particularly for the opti reduction so you can use any of the models for building the object object detection model so what i can do in this lesson is that we will see any one of the model okay first let's import all the necessary libraries also from tensorflow dot layers sorry from tensorflow.keras dot layers import uh we have required like no dense we want dance and we want to drop out and also we want flatten and that's it so this is what we want if anything we require we just import it and also from tensile flow uh we also input input we also now want input here and now from tensorflow dot keras dot models import model and also import uh some optimizers so for that okay just import tensorflow so that we can import all the optimizers so and just import tensorflow as tf so just important surplus tf and will require will import all the modules if at all anything is required all right so just execute it done so we have imported all the library successfully so in the next lecture we will see how to build the model in tensorflow hello everyone welcome back so in this lesson we will see how to tr how to build a deep learning model so in this case i'll use this most powerful deep learning model is inception arsenate v2 this is inception arsenal v2 is one of the most powerful model it's combination of inception and arsenic model so i'll just use this model and the using of mobilenet and inception v3 is also almost same as using the inception test so method the procedure is almost similar so let me take this most powerful model that is inception arsenate v2 so let me call this so this is what like you know inception underscore rs net and let's call this inception rsnet and now weight basically by default the weight is equal to image net let's use this weight physical we are using the same weight of imagenet model and after that let's see include like you know uh include top is equal to just set this include top flag set to false okay include include because of this include top just flag just need to set to flaws and i just want to mention like you know what is the input tensor so input tensor shape is input and the shape is basically equal to so let me put one enter here now shape is equal to it is 224 it means basically what is the shape of our image the shape of the image is 224 comma 24 comma comma 3 so that's what the shape of an image so that's it so the next is inception rsnet dot trainable i just want to mention like you know trainable is true so that's it so this is what i mean the trainable is basically false so means don't what i mean to say is that like you know don't change the weights of the image let's use this weights of the image if you want to train you can also use like you know trainable is equal to true so that like you know you can also change the weights of the image net but at the moment because i just really don't want to change the weight but i just want to change the weight of my neural network so this is what the inception model and the inception arsenal model you can use whatever the model you want you can simply just take this mobile network into place of this will work almost similar to that now uh the head model is basically and i just want the output of this so inception dot you just take the output of this inception rsnet now you can build whatever the neural network model you want you can also build the convolutional neural network whatever you want you can build that but here what i'll do is that i'll try to build the neural network so since this is what the convolution neural neural network part so what i want to do here is that i just want to first flatten our data so my head model sorry so my head model equal to i just want to flatten it so we already imported the flatten and just flatten it the input for this is from the head model again and the next one is my again the take the head model and let's take this head model and i just since remember like you know the output the final output of the neural network should be four because we have the four outputs are there so the final output of the neural network should be 4. so let me set the head output of this so dense and so the output is basically should be equal to [Music] 4 and the activation function and activation function of my neural network is sigmoid it will basically since i'm building some kind of a um output in in between zero to one so that's why that's the reason i'm interested in the sigmoid model and the basically obviously the output is head model so in between this two because this is the flattened one in between these two you can try to build any number of neurons if you just want to build you can build that okay so let me take this let me build one more layer on top of this which is what with let me take that dance and let me take uh 500 uh what we do what i'll do here is that like you know i'll check the 500 neurons and activation function for this is relu i'll use the value activation function and of course this is what my head model is what my uh the input to it and similarly let me also add one more layer just add the two layers here and this will become the three layer and now can see like you know head model here i can you i can just try to reduce a bit let's put the 250 just a half of this so that i can maintain the pyramidal shape now 500 and 250 so what we got here is that like you know 250 neurons and activation function is sigmoid so that's it so this is how i can able to build my uh neural network and we'll continue in the next lecture more on this thank you very much hello everyone welcome back now what we will do let's compile our model compile model so in order to compile the model what we need to do is that we need to define what is the learning rate and uh what kind of optimizer we want to use and also what is the loss function so for that let's take this model dot compile and just specify the loss so the loss since it is a regression model again go for mean square error and the optimizer that i just want to use here is there are a bunch of optimizers out there i can you go for the atom optimizer so dot adam optimize optimizers dot atom optimizer and i can specify the learning rate to be as small as possible i can give one e4 so by default default learning rate is 0.001 i can just mention it is to 1 e minus 4 is a very small learning rate i can specify it so let's look into the model dot summary so model dot summary execute it i think so yeah so executed so this is what the inception model inception architect model which you are trying to build so we start with input 224 between diver by 3 and the convolution 2d it is will get like 111 and so on so this many layers we're trying to build very big layer and so it's very very big neural network is what we are trying to build and at the end so and at the end what we have is that we have developed the four um this is what we actually added here so this is what the uh flattened one is three eight four zero zero and after that we added the two dense layers 500 to 50 and this is what the output so this is how like you know this is what the model that we have built now in the next lecture we will see how to train our inception arsenate v2 model hello everyone welcome back in this lecture we will see how to train an object detection model so in the previous lecture we already see how to compile the model and now let's see how to train the object reduction models so first what we will do let's import tensorboard so from kit from tensorflow dot kras dot callbacks import tensorboard now let's create a variable tfb equal to tension board all right so what we need to provide here is that we need to provide the log directory so the log directory that i'm going to provide here is object detection so what are the log files that is being stored in the object detection folder execute it now let's fit our model so let me store all the variables in the history history equal to model since this is the model where i have compiled so model dot fit what we need to provide here is x x is nothing but x strain y is nothing but y train and batch size so what is the size of the batch that is going to provide and a box verbose and the callbacks obviously going to provide the tensorboard and validation data so let's provide one by one x is equal to x is equal to x-ray y equal to white ray and we require the batch size you can also provide whatever the batch size you want it's a purely depends upon the batch size so what we can do is that like you know you can provide the batch size at something between less could be 10 or 20 it depends upon the speed of your computer and after that you can provide the epochs so folks let's provide the 100 epochs and after that validation data so this time i'm providing the validation data is what my x test and y test x test comma y test and finally we will provide the callbacks so callbacks is the tfb so let's pre let me put that in the list and it is a denser board so that's it so what we'll do let's execute it all right my training has been started usually it takes the at least three to four hours depends upon the speed of your computer and if you got some issue like you know memory error or something like this so what you do you try to reduce the batch size instead of 10 to probably some five or six and try it so we will continue in the next lecture once we're done with our training process thank you very much hello everyone welcome back in the previous lecture we have seen how to train the model and i completed the training process it took me around the three hours to complete this process and as you can see we started with the loss of 0.1078 and with the by the end of the 100 iterations and which i got is 3.6833 10 to the power of minus 4 and the validation loss is also less is 0.0060 and what i can understand here is that like you know uh migration is coming down and after that it looks quite stable and after some iterations it's keep on coming down and what i can understand here is that like you know epoch number 100 and probably if i run it for more and more iterations what i may get like you know i might get still less loss so what i'll do now is that instead of uh stop the training process at 100 i'll run the model for 100 iterations so let's see whether my loss is changing or not so in order to do that what i can do i can copy this and i can paste it here so i'll just mention like you know the epochs that i want to start uh end with 200 in the same settings but here i just want to mention the initial epoch so since i already trained 100 iterations and i want to start with the epoch number 1.1 so in order to mention that those thing i can set like you know initial epoch instead of 0 and set it to 100 or i'll just basically i'll set that to uh 101 so i just want to set with initial epoch of 1.1 all right let's run it for one more hundred epochs and we will continue after that thank you very much hello everyone welcome back in the previous lecture we have retained our model and we started our iteration at one zero one it is found that model has been stable at a certain value of loss so what we will do now is that let's first save our model so since this is the model so what we will do first save our model so before that what we're going to do is that so this is what the folder which we are here and let's create a one more folder and name it as models now what we will do let's save our model in the models folder for that model dot and we have an option called save and i just want to provide the path at which i just want to save and here you can see that like you know i just want to save in models folder for that let's create the path it was dot dot stands for local in path and let's provide the name of the file that you want to save here and the name of the file i just want to provide here to know here is let's say object detection dot h5 so this is the name of the file that i just want to save so what i'll do execute it let's wait for a few seconds until it gets saved i got an error says that like you know unable to create a file uh let's check the name of the folder okay the name of the folder is models all right say models and let's save again done so we have saved successfully you can check that you can go to your home and models and here you go you can see that like you know the model is object detection dot h5 and the size of the file is 451 mb so this is how we can save our model successfully in any folder in the next lecture we will see how to load this model and do some operations with this model thank you very much hello everyone welcome back in the previous lecture we have seen how to trade our object detection model and also we have seen how to save the log files using tensorboard and here you can see that we have saved our log files in the object deduction folder so let's see how to open this log files using tensorboard so for that the first one is what you need to do is that you need to open the anaconda prompt and set the path so for example i open the color prompt i need to set the path and copy the path where exactly you have been uh where exactly your current working directory and the cd space and give the path now i am in the current working directory so uh what i need to do is that let's write the following commands to open it so tensorboard hyphen iphone log directory and that's going to equal to object deduction so update object deduction is what the name of the folder which is what i created so you can execute this wait for a few seconds until your command has been successful all right you can see that my command is successful now and as you can see once it is successful you can able to see the uh url here you can see the url it is http localhost 6006. now open your article open your browser and enter the following url so the url here it is localhost 6006 execute it all right now you can see that we have opened our density board successfully and you can see the three tabs scalar graph and time series and what our major interest here is that like you know a scalar at the moment here and you can look at the scalar here what you can see is that uh this shows like you know how your epoch loss uh how your loss is varying with respect to different epochs and you can click on this button to enlarge this and you can see that we have like you know orange color is a train and blue color is the validation set and now what you can see here is that like you know we don't have any overfitting behavior and we found like you know it's a nice and clean and our even my loss is also quite less and that's fine and also you can also look into lower like you know graphs and also look at the time series uh time series will basically define like you know uh what exactly how exactly your validation loss is going to be i think like you know the graph will basically has like you know the a graph graph of your object action model i think i'm not interested in that and if you want you can interest if you want you can look into that graph and it will take like you know usually longer time to load it at least like you know which have to wait for 10 to 15 minutes to load the graph because the graph it is very big and it is 450 megabyte so in order to load that it takes a lot of time okay so what i can see here is that like i can see clearly how my loss is varying with respect to epochs and uh it's clearly like you know it's a good model and we have like a very very less losses obtained with this object detection model all right so we'll continue in the next lecture more on this thank you very much hello everyone welcome back in the previous lesson we have seen how to train our model and also we have seen how to save our model in the project format now in this lesson we will see how to load the model and also make predictions with that model so first step what we need to do is that we need to import necessary libraries like numpy opencv tensorflow so let's import all the necessary libraries first step let's import numpy snp also import computer vision we'll also import matplotlib dot pi plot as plt and also import tensorflow sdf execute it now also import what are the necessary libraries that was used to build the model like we required for the pre-processing what we required is that we use the tensorflow.keras that pre-processing an image and the load image and the image to array so this is what is required for me so what we will do let's also import that library so from tensorflow.keras.preprocessing.image let's import load image and image to array that's it so now what we're trying to do in this case is that first let's load the model and we will have some we'll take some test images and for the test images let's see how the bounding boxes is being drawn by the model so as we know that our as we know that our oven model has been saved in the models folder and the name of the model that we saved is object detection dot h5 so this is what the name of the model which we have saved so first what we will do is that let's load the model using tensorflow so for that load model now model equal to i mean uh we can use tensorflow dot keras dot models models dot load model so we can take this load model module and just provide the path of this so in order to provide the path the path it was there in the dot models and object detection dot h5 and print model loader successfully execute it all right so my model has been loaded successfully it took about a minute for me to load this model okay so now what we need to do is that let's take some images so we have some test images with me and this is the test images that was there with me so now let's take some test images and for example let's take this n207.jpg and this is what the test image which i'm having with me now what i will do is that if i pass this image to my model and model should return the bounding box so that's what an agenda and that was an idea so let's see whether a model can able to detect the bounding box or not so first load this image all right let's load an image i can um i can use the module called load image and you can use this load image module to load an image so for that let's load an image and this is what an image and having the load image model and basically this load image model using the pill to load the image in an object so let's provide the path to it the path it was in my okay let me do let me do one thing let me cover the path equal to it was in my uh test images and n207.jpg so this what the image i just want to load now and execute it just provide the path and as you can see we can execute that and obviously like you know in the previous lecture you have seen like you know we have loaded we have set the target sizes 224 comma 224 okay so we can also do uh in that way also we can also provide the target size and we can we can also do in that way too but what i'll do is that like you know since i just want the original height and original original weight of that array so what i use is that i just use my i just simply set the touch target size to run now let me take like you know image one and this time i'll set the target size to 284 by 24 which is actually i use that to train my model so for that what i'll use is that now let's provide the path and let's set the target size to this time to 224 come out to 24 so that's it so this is how we can set the target size to 24 by 24 which is what we used in the training process and after that what we did is that like you know we convert that image into array so we can simply convert that image into array let's say image arr and that's what the 224 by 24 image and that's going to be equal to image to array i can use this image to add a module and image to array and just pass the image one all right so what it will do now is that like you know it will convert that image into array and that is what is being stored this and while doing this process i can also do the normalization just like we did in the training process so now i can able to get the normalized value so this is what convert into array and get the normalized output got it now the next step whatever to do is that we just need to look at the shape and then pass it to our machine learning i mean deep learning model so before that let's look into our image so this is what an image and what i want here is that like you know for this image i just anyway i just want the height and width of this so for that uh just let me take this image and convert since i read the image in the in an object so that's what we pull object so in order to convert that into array i can use np dot array and which will basically convert that into array and image so what it'll do is that like you know it will exactly convert that into array now change the data type to np dot unit 8 bit i mean unit 8 which is what indicates that this is what water 8 bit array 8 bit array and the range of values between 0 to 255 all right so i think it's done let's execute this done now let's look into the size of our original array print size of the original image so i'm just looking into the size of my original image so that's nothing but i am a image dot shape so first what we'll get is a number of rows in columns and depth rows can be defined by height and the width can be defined by the number of columns and anyway depth is 3 and that is rgb and obviously i can print the height of an image of the image is hatch and print width of the image is w all right so let's print this and yeah comma yeah so now we can see that the height of image is 423 and the width of the image is 541 so let's visualize this image in order to visualize this image we can use the matplotlib dot m show and what i can provide is the image in plt dot in show we can i mean dot show starting show it's pr dot show and will give you the image perfect so this is what the image what we have let's increase the figure size plt dot figure fixed size and let's say since it looks like 10 comma eight so i can get like another big matrix so this is what the image that we are dealing now we will continue in the next lecture on the part 2 of make predictions thank you very much hello everyone welcome to part two on make predictions so what we're doing now is that like you know we identified the height of an image and also the width of an image so the height of an image is 443 pixels and the width of the image is 541 pixels so that's what we identified now now i think everything is being good so this is what an image array to the depot is what my interest so i and it also looks it's also the normalized one and the next step what we did is that like you know we need to look into the shape of that so let's look into the shape of my image array 24 by 24 by 294 and it looks like the image array shape is 224 comma 24.3 that's really good but in order to pass this image to a model we need to provide the data in the four dimens fourth dimension format so instead of providing that like you know width and height and depth we also want one more dimension it's a number of images so so what we want to do here is that we just want to reshape that into one comma 204 comma 24 comma 3 and what one indicates is the number of images so here we just passing only one image so those kind of information we need to provide to an array so let's say it's a test array and it's nothing but let's take an image at a 224 and dot reshape and i just want to reshape that into one comma 24 comma 224 comma 3 so i'm just increasing the dimension so the meaning of that is that like you know one indicates basically the number of images and each image is 284 comma 24 comma 3. so that's it so this is what basically my interest is so let's take an array dot shape and let's see whether it is got reshaped or not done so we have reshaped our array successfully now now now we can just pass this to our model to get the output so let's make predictions so how to get the predictions it is simple like this is my model so let's call the model model dot predict and what you need to provide here is that an array so test array is what i just want to provide here and this is what my coordinates and what is what it will return is that the coordinates is what like you know is going to be it means uh what is the coordinates of my uh vehicle is what returned by this by this uh model let's execute it and let's also print this values at cds and uh done so we have got the output from the model and output is 0.4 0.6 0.767 and 0.73 the output what we got is the normalized output so what we need to do is that we need to convert back into our original values which actually uh we did in during the training process in the training process we have the original values and convert that into the normalized one so we need to do the exactly the same thing now so we'll continue in the next lecture on how to denormalize your output thank you very much hello everyone welcome back in the previous lecture we have seen how to get the outputs from the model now and as we see als as we also see that we got the output in the normalized one so how now in this lecture what we will see how to denormalize this and if you just go to our previous lecture on the training and then what we did is that you can see that our data our output is being divided by width and height with for our x min and x max and y min and y max respectively so that we can get the normalized one and also you can see that our label norm means the order how it is got is means it is x mean x max y min by max so now what i want to do here is that in order to get our original form i just want to multiply with their original height and original width so that's what i just want to do so here what we have is that this is what x-men and this is my x-max and this is my y-min and this is my y-max so what i do here is that i just want to multiply the first two values with the the width of an array and also i just want to multiply the next two values with the height of an array because x consists of the width and height consists of the y so now let's do that so let's denormalize it so so obviously the first two values are um the x-min and x-max i just want to multiply them with width so width come up width and the next two values with the height comma height so now what i'll do i'll just convert that into array done so this is what my d norm now what i want to do here is that what are the core coordinates i got i just want to do the element wise multiplication with the demo with the dnom so let's talk about my let's see like towards my coordinates and that's going to be equal to coordinates into d norm and let's look into my coordinates now and here we go so we got the values now uh in the denormalized one so 0.4 is being replaced by 218. so what about what exactly we did is that 0.4 into width of an array the width is 541 and what we got is 218. see i generally i just really don't want my values to be in the float i just want my values to be in integer so in order to do that what i'll do i'll just convert that into the integer so coordinates and change the type data type as type is what my np dot um 32 just converting the data type here and you can look into my corners now and we have 218 336 284 and 311 that's it so we'll continue in the next lecture more on make predictions thank you very much hello everyone welcome back in the previous lecture we have seen how to deal normalize your values now what we will see using the d we using these values let's draw a bounding box means let's see now drawing bounding box on top of the image all right so this is let's see how to draw the bounding box on top of this image so the image is image let's take this image and what i want to do here is that i just want to draw the bounding box on top of this so for that in order to draw the bounding box i can use a computer vision library to do that but here i just want to provide the two diagonal points the two diagonal points is pt one e which which is basically my the point one and the pd2 is what my point two so this should be basically my x-men comma y-min and this should be my x-max comma y-max so this isn't this is what the points i just won here and uh from the cornet this is what my x-men and this is what for x max and this is my y min and this is what my y max so let's uh get the values like x-men is basically or i can take like an x-min x max y min and this is what my y max so that's going to be equal to let's take the coordinates of 0 and we'll get the first row here and all the and all the values is being separated something like this so you can also print like you know pt1 and the pt2 so that you can get those values so x-men which x-mean and y-min so this is my x-men and this is my y min and this is what my x max and this is what my y max so that's it so we got the values now let's print those values now let's make use of these points and let's uh draw the rectangle box using cv2 i can use the cv2 dot rectangle and what i want to do here is that let's print an image for what image i just want to draw the rectangle and that should be image and what are the points pt1 and pt2 my points are 51 and my parts are pd2 and the color i just want to do draw in this case is that uh let's take the green color 0 255 0 see what are the color you want you can draw it doesn't matter now thickness thickness of the line i just want here is 3 pixels so that is what the thickness of the line i just want to drop so that's it so what we can get from here is that we can able to get a nice bounding box so in order to visualize this what we can do is that let's say uh let's take the let's copy and paste this so plt.figure and ted comma 8 and plg dot m show of image and plt dot show let's execute it all right here we go we got the values this nice bounding box this is what the model has been predicted model predicted that nice bounding box it says that uh so it says this is what the number plate is really cool right now so in order to get like you know more and more accurate predictions and what you do is that we need to train for more and more images so what are the images we train is just 220 or some some odd number of images and if you want to train with a very good accuracy and if you want to get your output to be really really really really very good accuracy and you need to train with at least 1000 images so that you can get a good accuracy of the model alright so this is how we got the bounding box we will continue in the next lecture more on this thank you very much hello everyone welcome back in the previous lecture we have seen how to draw the bounding box now what we'll do let's put all together and create one pipeline model so create pipeline all right so let's create the pipeline what do you do is that just exactly copy paste all the necessary functionalities in one code that's it so let's copy this and i just want this now all right we also want the predictions i mean we just also want the reshape we also want to make predictions and denormalize and also changing the data type and finally the rectangle box so this is what the pipeline basically if you're interested now all right so so what we'll do let's create a function and the name of the function i just want to create here is object detection and the input for that is basically could be the path some path of an image is what the input to this and the output will basically return the object action for this select all and press tab now we can get the indentation now what are the necessary things let's put under install we can remove this i just want don't want this my uh test editor shape and i just don't want to spin this make predictions and we got the uh we got the predictions and after that we need to do the lead normalize and change the data type so this is one part and let's see let's play this is what we can read image and this is some kind of a preprocessing and now this is the make predictions and denormalize and this is what drawing the bounding box so that's it so this is how we can able to do that and and after that what we can do is that we can we can show or can print whatever so i just want to return i just want to return my image okay and also i just want to return my um coordinates because coordinates also for given image and what is the coordinates of that this is also really important so anyway so we got an image and we got the coordinates now and execute it now what we will do let's call this function of the detection and this time i'll give the different values of path and let's see what what is out what we are getting here now here anyway i got this i am hge and i want the i will get the coordinates and if i pass any image to this and i'm getting image and it will get the coordinates so what i'll do here is that let me uh print the images let's say let me show the image so let's copy this and paste it here all right so if i execute this let's see maybe take some time and we got that but that's it so let me also test for the few more images and i'm since i got the friend side let's also let's look into the back side of the image so probably let's say check this 147 and 147 execute it done yes it's because we really got that but even what's okay like you know some part of the portion is not cut uh see that's what the point here is that like you know if you train with more and more images instead of less images and different possibilities you will get really really nice bounding box anyway but with with very very less data we can also able to get such a very good accuracy i mean such a very good precision all right so that's it about the make predictions in the next lecture we will talk about the optical character recognition means how to extract the text from the image until then happy learning hello everyone welcome back in this lesson we will see how to install tessarat ocr tessarat is one of the most popular and powerful optical character recognition software that is used to extract text from the image tesserato cr is also having python api and using that you can also extract text from the image and it is more importantly it is an open source and the free to use so in this lesson we will see how to install tesserat ocr so for that you need to go to google and go to the url which i given to you in the description so go to this url and as soon as if you go to this url and you'll get one pop-up and you please download the software something like this so click on save all right now tesserat has been downloaded successfully so what we will do you can see that this is what the dot exe file that i was downloaded by me so what you can do is that right click and run as administrator and install the software so click on s and click next accept the terms and conditions and install only for me it's not for everyone just for me and this is important that the destination folder or designation of the folder this is important for me what we will do just copy and you can open your notepad and paste it here for a moment now click on next and of course you also install the tesserat development files and click next and install done now i have installed successfully so what i'll do i'll click on next and finish that's it this is how we need to install tesseratocr now what we need to do is that we need to set the environmental settings usually the software itself will set the environmental settings but most of the cases that software will fail to set the environmental settings so for that what we need to do is that go to your pc and so this is your pc and right click click on the properties now go to advanced system settings now in the advanced term system settings you can see the environmental variables click on environmental variables so now you are in the environmental variable so what you do is that you need to set the path so you can see in the user variables there is a path is there variable name path is there you can click on this path and please don't delete it or don't click on new and just click on edit and here you go this and all the environmental settings that was there with me and uh this is what the path i just want to set and in order to set the path so this is what where exactly you need to pass the designation folder and this is what my designation folder so you just copy it and as you can see there is already the path is already created by software if this if you can't see such kind of a path then what do you do is that just click on new and paste it and click you need to click on ok since i already since the already uh the path has been set so i just don't want to set the path again and what you do just click okay okay and okay done that's it so this is how like you know you need to install tesseract ocr in the next lecture what we will do we will see how to install python api of testdraft thank you very much hello everyone welcome back in the previous lecture we have seen how to install test.ocr software now let's see how to install pytaserat tessrat api which is pytaserat for that what we need to do is that you need to open the anaconda prompt as an administrator anaconda prompt and right click and open as administrator now type the following commands pip install hyphen iphone upgrade python execute it wait for a few minutes until your installation has been completed all right i have installed successfully since i already installed this uh uh python before making this video so so that's why it says like requirement already gets satisfied for you it might get some time to get installed so done so what we need to do in order to check whether my installation is success or not let's open the python shell now import pi tessrat done so if we got the fighters rat without any error or warnings that means that you have installed python successfully in the next lecture we'll talk more about optical character recognition thank you very much hello everyone welcome back in the previous lecture we have seen how to install tesseract ocr so what we will do now is that we'll apply the pi test.ocr to this image and let's see like you know we can able to extract the text from the image correctly or not so what we will do is that like you know let's make this code online like make predictions which which we have so let's make the code online by go to cell and click on run all and if you click on run all it will run all the cells now what we will do let's import pythagoras and let's extract the text proper image let's import pythestrat as pt execute it now what we need to do is that so let's use this function that is object detection function and let's copy this and let's paste it here so what i'll do i'll use this image which is uh n207 i use that particular image and let's extract the text from that and do and as soon as i execute this and what happens here is that this object detection will return me an image and this is what the image which is what it returns and at the same time it will give me the coordinates means the coordinates means my diagonal position x min y min and x max y max so this is what i can get from this image so what i can do here is that i just want the coordinates and also let me read the image here so you can read an image obviously from uh you can you can cut you can read the image using the library or using the module load image and convert that into array so let's use this so what i'll do i'll take this img and let's use this load image and the path that i just want to load here is this this is the path and convert that into array using numpy so that's it so what i can get here is that i can get the image now what i want to do is that i just want to crop my bonding box so since i already know like know exactly my bounding box using that let's crop an image so how to crop it so basically uh this shows that like you know you're my x-men and uh and wyman so this is like a 218 and my min is 284 and at the same time this is what my x max and y max so using that what i can do is that like you know i can easily extract my i mean crop my image so obviously just try to remember here is that like you know rows is basically my y and and columns is my x so let's crop an image which is nothing but roi nothing but region of interest and which is my image and obviously i know that this is what the coordinates which i'm having with me let's print the coordinates here and let's see this is this is what basically my coordinates so it is coordinates let's take the 0 and 0 is what basically my coordinates and obviously the first one is what my x x-men and this is what my x max y min and y max so this is what actually i'm getting here so let's copy and paste it from the corners so now in order to crop it what i need to do is that i just want to provide my my index position so y min to y max and also x min to x max so that's it so now what we did we successfully cropped our image so let's play let's plot it plt dot m show of roi and plt dot show execute it perfect now what we can see is that we can able to extract the image perfectly so this is what the number plate and this number polite i can able to extract it now what i'll do i will use this pie test rat and extract the text from the image so let's extract text from [Music] image so in order to extract the text from an image i can use the pitus rat and pt there is a module called image pt dot and there are different modules out there that is image to string this is what the module i am interested now so what i'm going to do i just need to provide an image that's my roi that's it and as soon as it will provide this let's get the text and here you go we got the text it is mn2 e double e d uh i think we missed this but it's okay d 943 perfect this is what my text and you can print the text obviously we did not get the proper text but at least you can able to get like you know 90 percentage of image information correctly so maybe the few information like mn and probably this should be the like you know zero i know that and we're using some validations and we can easily extract the proper text from an image okay so that's it guys so this is how we can extract the text from an image so we will continue the next lecture more on this thank you very much hello everyone welcome back in this lesson we will see how to install visual studio code visual studio code is developed by microsoft and it is an open c or open source ide so in order to install that just go to google and type visual studio code and click on the first link which is the official website of visual studio code now download the stable version of visual studio code so the current stable version is this so i'm just clicking on this and as soon as you click on that you can see like you know the pop-up will come and you can save whatever the place you want currently i'm saving in my desktop and save all right done so let's go to desktop all right yeah now it is downloaded successfully now go to desktop you can see that you can find the dot exe file what you have to do just right click and run as administrator all right now accept the agreement click next now what you do just follow the follow the instructions and whatever you want install you can install it now just click next so what are the default settings is there you just make sure you have the default settings and click next and install all right we have successfully installed visual studio code and finish now we haven't successfully installed the visual studio code in order to run our project and we need to install few plugins so in order to install few plugins what you can see is that there is extension is there please click on the extension and you can see there are a few uh extension which is already installed by me in the previous version so what do you do here is that also you please also install the same extensions what i used okay so for example this is all in all auto complete is very much useful so that it is just auto complete your code and also install the anaconda extension pack this is also with very very useful and after that bootstrap 4 because in order to write css for that like you know bootstrap 4 is very useful and after that django yeah django so you can all you also install please install the django and so how to install the django what you need to do is just type the django here in your search and here you go you can get like you know the first url or whatever so you can click on that and can install it since it is already installed my previous version so that's why i got this and also we required so and django and also please install the html boilerplate so which will automatically gives you the html and uh h and html snippet so html snippet is also really useful so you also import the flask so you can type the flask here and please also install the flask snippet so these are all like you know fuel extinctions which are really required to build the project and make it really makes us a job really very very easy okay so we will continue in the next lecture more on this thank you very much everyone welcome back in the previous lecture we have seen how to install visual studio code now in this lesson we will see how to create our first flask app so now what we will do let's open our visual studio code you can go to your search and type visual studio code yeah so this is what the visual studio code so you just open this visual studio code so from here on what we are trying to do is that we are writing all our code in this ide so now you as soon as you open this you can see the open folder so click on this open folder so just navigate to the path which folder you're just trying to open for example i'm working in this current working directory module 3 web app now set the path so this is what the folder i just want to currently working on so select the folder done so as soon as you set the folder so what are the files that was your that was there it appears since my folder is empty so that's the reason like no no for no files has been there so now in this lesson we will see how to create a first flask app all right before creating the flask app what we need to do is that open your anaconda prompt and install flask so in order to install the flask we can use pip install flask execute it all right since the flash is already installed for me that's why it says requirement already satisfied and for your case it will get installed maybe a few libraries might get downloaded from the internet so once you once the flask is installed successfully now what you do is that just navigate to the folder of your current working directory so series space and this is what the current working directory was more in this so just set the path now just clear everything alright so we are in the current part now all right now let's create an app for that right click and click on new file and name the file whatever you want in my case i'll leave my file as app dot phi now i am in the app.pipe so let's import the flask from flask import flask now let's create a get paid interface means web server gateway interface so let's create a web server gateway interface so which is nothing but app it's nothing but flask androscan underscore name that's it now let's create our first app so df stands for user defined function and i can name it to my function as index and when after that let's return hello world okay now let's create a decorator because we are trying to running in the flask web server so for that let's create decorator so decorator is nothing but my app so app.creator root app.root and we just need to provide the url rule so nothing bad like you know what is the page you want so by default i'll give my the the pax backslash which is nothing but the home page now let's run the app so f android sql underscore name android underscore double equal to underscore underscore main then run the app so app.run and that's it so this is what we are trying to do now so this is what the simple flask app so in order to run the flask app what we need to do is that uh so as soon as you need make sure you set the settings here with the anaconda prompt and my flash file i mean my app is there with with an extension app.pi so now what i will do let's run the app so python app.pipe execute it so done now you can see that wsgi is been running wsgs stands for web server gateway interface is running and the url that is being running is the local host and with the port number 5000 by default the port is 5000 and now just open this open your browser and i just go to my incognito mod now let's type this the url that is the being given is 127.0.0.1 colon the port number is 500 5000. let's uh run this that's it this is how i can create a simple a web page with the flask and the text is hello world whichever the tech whatever the text has been passed i can get the particular text so we'll continue in the next lecture more on this thank you very much hello everyone welcome back in the previous lesson we have seen how to create our first flask app now in this lesson we will see how to render html template so now what you have to do is do is that like you know let's go back to our folder let's create a new folder and name it as templates so this is what the template folder just created and make sure like you know you use the same name which is templates and if you use some of the names it won't work so make sure like you know you create a folder with the same name now inside that uh what we will do is that like you know we will create one html here okay so so let's go back to our visual studio core and here we go you can see the template folder is already uh already came now right click here right click on your templates folder i'm sorry right click on your templates folder and inside that you create a new file and the name of the file i just want to create is simple layout layout.html okay so this is what like no simple layout.html is what's created by me and by default you can see that language that was set by me for i mean by the visual studio code of my is django so what i want to do is that like you know you can change the language here by click here and the type the language is html so this is what the html language i just want to configure so that's it now you can see that it automatically gets configured now whatever you can write you can write it in this so now uh let's try the html and since already the boiler put boilerplate is been installed so i can get this and you can get like an html5 xml all this thing so by default you can it will basically uh set you all the by default settings i mean default template like you know you have the dot string you have the head and you have the body something like this so now what i'll do i'll just do the simple modifications here and the modifications is number plate ocr so that's the title i just want to create a simple title with the number platosia and and what i want here is that like you know let me uh create a head one h1 and head headphone tag and nothing but this is what like you know number plate ocr that's it so number plate ocr or you can write down like you know optical character recognition okay in the bracket you can make sure it is an ocr so that's my header tag and if you have any paragraph information what's your project is all about you can also give the information about the project also so say it's like you know it you can take the you can feed you can you can write so you can write something about your page it's okay so whatever you want you like you know you can write something like you know uh saying like so this is the project which uh takes image as an input and written number plate i mean written like you know the license plate number or you can return or extract number license plate plate text so this is what like a simple page i just want to create here so and what we will do let's open this and this is what the simple layout.html which i created and just open this and this is what the layout.html which is what i just opened with the um but just simple but just just enter just double click if you see if you simply if you simply double click that you can get this but now i just want to render this template using the flask app so using this app what i want to do is that i just want to render the template so for that we have the flask and the one word module is there which is very useful it is called render template in flask we have the render template and you can use this render template and what i can do i can simply um i can simply create a one more url saying like you know app.root and just mention that you know one more uh uh page let's say this is what my home page just mentioning what is that like you know now it is index or this is all we can simply name it as the home and return what is it surrender template i'm sorry return render template and the render template is just provide the name of the html and the name of the html is layout.html so that's it so now what we will do is that like you know you need to run the app here or else we can also set the debug equal to two so if you specify the debug equal to true so every time you make some update in your flask app your code will get automatically get restarted so let's restart your code restart your wsgi so let's close it ctrl c to close it now again we just run the command python app.pi execute it so done so now what we have we got our url back which is the same url with the port number now execute this now now refresh this done now what we will do since the page i have created is the backslash home you can go to the backslash home and that's it this is what the page which i created nothing but my layout.html so like this you can also create n number of urls and also you can also specify the n number of html templates to the flask app so we will continue the next lecture more on this thank you very much hello everyone welcome back in the previous lesson we have seen how to use render template module to render any html and also we have seen how to create a root now in this lesson we will see how to import bootstrap so let's go to google and entire bootstrap and click on the first link so this is the official website of the bootstrap and you can also look into your docs click on these docs and here you go you can see like you know the documentation of the latest bootstrap version the current latest boot bootstrap version that i'm going to use here is bootstrap 5 so what are the current booster version that was there for you you can use that current bootstrap version so in my case it is bootstrap 5. so you can also see the all the previous versions of the bootstrap file like four three and two anyway so what i'll what i want is that i know i'm just currently using the bootstrap file so in order to import the bootstrap file either you can download it or you can use the straight away urls like you know there is already the mini dot css is already there so we can use a you can just simply copy and paste it in your html so that you can get the bootstrap so for that what i'll do i'll just simply copy this and just go to your template or layout and here below title in the header tag you just paste it so this is what the boots this is what the url which i copied from the bootstrap website and this consists of bootstrapmin.css and also let's import the javascript so this is what the javascript so let's copy this or you can simply click on this clip copy to clipboard now go back to your visual studio code and what you do again you just simply paste it so that's it so now what we have done is that like you know we have uh we have the bootstrap and also we have the bootstrap.css and also bootstrap.js has been there so that's it this is how we need to import a bootstrap and in the next lecture we will see more on this thank you very much hello everyone welcome back now in this lesson we will start creating your website so what we will do let's go back to your layout so this is the layout what i'm having with me so let's start creating our website by beautification it using bootstrap so what i'll do anyway i just don't want this h1 and h2 now what we will do let's create the first tag which is my now and the inside that now the class is now bar i'm used i'm just using the bootstrap class here so navbar and i just want the background to be dark and my text to be the darkest mode so for that nav bar and it is the dark and the background that i want the background to be done so that's it and the next one is that like you know inside the navbar let me create one more do and that is my class and the class is container and uh just create simple anchor tag and by default i'll just take the href and of course like you know of course even though if you click here it should go basically this is something like you know the icon or some kind of a home page so if i click on this it should go to my uh the home page something like this so now let's set the class the class is navbar brand okay so inside that let me create some text and i'll just use the h1 tag and the text is number plate ocr okay and let's set the class so there's another class is coming from the bootstrap display iphone 5 save it now go to your web page and here you go and of course like you know my layout is basically in the home so what i will do just remove everything this i don't want this index page anymore and anyway i'll just change this is to my index and by default i'll just route this to my home page so so this is what i'm having with me so what i will do now is that like you know um i will go to my webpage and refresh it so that's it so this is what i got and this is what my um the nav bar and the text inside that is the number plate ocr if i click here like you know it individually will again will get here so if you want to reduce this size so what you can do is that like you know you can use the display size just function six so and save it probably i can even refresh it i think this is good now you can see that this is my navbar and this is what my navbar brand so we will continue in the next lecture more on this thank you very much hello everyone welcome back in this lesson we will see how to create a footer in the previous lesson we have seen how to create a navbar now we will work on footer so in order to work on footer let's go go back to your layout and here let's type the footer and this is footer tag is basically the footer and what i'll do here is that inside the photo let me create a tag hr is basically stands for horizontal line so this is what my horizontal line and after that what i'll do here is that let me create a simple anchor tag and i can give whatever the url you want and for my in my case my url is http which is my website www.or http double colon double slash is the data signs anywhere dot com and you can give the name for the website something like you know data science anywhere so that's it so this is what like you know you can say simply set the footer okay so let me put some comments and just mention that it is the footer and this is what my navbar so this is what my navigation bar so let me save it now what i will do i will just go back to my browser and refresh it and here you go you what you can see here is that like you know you can look into the footer and this is what my navbar and this is what my footer so we'll continue the next lecture more on this thank you very much hello everyone welcome back in this lesson we will see how to use the template inheritance in flask what we will do is that like you know we will use this layout.html as a layout and we will create one more html nothing but our index.html and we will write all the functionalities in index.html let me do one thing let's go to templates and right click and click on index.html so let me put it this is a it's a blank now let's uh go back to our layout.html so here what i want to do here is that in between navigation bar and the footer i will create a block body block so for that let me go to my jingle now i'll write down the ginger to template format to use the inheritance of this so what we will do we will block the portion of this for that let me use the block body block and this is what the block and whatever the block here is body so this is what the body i just want to block here so that's it so now what we will do let's go to our index and in the index let's extend it extend and we just want to extend the template and the template i just want to extend is layout dot html done and after that what i want to do here is that let's again use a block block body block of course i just want to block the body and and of course i just want to use the body now what i'll do here is that i'll write down all the functionalities here for example i'll just try to write down what i'll take one more do so let me change the language to html and the language to i just use a do and inside the do let me create a class is container and write down my h1 tag saying like new you or in index dot in html so that's it so now what i'll do here is that let's go back to my app so instead of calling this layout.html what i'll do i'll just call the index.html and save it now go back to your browser and we will refresh it so what we did literally is that like you know you use a template of the layout.html and you're writing all the functionalities in index.html that's it that is what you're doing here okay so in the next lecture we will continue more on this thank you very much hello everyone welcome back in this lesson we will talk about http methods that is post using the forms let's create a simple form and using that we will see how to upload a file so now let's go back to our index so here what i'll do is that like you know let me create a form so let me give some breaks here so break i just want to give some breaks so that like you know i can get the nice view just use the two breaks now and after that let's create a form by default i'll just give the forward slash i mean hashtag and the method of course the method i just want to allow here is post so the post is the method that i'm going to allow here and after that encryption type is multipart form data so this is what like you know the default form settings and inside that let me create a do and inside the do class is input group and inside that let's take a input and the type of the input is i just want file here and the class is form control and the name edges is very important the name is image underscore name so this is what the name that i went going to take here and of course i just want is a required to be true so this is very much required and after that let me create one more input and this time the type is submit button so the type is submit and the value is upload and class the class is it's a button i just want the button space at the button i just want the outline secondary so that's it so this is these are the two things which is very important for me and after that what i'll do is that that's a form of course it's a do and after that it's done so that's it so this is what the simple form which i created now in the html so let's see whether it is working in my browser so let's go back to your browser and refresh your page and that's it this is what is important is what i just expected and it will choose a file ask you to choose a file and what are the file i just want to choose i can choose this file and as soon as if i upload that it will go to my flask app so that's what the simple html page is that is what i just want to create so in the next lecture we will see more on this thank you very much hello everyone welcome back in the previous lesson we have seen how to create an upload button now what we will do here is that we will write down the background code of this in flask so let me minimize and go to the flask app so what you're expecting here is that like you know in the forms you are expecting the file data which is in the post class cap what we need to do is that we need to receive the file and save that file in some folder that is called static so now let's see like you know write a backend code of that so we will receive the file and save it in the folder so for that let me create a folder and let me create a folder name static and inside the static let me create one more folder upload all right so now what i'm what i want to do here is that like you know i just want to save the file what are the file that has been uploaded i just want to save the file and just upload folder so in order to do that what i'm going to do here is that let me import request and the methods that i'm going to allow here it is it is both the method that is post and as well as the get by default the method that was allowed by the class is post now let me change the methods methods is going to be equal to it is a post as well as get so i'm accepting the both the methods which is post as well as get by default it will move into the get method and if post then what i'm going to do is that i just want to save the file so in order to write the logic what i'll do is that f request dot method double equal to post so if the method if the request is post then i just want to then i'll get the upload file then what i'll do is that i'll get the upload file and that is going to be equal to request dot file and what is the name of the file i just want to extract here nothing but the key and this one it is there in my index and which is nothing but the name so i just want to give this so what is the name of the image i want to extract here or any of the files that i want that i want to take is image underscore name so that's it so this is what like you know i can able to get the file now what i'm gonna do here is that i just want to save this file in order to save this file the first thing we need to understand the path here so where exactly our path is so for that let me create a base path so base path is uh we need quite the os here so let me import os import os now now os dot get cwd which is nothing but get current working directory and now let me create an upload folder so what i'll do here is that like you know i'll just create an upload path so what are the path what are the file that i'm going to save here that need to save in my upload path so here just mention the path os dot path dot join and this is what makes the base path so the base path is what like you know where your app file is running and followed by my the path is it should be in the static folder static folder and upload so this is what the path this is about the upload path now what i want to do here is that like you know just let's take the file name here because we need to save that image with respect to file name so that's the reason let me take the file name so we can get the file name from the upload file dot file name so with using the method file name we can get that now let's create the path to be saved path to be saved is equal to waste.path dot join and of course you need to save in the upload path with the specified file name the first page of the file name of that is file name so that's it so now what we can do is that like you know we got the path to be same now what we will do is that like you know we will save it so upload file dot save and just save the set save with us with the path and the path i just want to save here is this that's it so this is how like you know we can save the file and of course we can also return um the same render template we can also use the same render template and i just want to return it is index dot html same html i will going to be written here so that's it so this is how like you know we can create a simple uh http request that is post what it is going to do is that like you know as soon as we call the post then we'll take the image name or if the file and after that we'll take the file name and we are going to save that my file name in the respective folder in this case i'm saving in the static and the upload folder so that's it so let's save it now what we will do is that let's test it so let me refresh here and choose the file and you can choose uh whatever the file you want you can really choose it so in my case i'll choose like you know and one two one so this is what the file just want to save and uh open this file and click on upload so what happens here is that like you know as soon as if we click on this upload it's uh it's a post request now it was it was in my upload dot file dot images uh take you take that file and it will save that image in the particular folder called upload you can see that like in a static upload my file has been saved and one two one you can see this is what the file that i have seen so let me do one more case like you know just up click and this time i'll say one more image let's say my red car and open and upload now you can see that like you know it's automatically getting upload here we can see now this is uh this is the image that was uploaded in the upload folder so that's it so this is how like you know we can write the same backend code to upload any image and save it in a folder we will continue in the next lecture more on this thank you very much hello everyone welcome back in the previous lecture we have seen how to upload an image and save it in the upload folder now what we will do we will make use of this upload image and we will make the predictions using deep learning model which we have did in the previous module so what we are trying to do in this lesson is that we are trying to integrate our deep learning model to the flask app so that's what we're going to do now for that let's what we will do is that let's go back to our previous module and if you remember this is what the previous module we have did and in the make predictions we written the pipeline code so this is what the pipeline code that was really required for me so what i want to do here is that like you know i just simply uh take the object detection and i'll just simply pass the path here which will return me the image as well as the coordinates so this is what actually i just want now and after that i want the optical character recognition and just pass the path here will return me the text so what we're trying to do in this case let's try to integrate our deep learning model and object detection ocr so let's go back to our app and here let me create a one more file and that is nothing but deep learning dot file in the deep learning dot pi what we will do let's import all the necessary libraries and also the also copy and paste my pipeline model so for that let's go back to my make predictions and you can see that this is what the object action dot pi which is not what important for me let's copy and paste this function here and also we need to import the necessary libraries so the necessary libraries that was required for this is this so we have the numerical python computer vision and plot clip and tensorflow let's copy and paste it here and also let's copy this and paste it here so and say and save it so what we required here is that like you know in order to run this function we required the load image and that was there and we required the numerical python that was there an image to array and we want the model and what we want here is that like you know we want the model here so in order to get the model as we have seen in the previous lecture like we already saved our object detection model you can see that this is what the object detection model that we have already saved so what we will do let's copy this now go to your respective directory in my case it was the module 3 web app and go to your static file and create one more folder just name it as models and inside the models let's paste our model our deep learning model which is object action done i pasted my deep learning model in the objection that was in the static and the models and let me also create one more folder just name it as predict also create one more folder roi i think what region of interest so let's create the two more folders apart from upload is roi and product and we will use this ro and product because like you know we need to split the image into multiple parts so for that like you know we will use this my model was there in the models folder so now what is what i need to do is that i need to load the model here so the model that could be equal to since it was in the deep learning folder so the model that's going to be equal to and it was in my static folder so for that in order to load the model what i'm going to do is that i can use the tensorflow.keras dot models dot load model and adjust it to set the path here and the path is it was in the dot static models object action dot h5 so this is what the model i just want to load now and once the model is load and just look into this uh code here the first thing is that as the path and we'll get the image and we convert that into array and after that we load the image and reshape that into 224 by 24 we normalize it and get hw and d and after that we reshape it and we predict this this is what the name of the c just make sure like you know you uh maintain the same name that is the model and using this model load model i'm just making the predictions and after that i need to denormalize it and then get the values and here you go and what i'm getting here is that like you know i'm getting the diagonal i'm getting the diagonal coordinates and also i'm getting the image with the rectangle shape on it and finally it's going to return me the image and also the coordinates done so this is what the object detection and then i just want to create one more function that is ocr ocr stands for optical character recognition so in order to work on the social let's go back to our code again in the make predictions like once once we got the image what we did is that like you know we use a spy test rat and we pass this path to it and we got i'm sorry once we've got the path what we need to do here is that using the coordinates using the coordinates we need to uh extract the roi nothing but my region of interest in it more precisely it is what my number plate and that number plate i just want to pass it to image to string with a fighter so that i can get the text here so now we have to do the same thing here so this is what the library that was required for me let's copy and paste this library and after that what we require is this let me copy the path here and paste it here so maintain indentation here and finally you can get the text here so that's my text so literally what you're doing here is that in ocr again the input is path here and we are taking this path you can see here we are taking this path of the image here again and after that with that path we are actually calculating the x min x max and we want the coordinates here in order to get the coordinates we require this object detection so what we will do here is that we already know that here it is the image image is what an image and that's going to be equal to object detection of the detection of if i just send the path to it i can get the image and i just want the coordinate suite so this is what the image and also i can get the coordinates so that's it and using this image and using this image and the coordinates what i can do i can uh crop the image so this is what basically i'm trying to crop the image here all right so so i think everything is done and more precisely i really don't want the image here because anyway i'm reading the image so i'll just remove the image and inside this what i will do i'll save the image so i need to save the image in my static in the predict folder so for that what i want to do here is that since my image is in rgb format you can see like you know if my image is in rgb format and what i want to do here is that i just want to convert that into bgr format so for that i can use like you know image underscore uh bgr that is going to be equal to cv2 dot convert color and the image is image and cv2 dot it's a [Music] color and rgb to vgr so here what i did i just converted my image into rgb2 vgr and after that once the image is converted in rgb to bgr and this consists of the rectangle portion now what i can do is that like you know i can save this into my predict folder so in order to do that uh what i want here is that like you know i just want the file name that i just want to save okay so assume that let's say there are two inputs to this one is path and the file name and assume that there are two inputs one is path and second one is the uh file name now what i can do here is that i can make use of this file name i can make use of this file name and let's save it so we can do the cv2 dot and write and so what is the file name that i want to save here it was in my i just want to specify the path the static and the predict and this is what the file name i just want to specify okay and after that what is the name of the image i want to save here is image underscore bgr so that's it so now what happens is that as soon as we if i call this function of the deduction internally do some operation and save the image in my predict folder and return this so obviously let's say i just don't want now so i just i here i just getting only the coordinates here and input to this object action should be my file name and also like you know i i assume that like you know in ocr i'm having one more input that is file name so using that like you know i can get the file name here and using this file name i can save that in my coordinates and the next step what i want to do here and what i'm getting here is that i'm getting an image and i'm getting the coordinates and this image is saved in the predict and i just want one more image that i want to save here is roi i just want to save this roi in my rv folder so for that i'll do the same thing cb2 dot m write and what is the file name i just want to say basically it said the path here it was a static i just want to save in my ry folder and this is what the file name so that's it so what i did here is that i'm just saving again the one more image roi and this time i just want to save is what my roi and remember the thing is that like you know this is in the rgb format since i'm using the cv2 i just want to convert that into bgr so let me take like you know roi underscore bgr that's going to be equal to cv2 dot convert color and what i want here is that just source image is roi and the color code is basically cv2 dot color same i can use the same code that is the cv2 dot color rgb2 since this is an rgb i just want to convert it bgr since uh computer region cv2 mostly work on the bgr format so that's why i just want to convert into vgr and now i can save that image here so that's it so this is what basically i'm getting here is in the deep learning dot pi i just imported all the libraries i load the model i create the two functionalities which is object detection and also the ocr so that's it guys so we'll continue in the next lecture more on this until then happy learning [Music] hello everyone welcome back in the previous lesson we have seen how to write the deep learning dot pi program so here we have the two functionalities that is object action and ocr and of course this is what not roi this is actually roi underscore bgr and the output for this ocr it should be written my text okay so that's it in this lesson is we are trying to integrate our app with my deep learning in order to do that what we will do we can simply import deep learning dot py so we got we can do is that from deep learning i just want to import actually in the deep learning only one module is basically enough that is nothing but ocr so i just want to import my ocr save it so that's it so what you're doing is that like you know from deep learning i'm just importing my ocr here so this ocr i just want to pass the two inputs one is path and second one is file me so let's integrate it if you can see that my index.phi i got my uploaded file and that is being saved in my static folder after that what i will do is that i will pass this file basically once the file has been saved i'll spar the static of same file which has been uploaded to my ocr and just trying to remember that the output of the ocr is text so text is basically equal to ocr or i just want to set the path the path is basically where my file is and my file is basically in the file underscore save and where exactly my file has been saved and the file name is this file name so that's it so what we can get here is that like you know as soon as if we execute this command it will calculate the bounding box and after that for that bounding box it will extract the text so that is what going to be happen in my case so what we will do let's test the app whatever the app we have let's test this app okay my program is running now since since anyway since i just loaded my deep learning model here so the good thing is that like you know we need to rerun this program so for that let's quit this ctrl c to quit and let the let me run the program again so python app.pi so what happens now is that you can see that like you know my model is being loaded using the tensorflow and usually it will take some time done you can see that like you know i might i got the url that is what the same url now just go back to my browser and just refresh the page so now what we will do let's choose the file and we are going to choose a file let's say i just choose the samsung file this and let me upload it and oh we got an error let's see like you know why we are getting this error i think since like you know we got some internal server error okay maybe we will run it again it's not showed any error so let me run this again so let me take this image and upload and you can look this operations in your flask done so as you can see the operation has been successful and this is what the output it is being printed it is kl16j366 so as we can see like you know in the deep learning dot pi we print the text here and that text is basically printed here which is kl16 j3636 let's check the output of my image so the image that was saved in my upload folder and this is what the image and it is kl16j3636 this is correct and let's look into my product and this should be the bounding box absolutely we have the perfect bounding box it's kl16j3636 and in the roi we should have like you know the cropped image so this is what the cropped image and this is i mean like a crop image of my number plate which is kl16j3636 so perfect so what we did is that like you know we actually split the image into multiple folders one is predict roi and also the upload and which is actually successful now with the next lecture we'll see more on this thank you very much hello everyone welcome back in the previous lesson we have seen how to integrate our deep learning model to the flask app now what we are trying to do is that we are trying to put our output in the front end of our page that is like you know we're just trying to display our image as well as we'll also display our predicted image and also display our only the number plate and the text everything in my single page so that is what i'm going to do in this case so for that what we will do um so thing is that the logic here is that only when when i upload this and then only i should get all the images so in order to do that what we will do is that like you know in the render.net in the render template let me create uh one more variable and let's name it as upload just make sure that like you know this is upload is equal to true and this is upload equal to false now let's go to our index.html now here when upload equal to true then i just want to display the image when upload is equal to false i just don't want to display the image so for that what we can do is that like you know let me write the logic in the ginger template engine so let's go to g django and here let's write down this f so i'm just writing the f else so f let's say upload so what is upload here the variable name upload if upload is equal to true then i just want to execute this html so if upload is equal to true then what i want to do here is that let me just change the language to again html now just create a do now and inside the do let's create a class equal to container say the bootstrap classes container now here i just want to display the images that have been uploaded so once i uploaded then then i will get some images so what are the images that was done and did some operation those images i need to display here so let me do one thing let me create a simple table here so that will be the much more convenient so let's get table and inside the table let me create a row and two columns so let's get tr tr stands for table row and td is basically the table data and inside the table data the first one is what the image and the source of an image should be my uploaded image so what are the image that was uploaded and that should be come here okay so the source is basically it should be from the static and it was from the upload and of course i just want to dynamically give the name of the image so let me uh at the moment let me say this is for like you know upload image or let's say some upload image is what i'm just giving here at the moment or at the moment let me set like you know upload image is what the variable name is what i'll anyway i'll just give the upload image variable i will call from the app.pi and for the css bootstrap in order to get the cleared view of the image irrespective of what size of my image i should get like you know same image size so for that i will take a class and the class is going to be equal to i want to be rounded and flow to be this should be the float left this should be my floater left and i just want image fluid okay so this is what the class css class i just want to write down here and again in the one more text td let me take one more table data and also take the same this is what the same image this time i just want to give the predictor so what i would give here is that i just want to send the predicted data so here i think everything is same this should this is my not float left this is float right now image fluid and of course this is what the predicted and i know that like you know this predictor it can be found out from the predicted folder in the static and there is a predict folder predict predict folder and the same and the file name is obviously like you know the same upload image file name done so this is what like you know whenever whenever i uploaded any image i can get such kind of things now so let me test it so let's go to my browser choose an image and let's choose n66 and upload and obviously it will do some operations calculating the bounding box and also calculating the what is the text and finally this will be appear here and you can see those operations here uh i think okay it's doing some changes okay i think my synthesis is not been started so let's wait for few minutes okay done so let me execute it again now choose a file n66 open and upload now let's see [Music] any operations is going or not yes done so we got like a kl66 all right this should be get here oh yeah the thing is that like you know here i need to specify my upload upload image so i need to specify this upload image in the variable the upload image and that's going to be equal to my file name so this is what the file name i just want to specify here so let me save it and let's see now i think let's reload our app done let's refresh my page oh i'm getting a variable local variable file name is an error oh this this is not the file because it's not the upload i can't find here uh basically inside the loop and then my this is the the name of the variable is upload image let's take this variable and this is my file name done so let's save it now let's refresh it yeah it is restarting let's wait for few seconds done now let's go back to your browser let's refresh our page done now choose a file open upload so just wait for few minutes okay done so we got an output the scale 66 and this is what the image and this is my uploaded image and this is what my predicted image it's good so what i'll do is that like you know let me maintain some gap here because the gap just trying to maintain some gap so for that let's go back to my index and here after after continue let's create some break one would break two breaks so so that now i can get the gap here now in the next lecture we will see how to display the text as well as the region of interest image in the html thank you very much hello everyone welcome back in the previous lesson we have seen how to display uploaded image and also the predicted image in the html page now in this lesson we will see how to display the cropped image nothing but region of interest and the text in our web page so now what we will do is that let me create one more table here inside the duo let me create one more table and uh this time so what i'll do let me create some breaks here and let me create one more table and the name now what i'll do here is that like you know i just want to mention the region of interest and also my text so for that what i'll do is that like you know let me create a table row and insert the table row let me create table header and the name of the table header it is nothing but like you know cropped license plate crop license plate image so this is what the name of the header and also one more header i want and this time this should be my text or some text okay now what we will do let me create one more row and of course in the first column i have to display the image so we know how to display the image so this is what the method of displaying the image so in order to do that let me take the td and the image and the source and the source of the image this is from the static and roi and of course the name of the image is upload image so let me copy and paste the upload image so that's it and now what i have to do is that like now let me provide the class is to be image fluid so that like you know i can get the same size of the image respectively of what are the size i can i can get the same display size so let me take the class is to be image fluid now done i think everything is done in the next table data what i need to do is that like you know i need to provide the text so we can also provide the text whereby giving the multiple ways like uh for example what i will do is that like you know i can provide the text with the h1 tag and the display i just want the class i will mention the display display to be this time 8 so very small image size and the text i just want to provide is text the variable name text and which i basically uh send dynamically from my app.pi so that's it and of course what i can do is that like you know i can set some stylings so for that i can i can use a the property style and inside the style what i can do is that like you know just provide the background color and that background color to be my green yellow some pale yellow some combination of this is what the background color i just want here now and obviously in my table row what i will do is that like you know let me create one more style here and here let me give the border and the border is solid black so let me also copy this and paste it in my one more table row this is the table row what two rows we are having so let me copy and paste it for the one more table row so that's it so this is how we can style all our text and everything has been set so what we will do let's also copy and paste this in my inside my table so i think now everything is being done now so what we will do let me go back to my page and refresh it so let i think of it just since the changes has been made let's wait for a few seconds now let's choose an image and now let's upload it done okay so what happens is that like you know we got the image and uh so this time is that like you know kl and everything has been done and of course we have not set any kind of text here we will anyway set it and i think everything is done now so what we will do let's go back to our app and inside the app let me also provide the text here so the text is basically equal to text so this is the variable i just want to display and the text is equal to text here so file name and what are the text we got and the dot text they just want to display in the text so that's it and in order to get the hundred percent width of my image so for that what we will do let's go back to our uh index dot html now inside this what i will do is that just mention with these to be my hundred percent that's it so let me save it and again let me refresh my page and let's do it again open upload oh okay now done so let me let me refresh the page again and n66 upload and predict all right so i think we got so we have like you know this is what an image and this is what my cropped image and this is what my number plate is kl1683636 it's perfect so everything has been done so this is how like you know you can really create a simple web app which is number plate ocr and the flask so we will continue in the next lecture more on this thank you very much
Info
Channel: Online Academy
Views: 17,989
Rating: undefined out of 5
Keywords: django project, create django project, automatic number plate recognition, ocr web app, web app in python, flask app, django create app, django app, python web application, anvil python, number plate recognition, anpr system, django aws, python django projects, flask web app, django chat app, django projects github, flask projects, run django project, flask web server, anpr camera locations 2022
Id: ohosyX4Sce8
Channel Id: undefined
Length: 186min 27sec (11187 seconds)
Published: Sun Oct 16 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.