기철민
(Department of Computer Engineering, Korea University of Technology and Education)
,
조태훈
(School of Computer Science and Engineering, Korea University of Technology and Education)
현재 인공지능과 딥 러닝이 사회적인 이슈로 떠오르고 있는 추세이며, 다양한 분야에 이 기술들을 응용하고 있다. 인공지능 분야의 여러 알고리즘들 중에서 각광받는 방법 중 하나는 Convolutional Neural Network이다. Convolutional Neural Network를 적은 양의 데이터에서 이용하거나, Layer의 구조가 복잡하지 않은 경우에는 학습시간이 길지 않아 속도에 크게 신경 쓰지 않아도 되지만, 학습 데이터의 크기가 크고, Layer의 구조가 복잡할수록 학습시간이 상당히 오래 걸린다. 이로 인해 GPU를 이용하여 병렬처리를 하는 방법을 많이 사용하는데, 본 논문에서는 CUDA를 이용한 Convolutional Neural Network를 구현하였으며, 비교에 사용한 Framework/Program들 보다 학습속도가 빨라지고 큰 데이터를 학습 시키는데 더욱 효율적으로 진행하도록 한다.
현재 인공지능과 딥 러닝이 사회적인 이슈로 떠오르고 있는 추세이며, 다양한 분야에 이 기술들을 응용하고 있다. 인공지능 분야의 여러 알고리즘들 중에서 각광받는 방법 중 하나는 Convolutional Neural Network이다. Convolutional Neural Network를 적은 양의 데이터에서 이용하거나, Layer의 구조가 복잡하지 않은 경우에는 학습시간이 길지 않아 속도에 크게 신경 쓰지 않아도 되지만, 학습 데이터의 크기가 크고, Layer의 구조가 복잡할수록 학습시간이 상당히 오래 걸린다. 이로 인해 GPU를 이용하여 병렬처리를 하는 방법을 많이 사용하는데, 본 논문에서는 CUDA를 이용한 Convolutional Neural Network를 구현하였으며, 비교에 사용한 Framework/Program들 보다 학습속도가 빨라지고 큰 데이터를 학습 시키는데 더욱 효율적으로 진행하도록 한다.
Currently, Artificial Intelligence and Deep Learning are rising as hot social issues, and these technologies are applied to various fields. A good method among the various algorithms in Artificial Intelligence is Convolutional Neural Networks. Convolutional Neural Network is a form that adds Convolu...
Currently, Artificial Intelligence and Deep Learning are rising as hot social issues, and these technologies are applied to various fields. A good method among the various algorithms in Artificial Intelligence is Convolutional Neural Networks. Convolutional Neural Network is a form that adds Convolution Layers to Multi Layer Neural Network. If you use Convolutional Neural Networks for small amount of data, or if the structure of layers is not complicated, you don't have to pay attention to speed. But the learning should take long time when the size of the learning data is large and the structure of layers is complicated. In these cases, GPU-based parallel processing is frequently needed. In this paper, we developed Convolutional Neural Networks using CUDA, and show that its learning is faster and more efficient than learning using some other frameworks or programs.
Currently, Artificial Intelligence and Deep Learning are rising as hot social issues, and these technologies are applied to various fields. A good method among the various algorithms in Artificial Intelligence is Convolutional Neural Networks. Convolutional Neural Network is a form that adds Convolution Layers to Multi Layer Neural Network. If you use Convolutional Neural Networks for small amount of data, or if the structure of layers is not complicated, you don't have to pay attention to speed. But the learning should take long time when the size of the learning data is large and the structure of layers is complicated. In these cases, GPU-based parallel processing is frequently needed. In this paper, we developed Convolutional Neural Networks using CUDA, and show that its learning is faster and more efficient than learning using some other frameworks or programs.
* AI 자동 식별 결과로 적합하지 않은 문장이 있을 수 있으니, 이용에 유의하시기 바랍니다.
문제 정의
본 논문에서는 CUDA를 이용하여 Convolutional Neural Network의 구현을 진행했다. 일반적인 CNN에서 사용되는 Layer들의 CUDA 프로그래밍을 진행하였으며[6], 세부적으로 Convolution Layer, Pooling Layer, Fully-connected Layer의 Backpropagation Algorithm을 구현하였다[7].
본 논문에서는 CUDA를 이용한 CNN의 구현을 진행하였으므로, CUDA와 CNN에 대한 간략한 설명을 제시한다.
제안 방법
표 1에서 사용된 Darknet은 C와 CUDA로 작성된 Open Source Neural Network Framework이며, 주로 Real-time Object Detection에 사용된다. Net program은 C로 작성된 CNN 코드이며, 본 논문에서는 Net program을 기반으로 GPU Version의 구현을 진행하였다. CUDA-CNN은 CUDA를 이용해 CNN의 속도 향상을 진행한 프로그램이며, Caffe는 Berkely AI Research에 의해 개발된 Deep Learning Framework로, 다른Framework/Program에 비해 다양한 Layer와 Activation Function을 사용할 수 있다.
다음 Convolution Layer의 Forward Propagation은 총 6개의 반복문 (현재 Layer의 Feature Map 개수, 현재 Layer Feature Map의 Width, Height, 이전 Layer의 Feature Map 개수, Convolution Kernel의 Width, Height)이 사용되며, CUDA에서는 6개의 반복문 모두를 Thread와 Block으로 병렬 구성할 수 없기 때문에, 병렬화하는 부분은 현재 Layer의 Feature Map 개수와 Width, Height 총 3가지를 사용하고, Map 개수는 Block, Width와 Height는 각각 Thread x, y로 설정하며, 내부에 존재하는 3개의 반복문은 Thread 별로 동일하게 동작하도록 한다.
마지막으로 Max-pooling Layer의 Forward Propagation은 총 5개의 반복문(현재 Layer의 Feature Map 개수, Width, Height, Pooling Mask의 Width, Height)이 사용되며, 위의 Convolution Layer와 동일하게 Feature Map 개수는 Block, Map의 Width와 Height는 각각 Thread x, y로 설정하며, Max 값을 추출할 마스크의 반복문은 각 Thread 마다 반복하도록 한다. 이 후 Backpropagation을 위해 Max-pooling 이전 Layer의 Max 값과 index를 저장해둔다.
본 논문에서는 GPGPU 중 하나인 CUDA(Compute Unified Device Architecture)를 이용한 CNN의 구현을 진행하였으며, 실험 및 속도 비교는 기존에 존재하는 Deep Learning Framework / Program과의 비교를 진행하였다.
본 논문에서는 위에서 설명한 방법으로 구현한 CNN 과 기존에 존재하는 Deep Learning Framework/ Program 들 간의 속도 비교를 진행하였으며, Input 영상을 모아서 Delta를 계산하고 Weight Update를 하는 방식인 Batch 방식을 사용하지 않고, SGD(Stochastic Gradient Descent) 방식을 사용하여 매 Input 영상 마다 Weight Update를 진행하는 방식으로 테스트를 진행하였다. 초기 Learning Rate는 0.
이를 CUDA 프로그래밍하면, (현재 Layer의 Neuron 개수)가 CUDA Block의 개수가 되고, (이전 Layer의 Neuron 개수 + 1)개는 Thread의 개수가 된다. 위에서 설명한 연산에 Activation Function에 맞는 연산을 적용시켜 현재 Layer의 Neuron 값으로 확정하며, 본 논문에서는 Activation Function을 Hyperbolic Tangent와 Softmax 두 가지를 구현했다.
그림에서 나타나는 과정은 위에서 설명한 것처럼 Convolution Layer와 Pooling Layer의 반복으로 이루어지며, 최종적으로 나타난 Feature들이 Feedforward Layer와 이어지는 구조로 나타난다. 위의 구조의 과정을 거쳐 나타난 Output값이 분류된 영상의 라벨 값이며, Ground Truth와 비교하여 정확도를 판별한다.
그러므로 2차원의 Block과 Thread를 두고, Index를 주어 두 반복문을 모두 병렬로 계산하도록 한다. 이후 Weight Update 또한 동일한 방식으로 반복문을 병렬로 계산하며, Delta와 Learning Rate를 곱한 값을 기존에 가지고 있던 Weight 값에서 빼주는 연산을 진행한다.
본 논문에서는 CUDA를 이용하여 Convolutional Neural Network의 구현을 진행했다. 일반적인 CNN에서 사용되는 Layer들의 CUDA 프로그래밍을 진행하였으며[6], 세부적으로 Convolution Layer, Pooling Layer, Fully-connected Layer의 Backpropagation Algorithm을 구현하였다[7].
993씩 Learning Rate를 줄이는 방식을 사용하였다. 입력 영상은 CPU 버전의 Elastic Distortion 을 이용하여 Image Processing을 진행했으며, Deep Learning Framework 중 하나인 Caffe Framework는 기본적으로 Elastic Distortion이 없기 때문에 Image Processing을 하지 않은 경우만 구현한 CNN과의 비교를 진행하였다.
첫 번째 수식에서 나오는 δ는 변화량 Delta이며, 두번째 수식의 결과를 이용하여 Weight Update를 진행 한다.
테스트의 실험 환경은 Intel Xeon CPU E3-1225 V5 (3.30GHz, 4-Core), 16GB RAM, GPU는 NVIDIA Geforce GTX 750ti의 시스템에서 진행하였고, OS는 Microsoft Windows 10 64bit, IDE는 Microsoft Visual Studio 2013을 이용하였으며, 실험은 MNIST Dataset의 Training Set을 1 Epoch (60000장) 학습시키는데 걸리는 시간을 측정했다. 테스트에 사용된 CNN의 구조는 아래 그림 3과 같다.
이론/모형
GPGPU는 병렬 처리에 적합한 연산에서 뛰어난 연산 속도를 낼 수 있다는 이점이 있어서 상당히 좋지만, GPU 병렬 프로세싱을 위한 프로그래밍을 작성해야 하며, GPGPU 프로그램 작성을 위해 다양한 방법들이 존재한다. 본 논문에서는 GPGPU 프로그래밍 방법 중 하나인 CUDA를 이용한다.
성능/효과
학습을 1 Epoch 진행하고, Training Set에 대한 정확도는 거의 비슷한 결과가 나오는데, 여기서 차이가 발생할 수 있는 이유는 자료 형에 따라 계산되는 값들의 정확도가 달리지기 때문이며, 위 실험 결과에 따르면 본 논문에서 구현한 방법은 다른 Program이나 Framework들과 비슷하거나, 빠른 속도를 보여주었다. 조금 더 속도를 올리기 위해서는 현재 반복문 안쪽 에서 Index 접근 오류를 방지하기 위해 Atomic 연산을 진행하는데, 이를 Shared Memory를 이용하여 CUDA 커널 함수를 최적화 하는 방법이 있으며, 이는 Atomic 연산에서 사용되는 Synchronize가 없기 때문에 속도 향상에 도움이 될 것이다.
후속연구
또한 더 좋은 하드웨어를 사용하거나, 앞에서 설명한Input 영상을 모아서 계산하는 Batch 방식을 이용하고, CUDA에서 연산이 상당히 빠른 Matrix Multiplication을 이용한다면 더욱 좋은 성능의 CNN을 구현할 수 있을 것으로 보인다.
차후 개선할 문제는 위에서 설명한 속도적인 측면과, 여러 가지 Activation Function과 다용도로 사용할 수 있는 다양한 Layer들의 범용적인 구현이 필요할 것으로 보인다.
질의응답
핵심어
질문
논문에서 추출한 답변
CNN은 무엇인가?
CNN은 다양한 컴퓨터 비전 분야에서 많은 연구가 활발히 진행 중인 인공신경망의 한 종류이다. CNN은일반적으로 몇 개의 층으로 이루어져 있으며, 기본적으로 Convolution Layer, Pooling Layer, Feedforward Layer(Fully-connected Layer)의 3가지의 다른 층을 가지고 있고, 경우에 따라 여러 Layer가 추가되기도 한다.
Fully-connected Layer는 언제 사용되는가?
Feedforward Layer는 일반적인 Multi-Layer Neural Network의 구조와 동일하며, Layer 간의 Neuron들의 연결은 모두 연결되어 Fully-connected Layer라고도 한다. 이는 Convolution Layer와 Pooling Layer의 반복 구조에서 나온 Feature들을 이용하여 분류를 진행할 때 사용된다.
Convolution Layer는 무엇인가?
CNN은일반적으로 몇 개의 층으로 이루어져 있으며, 기본적으로 Convolution Layer, Pooling Layer, Feedforward Layer(Fully-connected Layer)의 3가지의 다른 층을 가지고 있고, 경우에 따라 여러 Layer가 추가되기도 한다. Convolution Layer는 입력한 데이터에 Convolution 연산을 적용하여 Convolution Feature를 추출하는 층이다. 이는 유의미한 자질을 추출하는 층이라고 할 수 있다.
참고문헌 (15)
Y. LeCun, L. Bottou, Y. Bengio, and P.Haffner, "Gradient-Based Learning Applied to Document Recognition," Proceedings of the IEEE, vol. 86, no. 11, pp. 2278-2324, Nov. 1998.
Patrice Y. Simard, Dave Steinkraus, John Platt, "Best Practices for Convolutional Neural Networks Applied to Visual Document Analysis," Proceedings of the ICDAR, pp. 958-962, 2003.
Yann Lecun's Homepage. The MNIST DATABASE of Handwritten Digits [Internet], Available: https://yann.lecun.com/exdb/mnist.
Wikipedia. Description of GPGPU [Internet]. Available: https://ko.wikipedia. org/wiki/GPGPU.
Wikipedia. CUDA Processing Flow [Internet]. Available: https://upload.wikimedia.org/wikipedia/commons/5/59/CUDA_processing_flow_%28En%29.PNG.
J. Long, E. Shelhamer, T. Darrell, "Fully Convolutional Networks for Semantic Segmentation," Proceeding of the CVPR, pp. 3431-3440, 2015.
Y. Huang, K. Li, G. Wang, M. Cao, P. Li, Y. Zhang. (2015, May). Recognition of convolutional neural network based on CUDA technology. arXiv preprint arXiv:1506.00074 [Online]. Available: https://arxiv.org/abs/1506.00074.
Dan C. Ciresan, U. Meier, J. Masci, Luca M. gambardella, J, Schmidhuber. (2011, February). High-Performance Neural Networks for Visual Object Classification. Arxiv preprint arXiv:1102.0183 [Online]. Available: https://arxiv.org/abs/1102.0183.
P. Sermanet, D. Eigen, X. Zhang, M. Mathieu, R. Fergus, and Y. LeCun, "Overfeat: Integrated recognition, localization and detection using convolutional networks," Proceedings of the ICLR, 2014.
Kumar Chellapila, Sidd Puri, and Patrice Simard, "High performance convolutional neural network for document processing", International Workshop on Frontiers in Handwriting Recognition, 2006.
Joseph Chet Redmon's Homepage. Darknet Framework [Internet]. Available: https://pjreddie.com/darknet
Dan Ciresan's Homepage. Net CPU Version Program [Internet]. Available: https://people.idsia.ch/-ciresan/index.htm.
University of Science and Technology of China. CUDA-CNN program [Internet]. Available: https://github.com/zhxfl/CUDA-CNN.
Berkeley AI Research. Caffe framework [Internet]. Available: http://caffe.berkeleyvision.org.
Y.jia, E. Shelhamer, J. Donahue, S. Karayev, J.Long, R. Girshick, S. Guadarrama, and T. Darrell. (2014, June). Caffe: Convolutional architecture for fast feature embedding. arXiv preprint arXiv:1408.5093 [Online]. Available: https://arxiv.org/abs/1408.5093.
※ AI-Helper는 부적절한 답변을 할 수 있습니다.