---
type: learning
area: learning
status: learning
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - learning
---
- Mostly used with images
### How CNN works
![[img-20240923-205847-ffa9f08e.png]]

- Diffrence between color image and B/W image
![[img-20240923-210413-faca411e.png]]

- Steps of CNN
![[img-20240923-210625-cde4a34e.png]]
#### Convolution
![[img-20240923-210737-3b64cd9c.png]]

![[img-20240923-211051-077615be.png]]

Feature Detector = Filter = Mask = Kernel 
Not Always his size is 3 x 3
Feature Map  = Convolv Map
We loose some information when we use feature detector
Normaly we get a lot of feature map after applying multiple feature detector.
This steps used to extaract feature from image using a multiple filters.

#### Relu Layer
![[img-20240923-223936-7e799352.png]]

This increases non-linearity in image because images themselves are highly non-linear data but when we apply the list of filters we can get something linear
Example  :
Image before mask
![[img-20240923-224603-989aa5bc.png]]
After mask
![[img-20240923-224646-2af2a321.png]]
after rectifier
![[img-20240923-224801-0033375b.png]]

#### Max Pooling
Take a box of (for example: 2 x 2 ) and we passe it to the feature Map like a window and after we choose the biggest one
in that window
![[img-20240924-005425-b3d5cfb8.png]]

The maximum number represent where we actually found the biggest similarity.
In pooling we get rid of 75% of features that are not important and reducing the size and number of parameters
and we prevent over fitting

#### Flattening
After pooled layer
we change those layers
![[img-20240924-011542-18363a6e.png]]

Summary
![[img-20240924-011623-aed70222.png]]

#### Full Connection
In CNN Hidden layer they should all fullly connected
![[img-20240924-011927-d3bd4bce.png]]
In CNN when doing back propagation not only the weights are improved also the features detectors
Output layers takes care to the neurons that gives the high probability

#### Summary
![[img-20240924-013703-c0fde171.png]]

#### Softmax & Cross-Entropy
- Softmax
![[img-20240924-115433-233047e1.png]]
Th role of this function is to make the values of both classes processed and made to add up to 1.
- **Cross-Entropy**
used after applying soft-max
also it's a metrics to evaluate **NN**
helps nn to get to the optimal state 
better used for classification
 
**Some Metrics**
Mean Squared Error
If a vector of n predictions is generated from a sample of n data points on all variables, and Y! is the vector of observed values of the variable being predicted, with Y^ being the predicted values (e.g. as from a [least-squares fit](https://en.wikipedia.org/wiki/Least-squares_fit "Least-squares fit")), then the within-sample MSE of the predictor is computed as
![[img-20240924-121139-23ebbee3.png]]
- Squared Error drawbacks
![[img-20240924-133826-8bf67e2a.png]]
	