본문 바로가기

분류 전체보기

(49)
include_top의 의미 The inception V3 has a fully-connected layer at the top. So by setting include_top to false, you're specifying that you want to ignore this and get straight to the convolutions. -> top에 fully-connected layer가 있는 경우 include_top=False를 하면 무시하고 바로 convolution으로 가게 해 줌. 근데 fully-connected layer는 보통 bottom에 있지 top에 없지 않나? Tensorflow 공식문서에서 include_top 매개변수 설명을 찾아보니 whether to include the fully-connec..
입력 이미지(input image)를 정규화(normalize)하는 이유 As you may already know, data that goes into neural networks should usually be normalized in some way to make it more amenable to processing by the network. (It is uncommon to feed raw pixels into a convnet.) -> input image를 normalize하면 네트워크가 데이터를 처리하기가 더 쉬워진다고 합니다. 실제로 raw pixel을 그대로 CNN에 넣는 일은 드물다고 하네요. from tensorflow.keras.preprocessing.image import ImageDataGenerator # All images will be re..
ValueError: output array is read-only mnist = tf.keras.datasets.fashion_mnist (training_images, training_labels), (test_images, test_labels) = mnist.load_data() training_images /= 255.0 test_images /= 255.0 model = tf.keras.models.Sequential([ tf.keras.layers.Flatten(), tf.keras.layers.Dense(128, activation=tf.nn.relu), tf.keras.layers.Dense(10, activation=tf.nn.softmax) ]) model.compile(optimizer="adam", loss="sparse_categorical_cr..
sigmoid보다 tanh를 쓰는 이유 1. sigmoid보다 tanh의 기울기가 더 크기 때문이다. 기울기가 더 크면 경사 하강법을 할때 더 큰 step으로 W와 b를 업데이트할 수 있으므로 더 빨리 cost를 0으로 만들 수 있다. cost는 0에 가까울수록 성능이 좋으므로 일반적으로 sigmoid보다 tanh가 성능이 더 좋은 것이다. 2. 기울기 편향을 피할 수 있다. 그래프를 보면 sigmoid는 (0,1)의 범위를 가지고 있고, tanh는 (-1,1)의 범위를 가진다. 모든 입력 벡터가 양수값을 가지고 있을때, 양의 값만을 가지는 sigmoid는 역전파를 할 때 모든 가중치가 같은 방향으로 움직이게 된다. 모두 증가하든지, 모두 감소하든지 말이다. 즉, 이동 방향이 편향될 수 있다는 단점이 있다. 하지만 tanh는 (-1,1) 범위..
[프로그래머스/레벨1] K번째수 풀이 과정 여러 코딩 테스트를 치르면서, 코딩 테스트 문제 푸는 방법을 정했다. 1. 문제를 정독하면서 메모(검은색으로 작성)한다. 주의해야 할 것은 ※으로 표시한다. 2. 알고리즘(분홍색으로 작성)을 떠올리고 적용하려고 노력한다. 3. 필요한 변수에 대해서는 변수명(하늘색으로 작성)을 작성한다. 4. 바로 문제 풀지 말고 주석을 달며 의사 코드를 작성한다. 5. 의사 코드에 맞춰 구현한다. 앞으로 이 순서대로 문제를 풀어볼 예정이다! 1. 문제를 정독하면서 메모한다. 주의해야 할 것은 ※으로 표시한다. 우선 문제 자체는 길지도 않고 어렵지도 않아서 메모할 것이 거의 없었다. 단, 인덱스가 0부터 시작한다는 점을 주의해야 했다. 문제에서 array의 2번째부터 5번째까지 자르면 [5, 2, 6, 3]이라..