Hi everyone and welcome back.
So in this new series of videos we're going to be implementing a new API which uses machine learning
to classify an image.
So the idea behind what we're going to do is we're going to be given an image.
So let's say this is an image and was a person inside.
So excuse my horrible drawing.
But then the image would have some things that it might have an animal that might have an airplane.
You know it might not have anything that might have even the SOMEONE WHO famous.
For example Angelina Jolie or someone or some other person.
OK.
And then we're going to give this model this image into our API.
The user is going to give this image into our API.
And then we're going to do some machine learning.
OK.
And then we're going to classify this image into one of five categories.
So we're going to tell the user hey this is probably a person.
And 80 percent sure about that.
This might be a pineapple and I am one percent sure about that.
This might be a famous person OK.
And that I'm sure about that.
For example 15 percent.
And this might be an animal right.
Somehow somehow the model classifies as animal 3 percent and then I notice this might be something else
x 4.
So we have 80 percent and then 4 percent plus five.
That's 19.
So 19 plus eight is ninety nine so one percent is x.
Ok.
So are going to be given this image over here.
We're going to do some machine learning using Genser flow.
So Tanzer flow which is a library for deep learning that was published by Google.
So we're not going to be training our own model or are you going to use one of the models that Google
already trained.
It's called N.S. v3.
OK.
So inception B-3 is a very strong model and is able to classify an image into one of these classes for
those too many classifications.
I'm going to show you the model in a few seconds but it can basically classify animals plants humans
famous people airplanes you know non-human things and so on.
So it's a really powerful model that we can just use automatically since Google already trained it so
we can just use it somehow like an API you can think of it as we're using this as an API and we're going
to see how we can use it in the coming video.
And I'm also going to explain tensor flow a little bit just the workflow of how it flow works.
So we are more you know we understand how everything would work basically in in our API.
Now in this video we're going to first of all introduce it we introduce what we're here to do so we're
going to be building an image classification API or image classification API.
And in fact if you Google just an image classification API or image recognition API you're going to
find hundreds of Abiah ised that or any do this.
And you know they might have even used section B-3 under the hood.
So you never know.
Right.
So in fact there are many startups actually doing this service as an API so they offer an API and so
an API would be here.
So the user would access this API.
And then you would get a response of this result right away so he doesn't have to do all this machine
learning or heavy lifting.
If you mean it.
OK.
So yeah this is this is actually very much like real world scenarios where you might be asked to develop
an API that does something like this.
OK.
All right so the second thing we're going to do in this video is to do a chart protocol right where
we want to do a protocol off all the resources that we have.
OK.
So we're going to do this very very simple great rehab.
We're going to have three things we're going to have to register.
OK.
And as you might have guessed it's just registration.
We're also going to have to classify OK to classify an image.
What is it.
You know what's in that image.
And then finally I'm going to also add refill.
OK.
So we've already done refill in a previous video but we're also going to do it again to basically.
So when the user registers he gets let's say 5 tokens for free so he can use our classification API
for five times.
But then once he's out of these five he can pave basis and then in return the administrator of the EPA
I can refill his points for this user.
OK so these are the resources I should have written is resources here.
Now what about the your l.
Well L is pretty pretty straightforward right for a register is going to be slash register for classifieds
going to slash classify.
And for a refill it's going to be last refill.
OK.
All right.
So what about the method.
Or is it a get post what is it.
Well for registration was actually right.
The parameter is first.
OK so are there any parameters.
So for arrester I need the username and the password and all that user right for classify I need the
user name password to verify that he's actually the one he he's the same username right.
Or otherwise I can use someone else's user name and someone else's tokens to classify my own images
right.
So we're going to use the get the username password and we're also going to get it you are.
OK so this you are going to be your out to the image.
Right so it's age DGP something something to puji for example OK.
And then this is the image on the Internet.
And we're going to download it and classify that image for the user.
OK.
For the refill it's straightforward.
We have the user name the admin password right.
Because we don't want anybody to be able to refill this.
Any user with any number of tokens right or otherwise you would be at the point of refilling right.
You just keep refilling your account for it with an incident number off of tokens.
And then finally the amount.
OK how many points or how many tokens do I want to add to this user.
All right.
OK cool.
Now let's talk about the method.
You can see that all of them require parameters.
Right we have to send something to the server.
And so in these cases we're going to use posts for all of them.
Right.
Because post is when we want to send something to the server.
So post post and post.
All right.
So the final thing is the return codes.
OK.
So the return codes were statuses and so on.
So all of them or as you might have guessed they have all hands 200 OK 200 OK and 200 OK.
Right.
That's if nothing no problems happen.
Now in registration we might have another problem we might have 3 0 1.
And we discussed this three and one here would mean that user name already exists already exists.
So it's an invalid username here.
We might also.
So so we can shorten this three to one as invalid username.
OK.
Again to classify it we might have three in one.
Someone might send that username is ABC and there's no ABC in our database right.
The user doesn't exist.
So three or one invalid username.
OK.
What about the password username password.
Well they might not match right.
I might my Bashford might be secure but someone sends ABC.
Right so it's not my password.
So 1:57 is invalid.
Password and then the final thing is three or three what if he classified wait why did the username
is correct the password is correct.
But hey you wants to classify an image but you doesn't have enough tokens.
He needs to refill though he needs to pay first.
So in this case we send them back to 3 0 3 and then we tell him sorry out of tokens again out of tokens.
All right.
Now for the refill.
We have something similar for the username.
Well you might put a user name who doesn't exist in our database so it's an invalid user him.
So there are three or one invalid username.
OK so that means that this user is not doesn't exist in our database.
Another one might be three or four.
So if I send an admin password if I'm a hacker trying to hack into the ABC I refill my account with
an infinite number of tokens.
Then if this admin password is correct then I won't need to donate.
Sorry this is a wrong password.
So three or four invalid and password.
OK administrator password and then that's it for now.
You can also you know do an extra thing where the amount has to be positive.
But then again the only person who is going to be using this slash refill is the administrator of the
API.
So most probably he's not going to implode like negative 5 for the end.
And he is most probably going to end but five he doesn't want to break the system.
So usually these checks are invalidations you put them just to make sure that nothing happens or no.
Nobody tried to keep your system basically secure.
So this is basically the API for for it.
So registration we already did that before and the Riggio were about.
We already did that before so we should go through them fairly quickly without too much explanation.
But for the classification here well this is the interesting point because we're going to be getting
your l.
Sorry going to download this image and then we're going to fly the machine learning model that Google
already trained on it and then we get the results and we return it to the user.
OK.
So hopefully this made sense.
So we're going to stop here and in the next video we're going to take off and start implementation of
the entire you know structure of the folders and our files doc and compose and so on.
So yeah we're going to stop here.
And until the next video happy coding.