- [Instructor] Remember we used Teachable Machine,
and we did a audio classification project.
Now I'm going to show you image classification project.
An image classification is a computer vision model.
Remember the other computer vision model we learned?
It's object detection,
and we used Azure AI to do object detection.
Now we are going to use Teachable Machine
for image classification.
So image classification and object detection
are both computer vision models.
What is the difference?
If you remember,
we started with object detection
as our first demo in this course,
and we fed the AI a simple image,
and it put bounding boxes and identified objects.
That's what object detection does;
it takes a single image,
we did not give a labeled image,
we just gave an image, it is unlabeled,
so in object detection, the image is unlabeled,
and it identifies, the AI identifies,
all the different objects and marks different locations
where the objects are found,
and it is trained using unsupervised learning,
something like YOLO.
Let's get started with image classification right here.
With image classification,
and I'm just going to select a Standard image model,
in image classification, it is supervised learning.
Supervised learning means we have to give labeled data.
So we collect datasets
that are going to be used as training data,
but they need to be labeled, each image has a label.
Unlike object detection, which is unsupervised,
this is supervised learning.
But with Teachable Machine, you don't need to worry.
We are just going to find a dataset,
and we are going to use it,
and we are going to run machine learning
with few simple clicks.
Let me show you the datasets I'm planning to use,
and I always use free datasets that are available
and for easy download with no signups and no catch.
So this Penn-Fudan dataset
for Pedestrian Detection and Segmentation
is a labeled dataset that we can use lot of images,
and this is all people images.
The other one is caltech-101 dataset,
and this has close to 10,000 images,
I think 9,000 plus images, in 101 object categories.
When we download, we get all of them,
and simple objects like elephant and chair and everything.
And I'm just going to pick one category,
and I'll show you what it is in a minute.
So let's go back to Teachable Machine, and here is the URL.
Follow along the demo,
don't worry about the difference between object detection
or image classification.
I'm going to give you a handout which has all the details,
it has the URL for all the different datasets
that you can use,
and the steps that you can follow along.
So in machine learning, we are doing classification.
We have to take our data
and group them or classify them into multiple classes.
And so, I'm going to call this People,
or I'll call it Person, okay?
You can call it anything, it's just a name.
This other class, you know what I'm going to do?
Remember, we've been talking about autonomous vehicles
and identifying people and everything on the road,
so I'm going to stick with that theme,
though our Edge AI class is about Edge AI,
about variety of AI running on the Edge
for variety of different devices,
I'm going to stick with the car example.
And, typically, when autonomous vehicles
are driving around,
they identify all kinds of objects in their environment,
and it is trained using object detection.
But, occasionally,
you might want to spot a specific item or an object
and identify it.
You can imagine in a road,
it is not just about seeing whether there's a person
on the road, which is good, right, pedestrian detection,
but there are options in cars these days
for identifying traffic lights or Stop signs.
So I'm going to show you how we upload the data.
Remember what we did?
You simply press Upload,
and you choose the images.
And I have the PennFudanPad dataset downloaded.
I literally went to the site I showed you,
I clicked Download, and it gave me this directory.
And I'm literally keeping
all the different sub-directories that they showed,
so that you know exactly what it looks like.
I have not, you know, simplified or organized anything,
so this is the same experience you will get
when you download the dataset.
And I need images, so I'm going to go to Images,
and I'm going to get a bunch of images,
let's say maybe 20 plus, let's see.
22.
So, you can see, these are all different people images.
Now for Stop sign,
do you remember what's the dataset we are going to use?
We are going to use the caltech-101.
So here I am at caltech-101,
and as I told you, it has every possible object,
not every possible object,
but a lot of different object categories right here.
And what do we need? We need the Stop sign.
So I'm going to scroll down and find the Stop sign.
It's right here.
And if I click,
now, it has a lot of different Stop signs.
It's basically images of different Stop signs
in different angles, in different lighting.
So that's how different images are created
for the same item.
So I'm going to take a few from here,
and I'm going to upload.
Whoa, I got exact 22 images here too.
That's amazing.
Okay, so do you remember
that we need to have almost similar size datasets
for both the classes or multiple classes?
It just happened, I got the exact 22.
It could be 24 or 27, it doesn't matter,
but it cannot be like 20 in one class
and a hundred in another class,
then you'll kind of skew the machine learning,
or training of the model,
to be biased towards the one with more data, okay?
So now we have the Person dataset,
we have the Stop sign dataset,
what is the next step?
I want to show you the epoch and the other factors in here.
In audio, when we did the training,
you remember the word epoch?
This is the number of times the training AI
will scan every single object,
in this case, the images that we have given.
And then there are other factors
that you might want to just read if you're curious.
But I'm just going to leave all the defaults here,
and I'm just going to press Train.
And done.
You can see the 50 box that it's scanning for, okay.
So the model is trained,
voila, it's done.
So now I'm going to choose an image.
So here I have some samples we could use.
Let's see.
Remember we used these objects in our Azure demo?
So maybe I want to try with that.
Yes, these were all people and it says Person.
It's perfect, it identifies people.
I have an interesting one, a road scene,
but I also want to test for the Stop sign first.
So I'm going to go back to the caltech data,
find the Stop sign.
We used all these images, right,
in the beginning, 22 of them.
So I'm going to go down to an image
that I have not used from the bottom,
and it says Stop sign.
The important thing is,
we cannot use an image that is already being used
in the training dataset.
That's called overfitting.
What do you think will happen?
It's cheating.
It's already got the answer,
it has that in the brains of its learning,
and we are just giving that as a test.
So be careful to pick an image
that has not been included
in the training samples here, okay?
So it identified a person, it identified a Stop sign.
So I have an image from another dataset called Streetscenes,
and let me input that and show you.
See what happens here.
So this is a lot of people and cars on a road.
And, previously, when it identified people,
it was very confident,
when it identified a Stop sign, it was very confident.
But now it is 95% confident that there are person in here,
this label should be called a person,
and it thinks maybe 5%, it's a Stop sign.
Why do you think that's happening?
There's no Stop sign in here.
Because it has a lot of red,
and the light by which it has learned Stop sign,
it is a little confused thinking,
"Maybe 5% confidence, I think there's a Stop sign in here,"
but it sees a lot of people it can recognize,
so it thinks, "I'm going to place this as a label
that is a person."
So image classification
is actually going to take an input image
and it is going to say it belongs to this label as a person,
or this label as a Stop sign.
So that's all it is doing,
it's literally labeling the image that we give.
It's not like object detection
to understand all the different elements in here.
But every AI is not going to be 100% confident
with every image.
So it's important for you to run this model, train it,
and test with a variety of different images.
Think of the use case that you will use
for image classification, you wanted to identify a thing.
And in this case, the image classification happens
because it takes an image that we have given,
a bunch of images,
and it understands, it's called feature extraction,
it scans the image,
it tries to understand the edges of the image,
it tries to understand the texture of the image,
it tries to understand
what features contributes to this image,
and that is why it knows a full image
as that particular label.
So when we have a complex image like that
where there are people in there,
it's maybe in the person class,
but then it has this shiny red thing,
it's never seen that before,
so it's a little confused and makes a 5% mistake.
So it's important for you to give lot of training data
to give various different scenarios,
various different lighting and shades
and textures of the object you want to be identified.
Think of this,
if you want the car to identify a Stop sign and stop,
then it needs to recognize it
whether it is dark or whether it's in dim light,
or maybe the Stop sign is in some snowy condition,
and it's partially blocked,
or it seems to have some kind of spots on it.
So all kinds of situations
which make the Stop sign look like it's something else
should be fed as training data,
and it's the same thing for a person
or any other object you're trying.
So with that, we are done with this demo.
I hope you'll be able to try this with more other data
from the different datasets that I shared
to just compare it to different objects.
But the important thing is not just this training,
but it is about how you will use it.
Oh, I need to show you how to export the model.
So you have actually exported the previous model
for Teaching Machine with voice,
we are going to do exactly same thing.
We clicked on Export Model,
and one option is you can upload,
and this will upload the model to the cloud,
you copy it, and you have it, right?
And you can also download the model and then you can use it,
or you can get the JavaScript for this
and you can give it to your engineer or data scientist,
and you can incorporate this
into many different applications in your workflow.
So let me show you what that looks like.
This is the URL where it went to the cloud.
Think of where you would use this.
If you want to show this to your customer
about recognizes specific object,
then this is the URL when you put that in the cloud,
when you exported it and said Export
and it saved it to the cloud,
this is what it looks like.
It'll not show you the whole training class and everything,
it'll literally show you this window of the model,
and you can click and input a file,
and then show the output and show the model working,
you can test this with your customer out in the field.
But when you see this URL here,
you also see links
on how you can use these Teachable Machine models
in your various projects.
And that is very important,
because if you're going to programmatically take
all the content, how do you organize it?
Where does it link? How do you do that?
All this information is available in this link.
So now we are truly done,
and I'm calling on your imagination on what will you do?
Don't think of this as two objects,
think about how now you have learned two different models,
you have learned object detection
which identifies any kind of objects and person
in a single image,
and you've learned to do machine learning,
image classification,
so you can label items or you can take labeled datasets
and now you can make a model,
identify one thing confidently.
So think about what kind of things would you like
for this AI to build,
so you can put it on any of your Edge devices,
in any of your environment,
and then make Edge AI work for you.