반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Elements of AI - Advanced neural network techniques

2018. 6. 25. 04:12 | Posted by 솔웅


반응형

Elements of AI





III.Advanced neural network techniques





In the previous section, we have discussed the basic ideas behind most neural network methods: multilayer networks, non-linear activation functions, and learning rules such as the backpropagation algorithm.


이전 섹션에서는 neural network 방법의 기본 아이디어 인 multilayer networks, non-linear activation functions 및 backpropagation algorithm 과 같은 것들을 알아 보았습니다.




They power almost all modern neural network applications. However, there are some interesting and powerful variations of the theme that have lead to great advances in deep learning in many areas.


그들은 거의 모든 modern neural network applications을 지원합니다. 그것과 관련해 흥미롭고 강력한 여러 다양한 변형들이 나타남으로서 많은 분야에서 deep learning의 큰 진보를 이끌었습니다. 





Convolutional neural networks (CNNs)


One area where deep learning has achieved spectacular success is image processing. The simple classifier that we studied in detail in the previous section is severely limited – as you noticed it wasn't even possible to classify all the smiley faces correctly. By adding more layers in the network and using backpropagation to learn the weights does in principle solve the problem, but another one emerges: the number of weights becomes extremely large and consequently, the amount of training data required to achieve satisfactory accuracy can become too large to be realistic.



deep learning이 큰 성공을 거둔 분야 중 하나는 image processing 분야 입니다. 이전 섹션에서 자세히 공부 한 simple classifier는 굉장히 제한적입니다. 여러분도 모든 웃는 얼굴을 올바르게 분류 할 수는 없다는 것을 눈치 채셨을 겁니다. 네트워크에 더 많은 레이어를 추가하고 backpropagation을 사용하여 weights를 학습하면 원칙적으로 문제가 해결되지만, weights 수가 극도로 커지고 결과적으로 만족할만한 정확도를 달성하는 데 필요한 교육 데이터의 양이 구현하기에는 너무 커질 수 있습니다.



Fortunately, a very elegant solution to the problem of too many weights exists: a special kind of neural networks, or rather, a special kind of layer that can be included in a deep neural network. This special kind of layer is a so called convolutional layer. Networks including convolutional layers are called convolutional neural networks (CNNs). Their key property is that they can detect image features such as bright or dark (or specific color) spots, edges in various orientations, patterns, and so on. These form the basis for detecting more abstract features such as a cat’s ears, a dog’s snout, a person’s eye, or the octagonal shape of a stop sign. It would normally be hard to train a neural network to detect such features based on the pixels of the input image, because the features can appear in different positions, different orientations, and in different sizes in the image: moving the object or the camera angle will change the pixel values dramatically even if the object itself looks just the same to us. In order to learn to detect a stop sign in all these different conditions would require vast of amounts of training data because the network would only detect the sign in conditions where it has appeared in the training data. So, for example, a stop sign in the top right corner of the image would be detected only if the training data included an image with the stop sign in the top right corner. CNNs can recognize the object anywhere in the image no matter where it has been observed in the training images.



다행스럽게도, 너무 많은 weights 문제에 대한 매우 우아한 해결책이 있습니다. 특수한 종류의 neural networks 또는 심층 신경 네트워크에 포함될 수있는 특별한 종류의 계층이 있습니다. 이 특별한 종류의 레이어는 소위 convolutional layer입니다. convolutional 계층을 포함한 네트워크를 convolutional neural networks, CNN 이라고합니다. 그들의 핵심 속성은 밝거나 어두운 (또는 특정 색) 반점, 다양한 방향의 모서리, 패턴 등과 같은 이미지 피처를 감지 할 수 있다는 것입니다. 이들은 고양이의 귀, 개 주둥이, 사람의 눈 또는 정지 신호의 팔각형 모양과 같은 보다 추상적 인 특징을 탐지하기 위한 기초를 형성합니다. 피쳐가 다른 위치, 다른 방향 및 이미지의 다른 크기로 나타날 수 있기 때문에 일반적으로 입력 이미지의 픽셀을 기반으로 이러한 피쳐를 감지하도록 neural networks을 학습하는 것이 어려울 것입니다. 객체 또는 카메라 각도 이동 객체 자체가 우리에게 똑같이 보일지라도 픽셀 값을 극적으로 바꿀 것입니다. 이러한 모든 조건에서 정지 신호를 감지하는 것을 배우려면 네트워크가 교육 데이터에 나타난 징후 만 감지하기 때문에 엄청난 양의 교육 데이터가 필요합니다. 따라서 예를 들어, 오른쪽 상단 모서리에 정지 신호가 있는 이미지가 교육 데이터에 포함 된 경우에만 이미지 오른쪽 상단의 정지 신호가 감지됩니다. CNN은 트레이닝 이미지에서 관찰 된 위치에 관계없이 이미지의 어느 곳에서나 오브젝트를 인식 할 수 있습니다.




AWS DeepLens - Deep learning enabled video camera for developers


