Hello, my name is Josh Turner. In these lessons, you will learn about TensorFlow data and pre-processing, TensorFlow models, and TensorFlow professional tools. Let's get started with the first lesson. In this lesson, I will teach you about the necessary libraries to do data pre-processing. We'll set some variables and pre-process our own training, validation, and testing data set. Let's get started. The first thing I need for you to do is go to the website, caggle.com. Once you're there, you can navigate to the data sets tab and search for the satellite image classification data set. Once you've found it, you can download the satellite image classification data set to a local folder on your own computer. Go to the folder, and you'll see that we have four different classes of images, cloudy, desert, green area, and water. Once you have successfully done that, open the Python editor of your choice. We will start with the first steps in our data pre-processing library. First thing that I need for you to do is import the necessary libraries. We'll import NumPy so we can go with mathematical calculations and arrays. We will import TensorFlow so that we can use the full capabilities. In particular, we'll use the TensorFlow.corros.pre-processing library and import the image data set from directory function. This will be the function that we use to do our pre-processing. Once you've done this successfully, typed out this code, run it to see that it works OK. All right, so far so good. The next step in our data pre-processing is to set some variables. Wherever you saved your image data set on your directory, you can copy the text in the cookie bar and set the following variables. Set a variable called directory and in double quotes, make it equal to the directory that you copied from the cookie bar. As a side note, remember that you'll have to change the backslashes to forwardslashes, or Python will give you an error. After that, we'll create a variable called batch size and use an arbitrary number like 32. After that, we'll create another variable called image size and use another arbitrary square number by 160 by 160. Let's run these lines of code to make sure everything works OK. All right, so far so good. The next step is to use these variables and this directory to create a training data set. To do that, create a variable called train and type the following code. Set train equal to image data set from directory, the function that we imported earlier. This will take, as variables, the directory, labels which will be inferred from the directory, shuffle parameters set to false so that we don't mix up the testing and validation sets. For this one, the validation split will be 20% validation and 80% for training. And this will be the training subset. We'll use a batch size of the variable we created earlier and an image size of the variable we created earlier. This will complete the training data set. Make sure you have all of the correct commas in place or you'll get an error. Run these lines of code, and we'll see the first step in pre-processing our image data set. Once you've run these lines of code, you'll see that TensorFlow will tell you that it found 5,631 files belonging to four classes, using 4,505 files for training. If you get a CUDA error like this on your machine, don't worry, it's just because you're not taking the full advantage of the TensorFlow GPUs. OK, great. Now the nice thing is we can also do the same thing for the validation set. We just have to change a couple of small things. Copy and paste the code from above and redo it all for the validation data set. Once you've copied and pasted it, we will change a few things to create a validation data set. We'll still use the validation split of 20%, and we will change the subset from training to validation, and we will change the variable name from training to validation. Everything else will remain the same. OK, so let's go ahead and change the name to validation. All right, and the next thing we want to change is the subset. This won't be the training subset. It'll be the validation subset. OK, great. So far, so good. Again, we see we found 5,631 files belonging to four classes, 1,126 uses for validation. What does it mean to train and validate files? Well, that just means that we will train a model on 80% of the files, and then we will use the remaining 20% to create a test data set. The remainder from that test data set will be called the validation data set. We'll use the validation data set to tune the parameters of our model to get the very best fit for whatever the use case is for our problem. OK, so now let's create the testing data set. We'll do that from the validation data set we created earlier. So let's see how that works. First, we want to create a variable called val batches. We'll use the TensorFlow data experimental cardinality function. This just tells us how many validation elements are in each batch. So if we took a batch of 32, maybe eight of them could be from the validation. It's randomly sampled. Inside of that, as your parameter type validation, next, we'll set a variable called the test data set. Set test equal to validation.take val batches, and we'll use the double division symbol in Python divided by 5. So that's basically saying 20% of the validations will take for tests, and then we'll skip whatever's left, and that will be the new validation set that we'll use to tune the parameters of our model. Run these lines of code, make sure everything worked out OK. Great, so far so good. Thanks for watching. Stay tuned for the next lesson we'll learn about TensorFlow models.