‫Now.
‫This is exactly what I was talking about.
‫If we go back to the keynote things you might see in CoLab, this is one of them.
‫So what it means is that I took a little break just now, and if we come back to CoLab, because of
‫the limited amount of resources that Google is able to provide, if you leave your notebook in CoLab
‫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 your notebook.
‫So this is what you do.
‫If you have to take a break and you should take a break every so often you're not spending too much
‫time sitting down.
‫Go for a walk.
‫Nature's 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 folder.
‫Excellent.
‫We can close this up.
‫We don't need that.
‫But what we're going to have to do is.
‫Oh, you better tick off these.
‫Right.
‫Pay attention to my own notes is I'll put a little green tick emoji.
‫We've imported TensorFlow hub.
‫Making sure we're using a GPU.
‫Now, the beautiful thing is the notebook itself will save the fact that we are using a CPU.
‫So when it reloads, we won't have to change the hardware accelerated to CPU, it will automatically
‫load it as a GPU.
‫But we do have to rerun any cells that we may have ran before.
‫So there we go.
‫Check for GPU import TensorFlow.
‫Make sure we're using TensorFlow two 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 is the tools they use.
‫So that's why we spent a bit of time getting our CoLab workspace ready, getting our new project folder
‫together, getting our data there.
‫So now if we go back, what step are we up to?
‫There should be a zero here for getting our workspace ready.
‫But now we're up to step one, which is getting our data ready a.k.a turning it into tenses.
‫Now this is the premise of TensorFlow in itself.
‫That's why it's called TensorFlow.
‫The premise is to get your data into tenses aka 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 an
‫umpire ray with some dimensions but a tensor.
‫The key thing here is that it can be run on a GPU.
‫So if we go back here, TensorFlow is turn your data into tenses and then it flows through a workflow
‫like this.
‫You get it TensorFlow.
‫I know doing a machine learning course 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.
‫We'll make a little heading.
‫Actually, we can go to here getting our data ready.
‫Turning it into tenses.
‫Remember, we're communicating with ourselves here.
‫We'll 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
‫OC.
‫Now this is a code cell and in CoLab, 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 in CoLab.
‫Hold command m h.
‫There we go.
‫Have a look at that.
‫Far out.
‫There's 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 shift and enter, right?
‫Just to run our code.
‫Let's check out 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 CSV 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 are CSV format using pandas.
‫So check out the labels of our data.
‫We're going to import Pandas as PD our favorite labels CSV equals.
‫So what we're going to do is just pass in.
‫Maybe we could set up a little a little path, but we'll type it out to begin with.
‫We could just copy this copy path.
‫But we're going to practice.
‫What would that look like?
‫Something like that.
‫Let's practice topping it out.
‫Remember, you don't need content.
‫Drive.
‫My drive.
‫Slash dog vision.
‫Oh, yeah.
‫This is what projects need, right?
‫They need cool names, labels, CSV.
‫All right.
‫And we're going to can that.
‫And then what we might check out is we'll get label CSV.
‫We wanted to describe it.
‫Describe.
‫I would help if I could type.
‫I bet.
‫Full time.
‫Lucky.
‫There we go.
‫And print.
‫And we'll also get the head.
‫So the first five rows.
‫Let's check it out again.
‫We'll remove this more space.
‫Wonderful.
‫What do we have here?
‫Count 10,222 ID breed 10,222 unique value.
‫So.
‫Okay, so there's 10,222 unique IDs and 120 unique breeds.
‫And then this is what the ID column looks like.
‫Again, it looks a bit different because we've printed it.
‫So if we just did labels CSV.
‫Dot head.
‫This is what you might be used to looking at something like that.
‫Here we go.
‫So we've got an ID column, which is the file names, I believe, of our images.
‫So this is of train.
‫And the breed associated with that ID.
‫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 go to label CSV 10,222 unique values.
‫Yes, that's correct.
‫Here.
‫Unique and then train.
‫We've got unique ID.
‫So does that look like.
‫What we've got in it.
‫Yes, it does.
‫Wonderful.
‫Okay, now what we might check out.
‫We've got 120 different breeds.
‫So that means.
‫That there's 10,000 or so images.
‫Hopefully there's about 100 or so images per class.
‫Well, actually, let's just figure that out.
‫Let's figure out how many images there are per class first, and then we'll see why that's important.
‫How many images are there of each breed?
‫And we can probably do this pretty easily by going labels.
‫See, it's V Braid.
‫So I'm 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 breed, Scottish deer hound, multi dog into butcher.
‫Not even sure what that is.
‫Shout out if if your dog's on here, Eskimo dog.
‫Yeah, it's really cool.
‫And now let's visualize this.
‫It's probably going to look a bit better if we visualize this fig size and equals 2010.
‫Whoa.
‫See, the beauty of CoLab is that we didn't even have to import map plot lib to see that.
‫So my notebook is a bit zoomed in, but this is pretty cool if we were to draw a line.
‫So look, we've got dog breeds here, all of our 120 different dog breeds, and then this is the number
‫of images that they have.
‫So we were to draw a line somewhere across here.
‫We'd say about maybe 75 on average.
‫We can figure that out pretty easily anyway.
‫So labels CSB how do you find the mean 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.
‫So we said 75, but that is a good thing.
‫You could 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 DX hound 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 AutoML.
‫So which is which is there service for automatically building machine learning models?
‫This is some extra curricular.
‫If you want to check this out, it's 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 ten.
‫So 100 is great, but at least ten 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 ten images per class.
‫So our data set at about 75 to 85 images per class is pretty well spread out.
‫This is a good start.
‫Okay.
‫So I've done a little bit of exploration of the labels.
‫Now what we might do is start to to get out image paths.
‫So labels is pretty easy to deal with in a CSV, 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 CoLab notebook.
‫Let's have a look at how to do that in the next video.