Now this is exactly what I was talking about.
If we go back to the KEYNOTE things you might see in collab.
This is one of them.
So what it means is that I took a little break just now.
And if we come back to collab because of the limited amount of resources that Google is able to provide.
If you leave your notebook in collab for a long enough time it will eventually disconnect from a runtime
which is a runtime is again just a computer on Google server that powers you know.
So this is what you do if you have to take a break.
You should take a break every so often.
You're not spending too much time sitting down go for a walk.
Nature is beautiful right.
Well that's what I just did.
I just took my dog for a walk so if you do get this little pop up you're going to have to reconnect.
But you'll see up here the runtime is reconnecting.
So it's initializing mounting Google Drive which is where our files are maybe it takes a little while
to appear.
There we go.
Drive.
We'll have google drive back.
There's dog vision our beautiful little project photo.
Excellent.
We can close this out we don't need that.
But what we're going to have to do is Oh better take off these right.
Pay attention to my own notes.
I'll put a little green tick emoji we've imported import intensive not hub making sure we're using a
GP you now.
The beautiful thing is the notebook itself will save the fact that we are using a GP you.
So when it reloads we won't have to change the hardware accelerate it to you it will automatically load
it as a GP you.
But we do have to rerun any cells that we may have ran before.
So there we go.
Check the GP import tensor flow.
Make sure we use intensive load to point X and I'll delete this one.
Wonderful.
Okay.
So now we've got our workspace ready and you might be thinking Daniel that took a fairly long time to
get set up.
But as always a person is only as good as the tool they use.
Right.
Or as the tools they use.
So that's why we spent a bit of time getting our code lab workspace ready getting our new project folder
together getting our data there.
So now we go back What step are we up to.
There should be a zero here for forgetting our workspace ready.
But now we're up to step 1 which is getting our data ready a.k.a. turning it into tenses.
Now this is the premise of tensor flow in itself.
That's why it's called tensor flow.
The premise is to get your data into tenses a.k.a. remember all machine learning models like to deal
with numbers.
So we have to get our data into tenses which is just a fancy word for Matrix a.k.a. a name pi array
with some dimensions but a tensor.
The key thing here is that it can be run on a Jeep you.
So if we go back here at tensor flow is turn your data into tenses and then it flows through a workflow
like this.
You get it tensor flow
doing a machine learning goes and you get a comedy show for free.
All right.
So step one we're going to access the data.
So right now it's over here in drive in the dog vision.
So now we have to somehow get it from this folder into this code space.
So let's do that we'll get out of that make a little heading.
Actually we can go to we're getting our data ready.
Turning it into tenses remember we're communicating with ourselves here we go here with all machine
learning models our data has to be in numerical format so that's what we'll be doing first turning our
images into tenses
numerical
representation
and now this is a code cell and in that collab a special way to transform something into markdown is
to hold command and double tap M if you want to see a list of all shortcuts and collab hold command
M H there we go have a look and I far out there is a lot there.
So this takes some practice again because some of the commands we've been using in Jupiter are slightly
different.
If you do need to look one up have a look in here.
Otherwise I'll just kind of keep running with it if I need to add a code so I can just press this little
plus button here or up here and the main one will will be using is shifting into right.
Just to run our code let's look at the labels what does that look like.
So if we come back
let's start by accessing our data and checking out the labels.
So to do that it's in a CSB format.
So if we want to check it out we might have to or we will have to import pandas because it's a lot easier
to look at things that I see format using pandas so check out the labels of our data.
We're gonna import pandas as payday our favorite labels CSP equals.
So what we're going to do is just pass in maybe we could set up a little a little PA but we'll type
it out to begin with.
We could just copy this copy path but we're gonna practice.
What would that look like.
Something like that.
Let's practice typing it out.
Remember you don't need content drive my drive slash dogged vision.
Oh yeah.
This is what projects need right.
I need cool named labels dot CSB.
All right.
And we're going to can that.
And then what we might check out is we'll get labels CSB we wanted to describe it describe would help
if I could type I'd be full time lucky and we go and print we'll also get the head.
So the first five rows let's check it out again more may this mall space.
Wonderful.
What do we have here count ten thousand two hundred twenty two I.D..
Grade ten thousand two hundred twenty two unique value.
So.
OK.
So there's ten thousand two hundred twenty two unique ideas.
And one hundred and twenty unique grades and then this is what the I.D. column looks like.
Again it looks a bit different because we've printed it.
So if we just add labels dot CSB dot head.
This is what you might be used to looking at something like that Navy guys are going to I.D. column
which is the file names I believe of our images.
So this is of train and the brain associated with that I.D..
Now a little tidbit here if you do have a lot of files in one of your folders in Google Drive it actually
does take a fairly long time to load here.
So rather than wait for that let's just go back to Kaggle.
Treat this as our way of looking at things.
There we go.
So if we get a label CSB ten thousand two hundred twenty two unique values Yes that's correct.
Unique.
And then train.
We've got unique ideas so does that look like what we've got in our day.
Yes it does.
Wonderful.
Okay.
Now what we might check out.
We've got 120 different brains.
So that means that there's ten thousand or so images hopefully there's about 100 hundred or so images
per class.
Well actually let's just figure that out.
Let's figure out how many images there are.
Her class first and then we'll see why that's important.
How many images are there of each breed.
And we could probably do this pretty easily by going labels since the grade some accessing the braid
column and then I'm going to go.
Value counts.
So count the values in this column actually let's just see what that does.
This is a dog braid Scottish deer hound Maltese dog and to butcher.
Not even sure what that is.
Shout out if if your dog's on here asking my dog.
Yeah it's really cool OK.
And now let's visualize this is probably going to look a bit better if we visualize this pig size equals
2010
Wall see the beauty of collab is that we didn't even have to import map Gottlieb to see that.
So my notebooks a bit zoomed in but this is pretty cool if we were to draw a line.
So look we got dog braids here all of 120 different dog rates.
And then this is the number of images that they have.
So if we were to draw a line somewhere across here we'd say about maybe seventy five on average we can
figure that out pretty easily anyway so labels CSA.
How do you find the main of a column.
Actually we need to count them first because otherwise they're just strings dot main average maybe it's
probably a little bit more robust in the main
so the middle number 82.
OK.
So we said seventy five.
But that is a good thing.
You can imagine right if you had let's say Scottish deer hound if we had 500 images of that but this
bad boy over here.
What is this one Eskimo dog.
If we only had three images of Eskimo dog we could imagine our machine learning model might do very
well at figuring out what a Scottish D ham looks like because it has so many examples.
But as for an Eskimo dog if there's only three images it's probably going to be a bit hard to figure
out what it looks like when you're asking yourself how many images should I have per class Google recommends
a bare minimum ten Google minimum number of images per class
preparing your training data.
Here we go.
So this is Google's auto m l so which is which is their service for automatically building machine learning
models.
This is some extra curricular if you want to check this out.
Pretty cool preparing your data.
There we go for model training purposes.
It is recommended you use about 100 annotations per label.
So in our case it would be great if you had 100 examples of each image class with at least 10.
So one hundred is great but at least 10 is a good start.
So if you wanted to build your own image classifier if it's a binary classification you'd want to be
looking at minimum 10 images per class.
So our data set out about 75 to 85 images per class is pretty well spread out.
This is a good start.
OK.
So done a little bit of exploration of the labels.
Now what we might do is start to give out image paths so labels is pretty easy to deal with in a CSA
but all of our images again we can't see that are in this format here.
So we need a way to get them into our CO lab notebook.
Let's have a look at how to do that in the next video.