아마존 AWS DeepLens는 Deep learning을 배울 수 있는 개발자용 비디오 카메라 입니다.
2018년 6월부터 판매하고 있습니다. 구매를 원하시면 위 이미지 링크를 클릭하세요.




Note

Why we need CNNs

CNNs use a clever trick to reduce the amount of training data required to detect objects in different conditions. The trick basically amounts to using the same input weights for many neurons — so that all of these neurons are activated by the same pattern — but with different input pixels. We can for example have a set of neurons that are activated by a cat’s pointy ear. When the input is a photo of a cat, two neurons are activated, one for the left ear and another for the right. We can also let the neuron’s input pixels be taken from a smaller or a larger area, so that different neurons are activated by the ear appearing in different scales (sizes), so that we can detect a small cat's ears even if the training data only included images of big cats.


CNN은 다른 조건에서 개체를 탐지하는 데 필요한 교육 데이터의 양을 줄이기 위해 영리한 트릭을 사용합니다. 트릭은 기본적으로 많은 뉴런에 대해 동일한 입력 가중치를 사용하므로 모든 뉴런이 동일한 패턴으로 활성화되지만 입력 픽셀은 다릅니다. 우리는 예를 들어 고양이의 뾰족한 귀로 활성화되는 일련의 뉴런을 가질 수 있습니다. 입력 사진이 고양이의 사진 인 경우 두 개의 뉴런이 활성화됩니다. 하나는 왼쪽 귀에, 다른 하나는 오른쪽에 활성화됩니다. 또한 뉴런의 입력 픽셀을 작거나 큰 영역에서 가져 와서 다른 뉴런이 다른 크기 (크기)로 나타나는 귀에 의해 활성화되도록하여 훈련 데이터만으로도 작은 고양이의 귀를 감지 할 수 있습니다 큰 고양이의 이미지가 포함되어 있습니다.



The convolutional neurons are typically placed in the bottom layers of the network, which processes the raw input pixels. Basic neurons (like the perceptron neuron discussed above) are placed in the higher layers, which process the output of the bottom layers. The bottom layers can usually be trained using unsupervised learning, without a particular prediction task in mind. Their weights will be tuned to detect features that appear frequently in the input data. Thus, with photos of animals, typical features will be ears and snouts, whereas in images of buildings, the features are architectural components such as walls, roofs, windows, and so on. If a mix of various objects and scenes is used as the input data, then the features learned by the bottom layers will be more or less generic. This means that pre-trained convolutional layers can be reused in many different image processing tasks. This is extremely important since it is easy to get virtually unlimited amounts of unlabeled training data - images without labels - which can be used to train the bottom layers. The top layers are always trained by supervised machine learning techniques such as backpropagation.



convolutional neurons은 일반적으로 raw input 픽셀을 처리하는 네트워크의 맨 아래 계층에 배치됩니다. 위에서 언급 한 퍼셉트론 뉴런과 같은 기본 뉴런은 상위 계층에 배치되며 하위 계층의 출력을 처리합니다. 맨 아래 계층은 일반적으로 특정 예측 작업을 염두에 두지 않고 unsupervised learning을 사용하여 학습 할 수 있습니다. weights는 입력 데이터에 자주 나타나는 피쳐를 감지하도록 조정됩니다. 따라서 동물의 사진과 함께 전형적인 특징은 귀와 주둥이 일 것이고 건물의 이미지에서는 벽, 지붕, 창 등과 같은 건축 적 구성 요소입니다. 다양한 오브젝트와 장면의 혼합이 입력 데이터로 사용되면 하단 레이어에서 학습 한 기능이 다소 일반적인 것입니다. 이것은 미리 훈련 된 convolutional 레이어가 많은 다른 이미지 처리 작업에서 재사용 될 수 있음을 의미합니다. 분류되지 않은 교육 데이터 (레이블이없는 이미지)를 사실상 무제한으로 쉽게 얻을 수 있기 때문에 이는 매우 중요합니다.이 이미지는 맨 아래 계층을 교육하는 데 사용할 수 있습니다. 최상위 레이어는 항상 역 전파와 같은 supervised machine learning 기술에 의해 교육됩니다.





Do neural networks dream of electric sheep? Generative adversarial networks (GANs)


Having learned a neural network from data, it can be used for prediction. Since the top layers of the network have been trained in a supervised manner to perform a particular classification or prediction task, the top layers are really useful only for that task. A network trained to detect stop signs is useless for detecting handwritten digits or cats.



데이터로부터 neural network를 학습하면 prediction에 사용할 수 있습니다. 네트워크의 최상위 계층이 특정 분류 또는 예측 작업을 수행하기 위해 supervised manner로 교육 되었기 때문에 최상위 계층은 해당 작업에만 유용합니다. 정지 신호를 탐지하도록 훈련 된 네트워크는 handwritten digits 나 고양이를 탐지하는 데 쓸모가 없습니다.



