‫Alrighty.
‫So now we've got all of our training image file names.
‫Remember, these are just file names at the moment.
‫So all file paths probably the better way to do it.
‫I've called this file names.
‫It will just leave that there.
‫So these are file paths to our training images, which means later on we'll have a way to access them.
‫So it's important to note here that these are just strings.
‫They're not the actual images just yet.
‫We'll do that in a second.
‫But what we're doing now is we need to get our labels ready.
‫So these are our labels.
‫We've just dealt with the file IDs and turn them into file paths, but let's now get our labels.
‫So remember, the premise of machine learning is to turn our data into numbers.
‫More specifically, when we're working with TensorFlow, it's to turn it into tenses.
‫That's what we're moving towards in this little subsection at the moment.
‫All right.
‫A little bit of text here since we've now got our training image file paths and a list.
‫Let's prepare our labels.
‫Okay.
‫We've got all our labels in labels CSV.
‫Let's just have a look at them, actually.
‫Let's go labels.
‫Let's just create a variable called labels.
‫CC Braid.
‫Keep it simple.
‫You know, what is this come out as?
‫Okay.
‫So that's day type object.
‫And remember, we have to start turning these into numbers so we might turn them into a numpy array.
‫So import numpy as now I wonder if I could just do this otherwise.
‫I know another way to do it.
‫And what if we go labels?
‫Wonderful.
‫How many are in there?
‫Lynn Labels.
‫10,222, which is amazing.
‫The other way I was going to do it is if we.
‫Comment out this I'm doing command slash.
‫That's how you can comment out a whole line.
‫And and then we go to numpy.
‫Nice simple method and pandas.
‫Same thing.
‫Does.
‫Same thing as above.
‫Little trick there.
‫Let's do the same thing as before.
‫Compare the amount of labels to the number of file names.
‫If we come back to here after we've downloaded this and unzipped it into our CoLab notebook, what we're
‫doing here is by comparing the number of labels to the number of file names checking for missing data.
‫So if you remember back in the previous projects with structured data, there were some cells in the
‫data frame that were missing.
‫But checking it with unstructured data, if there's missing, data is a bit harder.
‫So this is kind of the workaround we're doing.
‫Check if number of labels matches the number of phone names and we're just going to do the exact same
‫as before.
‫So if Len labels so the length of labels, what we just did there equals Len file names because what
‫we're eventually going to have to do is pair up these labels with these file names like what we've just
‫done here.
‫So Index 9000 is Tibetan mastiff and it's file name 9000 is this absolute lion of a dog.
‫So let's go here.
‫I'll print out a little confirmation for ourselves.
‫Number of labels matches, number of file names.
‫B.A beautiful else print number of labels does not match.
‫Number of file names.
‫Check data directories.
‫Fingers crossed.
‫Beautiful.
‫That's what we're after.
‫Number of labels, matches, number of file names.
‫Okay.
‫Now, finally, since I'm a saint.
‫Well, not really.
‫Finally, we're still got a lot to go with this project.
‫Since a machine learning model can't take strings as input, this is what labels currently is, right?
‫It's an array of strings.
‫What we have to do is convert it into numbers.
‫How might we do this?
‫Well, to begin, let's find a list of all the unique dog breeds.
‫So there's 10,222 in here.
‫But how would we find the unique labels?
‫So let's do this.
‫Find the unique label values.
‫So I want you to have a little think about this.
‫If you have an umpire, Ray, I've given you a little hint.
‫How might you find the unique values in a given array using numpy?
‫Do you have a little think you could even look it up?
‫There's a good Google search for that.
‫So NP unique is how we find find the unique elements of an array.
‫And now this is pretty cool with CoLab, right?
‫It just pops up this docstring without me even doing anything.
‫So we want to find the unique labels.
‫Let's find that unique breeds.
‫Let's have a look at that.
‫Awesome.
‫So there's a whole bunch of different dog breeds.
‫So let's have a look at them.
‫Brittany Spaniel.
‫I never even heard of that Chihuahua.
‫Gordon Setter Great Dane.
‫Yeah, there's a beast getting distracted by dogs.
‫And so this should be 120.
‫Wonderful.
‫So that is because we have.
‫120 breeds of dogs.
‫We're lining up here, right?
‫We're getting our data ready.
‫We're getting it prepared to get into tenses.
‫We've only got two arrays of strings.
‫How might we turn these into numbers?
‫Why don't we turn it into an array of booleans?
‫Let me give you an example rather than talk about it.
‫So turn a single label into an array of booleans.
‫So print labels zero.
‫We'll just use label zero as an example.
‫So labels zero.
‫Now we're going to use the comparison operator to compare the first label to unique breeds.
‫And what this should return is an array of true and false values where everywhere in unique breeds label
‫zero doesn't equal.
‫It should be false, but the only location where it does equal should be true.
‫There we go.
‫Let's have a look at these.
‫So it's a Boston bull.
‫But then if we have a look at unique breeds.
‫So we can say true is here.
‫So what's that about?
‫12 in.
‫So if we go through here, count them up.
‫If you can add them up, you'd find Boston Bull.
‫There we go.
‫True.
‫That's what we're after.
‫Let's do that for every single label.
‫So turn every label into a Boolean array.
‫If you're looking at this and this is just all trues and false, you're probably wondering how is this
‫going to be converted to numbers?
‫But we'll see in a second.
‫There's a special thing with numpy arrays and and Boolean values.
‫So let's go bowling.
‫Labels equals label.
‫We'll do another list comprehension here.
‫So label equals unique breeds for label in labels.
‫Let's see what the code says first, then we'll talk through it.
‫If in doubt, run the code.
‫Wonderful.
‫And bullying labels should be 10,000 long or 10,222, whatever it was.
‫Wonderful.
‫So that means we've turned every single label into a Boolean label.
‫Now what is this little list comprehension doing?
‫All it's doing is a scaled up version of what we've got here.
‫So it's saying do this little one off example for every label in labels.
‫And if we remember.
‫Len Labels is 10,222 because we have 10,222 labels.
‫So it's done it for every single label.
‫He might be thinking again, Why are we turning him into true and false?
‫Well, how we can convert these boolean arrays into numbers.
‫More specifically, one hot and coded numbers.
‫So if in doubt, run the code, let's check out the code, then we'll talk it through.
‫So example turning boolean array into integers.
‫Print label Zero will get the first one.
‫So this is the original label straight from the DataFrame.
‫Straight from label CSA print NP where unique braids equals labels zero.
‫Print.
‫So actually we should probably tell this is the index where label occurs.
‫And then we're going to go print bullying labels.
‫Zero.
‫Dot org.
‫Max.
‫So this is index.
‫Where label occurs in boolean array.
‫And then we're going to go print.
‫Bullying labels.
‫As type int.
‫So there will be a one or there should be a one where the sample label occurs.
‫Whew.
‫That's a big cell.
‫We're going to check it out.
‫Look at that.
‫So the original label is Boston Bull, and it appears that the 19th index.
‫Which is the same in our Boolean labels zeroth index.
‫So it appears at 19 and if we were to count this so zero or 012345678, nine, ten, 11, 12, 13,
‫14, 15, 16, 17, 18, 19 is where one occurs.
‫So now every single label in bullying labels is actually in this type of format.
‫So there's a one where the actual label occurs.
‫So if we did the same thing for let's go to and then print labels to.
‫Is Pekinese occurs right down here and zero for everything else.
‫Wonderful.
‫So now we've got our labels in a numeric format and our image file paths are easily accessible because
‫remember, we've got file names.
‫These are our image paths.
‫They aren't numeric yet, but we can do that later on using TensorFlow.
‫So now we've got our data in an accessible format.
‫Let's create some training and validation sets because if we come to our files, we notice when we download
‫it from Kaggle we only have a train and test set to do our experiments.
‫We want to split our data into training and validation, so that's what we'll do in there in the next
‫video.