CNN
https://appsilon.com/ship-recognition-in-satellite-imagery-part-i/
https://appsilon.com/ship-recognition-in-satellite-imagery-part-ii/
Posted by Michal Maj 16 January, 2018
CNN(ConvNets, Convolutional Neural Networks)의 기본 컨셉
CNN 은 deep하고 feed forward한 인공신경망(Artificail neural networks)의 한 종류로써, image/video/audio recognition(인식)문제와 Object detection (탐지)문제등을 풀기 위해 고안되었다.
따라서 문제에 따라 ConvNets의 architecture는 서로 다르지만, 기본적으로는 공통점을 가지고 있다.

첫번째 layer(convolutional layer)
CNN에서 layer중 첫번째 layer는 convolutional layer 이다.
이 Layer는 ConvNets의 core building block이고, filter들의 작은 집합으로 kernel이라 불린다.
이런 kernel과 대응되는 이미지 조각간의 dot product을 하기위해 , 원본이미지의 각 부분에 filter를 위치시킨다.
그런 다음, filter를 다음 위치로 옮겨가면서 같은 dot product을 반복하게 된다. 이때 filters를 움직인 pixels의 갯수는 stride 라고 부른다.
마침내 전체 이미지에 대한 dot product을 하고 나면, 소위 activation map을 얻을 수 있다.

두번째 layer(pooling layer)
CNN에서 layer중 두번째 layer는 pooling layer 이다.
이 layer는 convolutional layer에서 얻은 activation map들의 차원 축소(dimensionality reduction)를 담당한다.
여러가지 pooling 종류가 있지만, max pooling이 가장 일반적으로 사용된다. convolutional layer와 마찬가지로 여러개의 filter와 strides을 가지고 있다.
이미지 일부에 filter를 위치시킨 후에 그 부분에서 최대값을 취하고 strides에서 정한 pixels의 갯수에 따라 다음 영역(region)으로 이동한다.

세번째 layer(activation layer)
CNN에서 layer중 세번째 layer는 activation layer 이다.
이 layer에서는 activation map에 부터 얻은 값은 어떤 activation function에 의해 변형(transform)된다.
activation functions에도 여러 졸류가 있지만, ReLU (rectified linear unit)가 가장 많이 사용된다.

네번째 layer(densely (fully) connected layer)
CNN에서 layer중 네번째 layer는 densely (fully) connected layer 이다. feed-forward 신경망으로 알려진 classical한 output layer이다.
이 layer는 ConvNet의 마지막에 위치시킨다.
CNN’s architecture
ConvNet의 구조를 변경시키는 방법에는 여러가지가 있다. 가장 간단하게 해볼만것은 Layer를 더 추가해 보는 것이다.
초기 Network이 아래와 같다고 하면,

기본적인 Layer(convolutional, pooling, activation)에 새로운 Layer를 추가할수 있다.
Network이 커질수록 더 복잡해지고, 그렇수록 overfitting될 가능성도 높아진다.
overfitting을 막기위해 dropout이라고 불리는 regularization 방법을 사용한다.
dropout에서 각각의 node들은 1-p 확률로 network에서 제거되거나, p확률로 유지된다.
keras내에서 CNN에 dropout를 추가하기 위해서, layer_dropout() 함수를 사용할수 있고, 원하는 확률은 rate 파라미터에 셋팅한다.
