Doubts with Practice Lab of week 2

Hi @Anurag_Ravi_Nimonkar ,

Welcome to the community. It is great that you are sharing your questions with us. I will try to answer them as best I can. However, if it is still unclear, please let’s know.

A coloured image is made up of 3 component colours, red , green and blue, the primary colours; they are referred to as RGB channels. Each channel has values ranged from 0 to 255. So for a colour pixel, it would have 3 numbers, one from each channel. The attached diagram may help you visualise what a pixel looks like. So a coloured image of size 4 by 5, will be represented as the height x width x 3, which will be
number of pixel for height x number of pixel for width x 3 channels
and each pixel will have a value between 0 to 255
In this assignment, train_set_x_orig is a numpy-array of shape (m_train, num_px, num_px, 3). Where each image has the same height and width, and m_train is the number of training examples in the training set.
So a flattened image will be of shape (num_px ∗ num_px ∗ 3, 1). 1 being a single image.

If you read the instruction hint: A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b ∗ c ∗ d, a) is to use:
X.reshape(X.shape[0], -1).T
Here is a detailed explanation of what how the reshape function works.

It is good to read other resources and practise, but it is very important that you have the basics to build a good foundation first. All the mentors are here to support your learning journey, so if there is anything that worries you, please do not hesitiate to post your query here.