본문 바로가기

Study/Computer Vision & Deep Learning

CNN

02 - Applications of CNNs

 

03 - How Computers Interpret Images

the mnist datavase. Famous dataset in machine learning

first convert to vectors. 

 

04 - MLPs For Image Classification

 

Sure! Here's the explanation in English:

CNN (Convolutional Neural Network) and MLP (Multilayer Perceptron) are both types of artificial neural networks, but they have significant differences:

1. **Architecture**:
   - MLP: Consists of an input layer, hidden layer(s), and an output layer. Each layer is fully connected.
   - CNN: Comprises convolutional layers, pooling layers, and fully connected layers. CNNs are specialized for image processing and can preserve spatial structure while extracting features.

2. **Learning Approach**:
   - MLP: Does not consider the sequence or structure of data since all input nodes and output nodes are fully connected. This may not be suitable for data with spatial structure like images.
   - CNN: Particularly useful for 2D or 3D data like images. Convolutional layers recognize local patterns in input images, and pooling layers reduce spatial dimensions, effectively preserving spatial structure while learning.

3. **Number of Parameters**:
   - MLP: Since all nodes are fully connected, MLPs may have a large number of parameters, especially for large input sizes.
   - CNN: Convolutional layers use shared weights to recognize local patterns, efficiently reducing the number of parameters and enhancing data efficiency.

4. **Efficiency**:
   - MLP: Requires computations for all connections between input and output layers, leading to increased computational load and slower training for large and complex input data.
   - CNN: Utilizes convolutional and pooling layers to reduce input size and increase abstraction level, enhancing model efficiency and enabling effective learning on complex datasets.

In summary, CNNs are primarily used as solutions for tasks such as image classification and computer vision, especially when dealing with image data. Choosing CNNs over MLPs is common, particularly for tasks involving image inputs, due to their ability to preserve spatial structure and effectively process complex datasets.

 

 

06 - Model Validation in Keras

Train Set : fit the model weights

Validation Set : check how the model is doing

Test Set : check accuracy of the trained model

 

you will always want to select the lowest validation loss

 

07 - When do MLPs (not) work well_

 

In order to feed an image to an MLP you have to first convert the image to a vector. 

then treats them as a simple vector. 

In contrast, CNN understand the fact that the image pixels that are closer to each other 

are more heavily related.

 

Similarity

both are composed of a stack of layers

 

 

 

 

 

 

 

 

 

08 - Local Connectivity

MLP limitation 

1. Only use fully connected layers

2. Only accept vectors as input

 

CNN
1. Also use sparsely connected layers

2. Also accept matrices as input

 

09 - Convolutional Layers

ReLU activation function returns the input if it is positive, and zero otherwise.

 

10 - Convolutional Layers

 

color image : move filter. self-grid informational 

filters, pattern randomly generated. 

 

A convolutional neural network consists of an input layer, hidden layers and an output layer. In a convolutional neural network, the hidden layers include one or more layers that perform convolutions. Typically this includes a layer that performs a dot product of the convolution kernel with the layer's input matrix.

 

Cnn은 Input -> Padding -> Convolution Layer -> Pooling -> Convolution Layer -> Pooling -> Convolution Layer ->..............-> Flattening -> Output

 

  • kernel size는 convolution의 시야(view)를 결정.
  • stride는 이미지를 횡단할 때 커널의 스텝 사이즈를 결정.
  • Padding은 샘플 테두리를 어떻게 조절할지를 결정.
  • activation function is mostly RELU function : x>0 이면 기울기가 1인 직선이고, x<0이면 함수값이 0이된다.
  • Pooling Layer:
    • Convolution Layer 사이 사이에 들어가는 층.
    • 데이터의 공간적인 특성을 유지하면서 크기를 줄여주는 층이며, 특정 위치에서 큰 역할을 하거나, 전체를 대변할 수 있는 특징을 추출 가능.
    • Max Pooling과 Average Pooling으로 나누어짐.
  •  

'Study > Computer Vision & Deep Learning' 카테고리의 다른 글

Study notes in Deep Learning and Computer Vision  (0) 2024.03.09
Sprint 1 Lecture Code Note  (0) 2024.03.04
Neural Networks  (0) 2024.02.27