## #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)

**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.