A fascinating result is obtained by taking the pre-trained bottom layers and studying what the features they have learned look like. This can be achieved by generating images that activate a certain set neurons in the bottom layers. Looking at the generated images, we can see what the neural network “thinks” a particular feature looks like, or what an image with a select set of features in it would look like. Some even like to talk about the networks “dreaming” or “hallucinating” images (see Google’s DeepDream system).



매혹적인 결과는 사전 훈련 된 최하층을 취하고 그들이 배운 기능이 어떻게 생겼는지 연구함으로써 얻을 수 있습니다. 이것은 최하위 계층에서 특정 set neurons을 활성화하는 이미지를 생성하여 얻을 수 있습니다. 생성 된 이미지를 살펴보면, 신경망이 특정 기능을 어떻게 보는지, 또는 특정 기능 세트가 있는 이미지가 어떤 모습인지를 알 수 있습니다. 일부는 심지어 "꿈꾸는 dreaming"또는 "환각적인 hallucinating" 이미지 (Google의 DeepDream 시스템 참조)에 대해 이야기하기를 좋아합니다.



Note

Be careful with metaphors

However, we’d like to once again emphasize the problem with metaphors such as dreaming when simple optimization of the input image is meant — remember the suitcase words discussed in Chapter 1. The neural network doesn’t really dream, and it doesn’t have a concept of a cat that it would understand in a similar sense as a human understands. It is simply trained to recognize objects and it can generate images that are similar to the input data that it is trained on.


그러나 우리는 입력 이미지의 단순한 optimization이 의미하는 은유적인 문제가 의미하는 것을 다시한번 강조하고자 합니다. 1 장에서 논의 된 suitcase 단어를 생각해 보세요. neural network은 실제로 꿈도 꾸지도 못합니다. 인간이 이해하는 것과 비슷한 의미로 이해할 수있는 고양이 개념을 가지고 있지 않습니다. 그것은 단순히 물체를 인식하도록 훈련되었으며 훈련 된 입력 데이터와 유사한 이미지를 생성 할 수 있습니다.





To actually generate real looking cats, human faces, or other objects (you’ll get whatever you used as the training data), Ian Goodfellow who currently works at Google Brain, proposed a clever combination of two neural networks. The idea is to let the two networks compete against each other. One of the networks is trained to generate images like the ones in the training data. The other network’s task is to separate images generated by the first network from real images from the training data — it is called the adversarial network, and the whole system is called generative adversarial network or a GAN.



진짜로 보이는 고양이, 인간의 얼굴 또는 다른 객체 (당신이 훈련 데이터로 사용한 것은 무엇이든지)를 생성하기 위해, 현재 Google Brain에서 일하고있는 Ian Goodfellow는 두 개의 신경 네트워크를 영리하게 조합 할 것을 제안했습니다. 아이디어는 두 네트워크가 서로 경쟁하게 하는 것입니다. 네트워크 중 하나는 training data에 있는 것과 같은 이미지를 생성하도록 교육되었습니다. 다른 네트워크의 임무는 첫 번째 네트워크에서 생성 된 이미지를 훈련 데이터의 실제 이미지와 분리하는 것입니다.이 이미지를 adversarial network라고 하며, 전체 시스템을 generative adversarial network 또는 GAN이라고합니다.



The system trains the two models side by side. In the beginning of the training, the adversarial model has an easy task to tell apart the real images from the training data and the clumsy attempts by the generative model. However, as the generative network slowly gets better and better, the adversarial model has to improve as well, and the cycle continues until eventually the generated images are almost indistinguishable from real ones. The GAN tries to not only reproduce the images in the training data: that would be a way too simple strategy to beat the adversarial network. Rather, the system is trained so that it has to be able to generate new, real-looking images too.



이 시스템은 두 모델을 나란히 훈련시킵니다. 훈련이 시작될 때, adversarial 모델은 훈련 데이터로부터 실제 이미지를 분리하고 생성 모델에 의한 서투른 (clumsy) 시도를 쉽게 구분할 수 있습니다. 그러나 generative 네트워크가 서서히 향상되면서 adversarial 모델도 개선되어야 하고 결국 생성 된 이미지가 실제 이미지와 거의 구별되지 않을 때까지 사이클이 계속됩니다. GAN은 훈련 데이터에서 이미지를 재현하는 것뿐만 아니라 adversarial 네트워크를 이길 수 있는 간단한 전략이기도합니다. 오히려 시스템은 새로운 실제 이미지를 생성 할 수 있도록 훈련되어 있습니다.






The above images were generated by a GAN developed by NVIDIA in a project led by Prof Jaakko Lehtinen (see this article for more details).

Could you have recognized them as fakes?



위 이미지는 Jaakko Lehtinen 교수가 이끄는 프로젝트에서 NVIDIA가 개발 한 GAN에 의해 생성되었습니다 (자세한 내용은이 기사 참조).


여러분은 이게 가짜인지 알아 차리실 수 있습니까?






After completing Chapter 5 you should be able to:

  • Explain what a neural network is and where they are being successfully used
  • Understand the technical methods that underpin neural networks




반응형