#002B Image representation in a computer

#002B Image representation in a computer

Image representation in a computer

The computer stores 3 separate matrices corresponding to the red, green and blue (RGB) color channels of the image. If the input image is 64 by 64 pixels, then we would have three 64 by 64 matrices corresponding to the red, green and blue pixel intensity values for our image. For a 64 by 64 image – the total dimension of this vector will be =64*64*3=12288.

How-images-are-represented-in-computers

Notation that we will follow is shown in the table below:

  • A single training example is represented by (\(x\) , \(y\)) where
\( x\in\mathbb{R}^{n_{x}}, y\in\begin{Bmatrix}0,1 \end{Bmatrix} \) 
  • Training set has \(m\) training examples: 
\( \begin{Bmatrix}(x^{(1)},y^{(1)}),(x^{(2)},y^{(2)}),…,(x^{(m)},y^{(m)})\end{Bmatrix}\)
  • Input training examples are in the form: 
\( X=\begin{Bmatrix}. & . & & . &\\ . & . & & . &\\ x^{(1)} & ^{(2)}& … & x^{(m)}& \\. & .& &. & \\ . & . & & . &\\ \end{Bmatrix} \)
  • Output is: 
\( y=\begin{bmatrix}y^{(1)}, &y^{(2)},&… &,&y^{(m)}\end{bmatrix}\)
  • \(X \) is 
\( m \times n_{x} \)
  • \(y\) is \( 1 \times m \) dimensional matrix: 
\( y\in\mathbb{R}^{1 \times m}\)
  • Python command for finding the shape of \(X \) matrix is 
 X.shape \( (n, m) \)
  • Python command for finding the shape of \(y\) is 
 y.shape \( (1,m) \)

In the next post, we will learn about Optimizing the Cost Function in Logistic Regression.

More resources on the topic:

For more resources about image representation in computers, check these other sites.

Leave a Reply

Your email address will not be published. Required fields are marked *