Reshapping Images
What you need to remember:
Common steps for pre-processing a new dataset are:
Figure out the dimensions and shapes of the problem (m_train, m_test, num_px, ...)
Reshape the datasets such that each example is now a vector of size (num_px * num_px * 3, 1)
"Standardize" the data
Imagine you have a big box of crayons, each one a different color. You want to organize them neatly so you can find any color quickly when you're drawing. In this case, your crayons are like the pixels in your pictures.
Understanding the Box (Dimensions and Shapes): First, you need to know how many crayons (pixels) you have and how they are arranged. In our example, each picture is like a square piece of paper that you've colored on. The "num_px" is how long each side of the paper is, and "3" is because you used three layers of colors (red, green, and blue) to make any color you want.
Flattening the Pictures: Now, imagine taking each colored paper and squishing it flat so that all the crayons (pixels) line up in a row instead of being spread out in a square. This way, instead of having a stack of papers (a 3D box of crayons), you have a single, long row of crayons (a 1D row). This makes it easier to look through them quickly. In technical terms, you're changing the shape of your pictures so that instead of being a square with depth (num_px by num_px by 3), they're just a long line of colors (num_px * num_px * 3).
Organizing the Crayons (Reshape): You do this for every picture you have, creating a long line of crayons for each one. Then you put all these lines in a big box so that each line (picture) is side by side. This is your new organized box of crayon lines.
Standardizing the Data: Finally, you want to make sure that all the crayons are not too bright or too dull. To do this, you gently shade over each one so that they all have a similar brightness. This way, when you draw with them, no single color will overpower the others. In our pictures, this is like making sure the colors aren't too intense or too weak, which helps the computer learn from them better.
So, in summary, you're taking your colorful pictures, squishing each one into a long line of colors, organizing these lines neatly in a box, and then adjusting the brightness so everything is balanced. Now, your crayon box (dataset) is ready for you to create beautiful drawings (or for the computer to learn from them)!