분류 전체보기
-
#15. Residual Networks연구실 2019. 10. 14. 16:54
- ResNets(He et al.) allows train much deeper networks. * The problem of very deep neural networks - 깊은 네트워크는 복잡한 함수를 표현라고 다양한 level에서의 특징들(lower layer의 엣지부터 deeper layer의 복잡한 features)을 learn할 수 있지만, 항상 좋은것만은 아니다. Vanishing gradient라는 큰 문제가 발생할 수도 있기 때문이다. - gradient descent 과정을 반복하다 보면 마지막 layer에서 첫번째 layer로 계속 backprop하게 되는데. 그 과정에서 각 step마다 weight matrix를 곱하게 된다. 그러면서 gradient가 0으로 수렴하는 현상이 ..
-
#14. Keras tutorial - the Happy House연구실 2019. 10. 14. 14:56
- Tensorflow가 higher-level framework라면 Keras는 더욱 higher-level framwork이며 추가적인 abstraction을 제공한다. - 제한적인 부분들이 많아 Tensorflow만큼 복잡한 모델을을 실행시키진 못하지만 많은 common model들에 대해 잘 작동한다. - 예시는 (64, 64, 3) 이미지에 600개의 training set과 150개의 test set으로 구성되어 있으며 label은 1(happy)/0(unhappy) * Building a model in Keras def model(input_shape): # Define the input placeholder as a tensor with shape input_shape. Think of ..
-
#13. Convolutional Neural Networks: Application연구실 2019. 10. 13. 19:18
* TensorFlow model (1) Create placeholders X = tf.placeholder(tf.float32, shape=[None, n_H0, n_W0, n_C0]) Y = tf.placeholder(tf.float32, shape=[None, n_y]) - tf.float32: 상수의 데이터형, 꼭 명시해주자. (2) Initialize parameters W1 = tf.get_variable("W1", [4,4,3,8], initializer = tf.contrib.layers.xavier_initializer(seed = 0)) W2 = tf.get_variable("W2", [2,2,8,16], initializer = tf.contrib.layers.xavier_initi..
-
#12. Convolutional Neural Networks: Step by Step연구실 2019. 10. 13. 15:56
* Convolutional Neural Networks (1) Zero-Padding - image 주변에 padding을 추가하는 작업 - Conv layer가 줄어들지 않고 연산을 할 수 있도록 만들어준다. 깊은 레이어로 갈수록 높이와 너비가 줄어들기 때문에 패딩을 넣어주어야 한다. - 'same' convolution: the height/width is exactly preserved after one layer - image의 가장자리에 있는 정보들을 보존해준다. def zero_pad(X, pad): """ Pad with zeros all images of the dataset X. The padding is applied to the height and width of an image, ..
-
#11. Tensorflow Tutorial연구실 2019. 10. 10. 16:10
* Exploring the Tensorflow Library - Tensowflow에서 프로그램을 실행할 때는 다음과 같은 과정을 거친다. (1) Create Tensors(variables) that are not yet executed/evaluated (2) Write operations between those Tensors (3) Initialize the Tensors (4) Create a Session (5) Run the Session. This will run the operation on (2) y_hat = tf.constant(36, name='y_hat') # Define y_hat constant. Set to 36. y = tf.constant(39, name='y') # ..
-
#10. Optimization Methods연구실 2019. 10. 10. 00:37
- 좋은 optimization을 사용하면 learning 속도도 빨라지고 cost function에 들어갈 결과 값도 좋은 값을 얻을 수 있다. - ∂J/∂a=da * Gradient Descent - 가장 간단한 optimization 방법 중 하나이다. - 모든 step에 모든 example들을 사용하게 되면 Batch Gradient Descent라고 한다. - W[l] = W[l] - α*dW[l], b[l]=b[l] - α*db[l] - Stochastic Gradient Descent: 한번에 하나의 training set만 사용해 gradient를 계산 - (Batch) Gradient Descent X = data_input Y = labels parameters = initialize_..
-
#9. Gradient Checking연구실 2019. 10. 7. 16:24
* How does gradient checking work? -Backpropagation은 구현이 매우 어렵기 때문에 버그가 발생해도 어디서부터 고쳐야 할지가 마땅치 않다. 그럴 때 gradient checking을 사용한다. - Backpropagation: ∂J/∂θ * 1-Dimensional gradient checking - 1차원의 linear function J(θ) = θx를 가정해보자. - θ에 대해서 미분하면 ∂J/∂θ =x ⭐️np.linalg.norm(...): 벡터 norm을 계산해 return def gradient_check(x, theta, epsilon = 1e-7): """ Implement the backward propagation presented in Figur..
-
#8. Regularization카테고리 없음 2019. 10. 7. 15:28
- 딥러닝에서 Overfitting 문제가 발생할 가능성이 높다. - 데이터셋 크기가 작은 경우 training set에서는 잘 작동하지만 새로운 예제들에 대해서는 잘 일반화 시키지 못하게 된다. * Non-regularized model - train accuracy는 94.8%, test accuracy는 91.5%이다. 이것을 baseline model이라고 한다, - 이런 식으로 training set에 대해 overfitting 문제가 발생하게 된다. * L2 Regularization - 기존의 cost식: - L2 Regularization; def compute_cost_with_regularization(A3, Y, parameters, lambd): """ Implement the co..