본문 바로가기

Deep Learning/cs231n Lecture

(15)
Lec 5. Convolutional Neural Network, Convolution Layer, Max Pooling Layer 이번 lecture에서는 computer vision 분야에서 사용되는 neural network를 구성하는 중요한 개념인 convolution layer에 대해 공부해본다. Convolution Layer: How it works? Idea: Compared to FC Layer... 이전 lecture에서 다뤘던 fc layer의 경우, 우선 input을 N*1 형태의 벡터로 표현한 뒤 weight matrix와의 행렬 곱을 통해 activation number를 얻었다. fc layer과 비교했을 때 convolution layer에서 가장 큰 차이점 중 하나는 spatial dimension을 유지한다는 것이다. 위의 슬라이드와 같이, 3차원 형태의 input 그대로 3차원 filter와 conv..
Lec 4-2. Introduction to Neural Network Linear Classifier = Building Block of Neural Network 이전에 linear classifier 개념이 처음 도입될 때, 이것은 복잡한 neural network의 basic building block을 이룬다고 하였다. Linear classifier가 뭘 하는지를 단순하게 표현하자면 학습된 weight들을 가지고 input에 대한 score output을 내는 역할을 한다. 이 때, 학습이 완료된 weight matrix의 각 행은 하나의 label에 대한 template이라는 의미를 갖는다. input 이미지 벡터가 들어오면 각 행과 내적을 수행함으로써 template matching을 하고 그 결과를 label에 대한 score로 주는 것이다. 그런데, 이 방..
Lec 4-1. Gradient with Computational Graph: Forward Path, Backpropagation, Vectorized Operation How to Calculate Analytic Gradient for Complex Function? Optimization 과정에서 loss function의 gradient 방향을 따라서 weight parameter들을 변화시키므로, loss function의 analytic gradient를 계산하는 방법이 필요하다. Lecture 4는 어떻게 복잡한 다변수 함수의 gradient를 계산할 것인지를 다루며, 이를 위해 computational graph와 backpropagation의 개념을 다룬다. Computational Graph: Forward path & Backpropagation 다변수 함수를 여러 개의 간단한 연산 단위로 쪼개서 node와 연산 gate로 나타낸 것을 computat..
Lec 3-2. Optimization: Gradient Descent, Stochastic Gradient Descent Optimization: How to find best weight parameters W? Loss function은 weight parameter들이 training dataset에 대해 얼마나 좋은 성능을 내는가에 대한 측정 지표이다. 그렇다면 좋은 성능을 내도록 weight parameter들을 어떻게 찾아갈 것인가? 이러한 문제를 optimization이라고 한다. Gradient Descent: Following direction of gradient Weight parameter는 I*c개이다. (I는 이미지 벡터의 size, c는 label 수일 때) Weight parameter들이 만들어내는 I*c 차원의 벡터 공간을 생각해보면, weight parameter들이 random하게 초기화..
Lec 3-1. Loss Function: Multiclass SVM, Softmax, Full Loss Loss Function: Measuring goodness of weight W 위와 같은 linear function으로 score를 계산하였을 때, 현재 weight matrix W가 ground truth label에 대해 어느 정도 정확도를 주는지에 대한 지표가 필요하다. 강의에서는 다소 비유적으로 현재의 weight matrix W가 주어진 training dataset에 대해 얼마나 happy한지를 측정한다고 했는데, 이러한 측정 지표가 되는 것이 loss function이다. Loss function을 정의하는 방법은 여러 가지가 있을 수 있고, 본 강의에서 다룬 multiclass SVM, softmax의 2가지를 포스팅에서 정리하려고 한다. 모델, 구체적으로 보면 weight matri..
Lec 2-2. Linear Classifier: Parametric Approach, Interpretation, Limitation Linear Classifier Neural network의 기본적인 building block을 이루는 linear classifier에 대해 살펴보기로 한다. Linear classifier의 기본적인 아이디어는 다음과 같다. 만약 10개의 class로 이미지를 분류하는 classifier인 경우, 각 class에 대한 score가 input x와 weight parameter W의 함수로 표현된다. Score 값이 가장 큰 label로 class를 판단하게 된다. 함수 중 가장 간단한 linear 함수를 가정하면, 아래 수식의 첫 줄과 같이 함수를 표현할 수 있다. 이 때, linear 함수에서 bias vector b를 포함하는 것이 더 유용함이 알려져 있다. 그래서 기본적인 linear clas..
Lec 2-1. KNN(K-Nearest Neighbors) Classifier, Hyperparameter Tuning, Dataset Split Nearest-Neighbor (NN) Classifier Data driven 방식의 image classifier 중 가장 naive한 approach는 nearest-neighbor classifier이다. 우선 training data를 모두 메모리에 저장해둔 뒤, 판단하고자 하는 test data에 대해 미리 저장된 training data와 모두 비교해 가장 가까운(nearest) label로 분류하는 것이다. Distance Metric: L1 Distance '가장 가깝다'는 것을 이미지에 대해 어떻게 적용할 것인지를 판단해야 한다. 하나의 방식은 L1 distance이다. 이것은 (32, 32, 3)의 3차원의 이미지를 (32*32*3, 1)이라는 하나의 긴 벡터라고 생각하고, 비교하고자..