KR102305981B1 - Method for Training to Compress Neural Network and Method for Using Compressed Neural Network - Google Patents

Method for Training to Compress Neural Network and Method for Using Compressed Neural Network Download PDF

Info

Publication number
KR102305981B1
KR102305981B1 KR1020190120627A KR20190120627A KR102305981B1 KR 102305981 B1 KR102305981 B1 KR 102305981B1 KR 1020190120627 A KR1020190120627 A KR 1020190120627A KR 20190120627 A KR20190120627 A KR 20190120627A KR 102305981 B1 KR102305981 B1 KR 102305981B1
Authority
KR
South Korea
Prior art keywords
neural network
zero
feature maps
image
feature map
Prior art date
Application number
KR1020190120627A
Other languages
Korean (ko)
Other versions
KR20210038027A (en
Inventor
최현철
김민성
Original Assignee
영남대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 영남대학교 산학협력단 filed Critical 영남대학교 산학협력단
Priority to KR1020190120627A priority Critical patent/KR102305981B1/en
Publication of KR20210038027A publication Critical patent/KR20210038027A/en
Application granted granted Critical
Publication of KR102305981B1 publication Critical patent/KR102305981B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Neurology (AREA)
  • Image Analysis (AREA)

Abstract

신경망 압축 훈련 방법 및 압축된 신경망을 이용하는 방법을 개시한다.
본 발명의 일 측면에 의하면, 신경망을 압축하는 방법, 특히 신경망이 학습할 파라미터의 수를 줄여 신경망의 연산 처리량 및 연산 속도를 감소시키는 신경망 압축 방법을 제공한다.
Disclosed are a neural network compression training method and a method using a compressed neural network.
According to one aspect of the present invention, there is provided a method of compressing a neural network, in particular, a neural network compression method of reducing the number of parameters to be learned by the neural network, thereby reducing the computational throughput and the computational speed of the neural network.

Description

신경망 압축 훈련 방법 및 압축된 신경망을 이용하는 방법{Method for Training to Compress Neural Network and Method for Using Compressed Neural Network}{Method for Training to Compress Neural Network and Method for Using Compressed Neural Network}

본 발명의 실시예들은 신경망을 압축하는 방법, 특히 신경망이 학습할 파라미터의 수를 줄여 신경망의 연산 처리량 및 연산 속도를 감소시키는 신경망 압축 방법에 관한 것이다.Embodiments of the present invention relate to a method of compressing a neural network, in particular, a neural network compression method for reducing computational throughput and computation speed of a neural network by reducing the number of parameters to be learned by the neural network.

이 부분에 기술된 내용은 단순히 본 발명에 대한 배경 정보를 제공할 뿐 종래기술을 구성하는 것은 아니다.The content described in this section merely provides background information on the present invention and does not constitute the prior art.

최근 딥러닝(deep learning)을 기반으로 하는 이미지 분류 방법 또는 이미지 스타일 전환 방법(image style transfer)은 수많은 채널(channel)을 가지는 신경망(neural network)을 이용한다. 이러한 신경망은 일반적인 이미지 분류 작업 또는 이미지 스타일 전환 방법을 수행하기 위해 많은 수의 파라미터들(parameters)을 학습해야한다. 신경망이 학습해야하는 파라미터가 많을수록 프로세서의 연산 처리량 및 소모 전력이 기하급수적으로 증가하는 문제점이 있다. 따라서, 프로세서의 연산 처리량, 처리속도 및 전력소모 측면에서 신경망을 압축할 필요가 있다.Recently, an image classification method or image style transfer method based on deep learning uses a neural network having numerous channels. Such a neural network needs to learn a large number of parameters to perform a general image classification task or image style conversion method. As the number of parameters that the neural network needs to learn increases, there is a problem in that the processing throughput and power consumption of the processor increase exponentially. Therefore, it is necessary to compress the neural network in terms of processing throughput, processing speed, and power consumption of the processor.

신경망을 압축하기 위해 채널 프루닝(channel pruning) 방법이 고안되었다. 채널 프루닝 방법은 신경망의 손실 함수(loss function)가 특정한 기준까지 줄어들 때까지 파라미터를 학습한 후, 신경망에서 크기가 작은 파라미터(또는 가중치, weight)를 제거하도록 신경망을 훈련하는 방법이다. A channel pruning method has been devised to compress neural networks. The channel pruning method is a method of training a neural network to remove small parameters (or weights) from a neural network after learning parameters until the loss function of the neural network is reduced to a specific criterion.

특히, 컨볼루션 신경망(convolution neural network)에서 사용되는 종래의 채널 프루닝 방법은 두 가지 단계로 수행된다. 첫 번째 단계는 훈련된 신경망에서 필터 파라미터 중 크기가 작은 파라미터를 제거하여 신경망을 압축하는 단계이며, 두 번째 단계는 압축된 신경망의 필터 파라미터를 다시 훈련시키는 단계이다. In particular, the conventional channel pruning method used in a convolutional neural network is performed in two steps. The first step is a step of compressing the neural network by removing a parameter with a small size among filter parameters from the trained neural network, and the second step is a step of re-training the filter parameters of the compressed neural network.

하지만, 기존 채널 프루닝 방법은 컨볼루션 신경망에 입력되는 입력 특징맵에 포함된 엘리먼트(element)의 크기를 고려하지 않은 채 필터 파라미터의 크기만을 고려하여, 크기가 작은 파라미터를 제거한다. 컨볼루션 신경망에서 필터 파라미터의 크기가 작더라도 입력 특징맵에 포함된 엘리먼트의 크기가 큰 경우, 필터는 크기가 큰 엘리먼트를 포함하는 특징맵을 생성할 수 있다. 이처럼, 입력 특징맵의 크기에 상관없이 크기가 작은 필터 파라미터를 모두 제거한다면, 크기가 작은 필터 파라미터에 의해 생성될 수 있는 크기가 큰 출력 특징맵까지 제거되므로 신경망의 성능을 저하시키는 문제점이 있다.However, the existing channel pruning method considers only the size of the filter parameter without considering the size of an element included in the input feature map input to the convolutional neural network, and removes a parameter with a small size. In the convolutional neural network, even if the size of the filter parameter is small, when the size of an element included in the input feature map is large, the filter may generate a feature map including the large size element. As such, if all small filter parameters are removed regardless of the size of the input feature map, the large output feature map that can be generated by the small filter parameter is also removed, thereby degrading the performance of the neural network.

또한, 종래의 채널 프루닝 방법은 신경망을 압축하는 단계를 수행한 후에 압축된 신경망의 필터 파라미터를 다시 훈련시키는 단계를 추가적으로 수행해야 한다. 이는, 필터 파라미터를 제거하는 단계에 의한 성능 저하를 보상하기 위한 과정이다. 따라서, 종래의 채널 프루닝 방법은 신경망을 압축하는 과정과 재훈련하는 과정을 거쳐야 하므로, 신경망을 훈련하는 데 필요한 시간이 증가한다는 문제점이 있다.In addition, in the conventional channel pruning method, after performing the step of compressing the neural network, the step of re-training the filter parameters of the compressed neural network should be additionally performed. This is a process for compensating for performance degradation caused by the step of removing the filter parameter. Therefore, the conventional channel pruning method has a problem in that the time required to train the neural network increases because it has to go through a process of compressing and retraining the neural network.

본 발명의 실시예들은, 신경망 내 필터에 입력되는 입력 특징맵의 크기에 상관없이 필터에 의해 생성되는 특징맵에 기초하여 제로 특징맵을 생성하는 필터를 제거함으로써, 신경망이 학습할 파라미터의 수를 줄이는 데 주된 목적이 있다. In the embodiments of the present invention, the number of parameters for the neural network to learn by removing the filter that generates a zero feature map based on the feature map generated by the filter regardless of the size of the input feature map input to the filter in the neural network The main purpose is to reduce

본 발명의 다른 일 실시예는, 임의의 이미지에 대해 필터가 모두 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하도록 훈련시킨 뒤 제로 특징맵을 생성하는 필터를 제거함으로써, 신경망의 성능을 유지함과 동시에 학습 파라미터의 수를 줄이는 데 일 목적이 있다.Another embodiment of the present invention maintains the performance of the neural network by removing the filter generating the zero feature map after training the filter to output all zero feature maps or all non-zero feature maps for an arbitrary image. At the same time, it aims to reduce the number of learning parameters.

본 발명의 일 측면에 의하면, 복수의 이미지를 포함하는 복수의 배치에 대해 복수의 필터를 이용하여 특징맵들을 생성하는 신경망을 압축하는 훈련 방법에 있어서, 상기 복수의 배치를 획득하고, 상기 복수의 배치를 상기 신경망에 제공하는 과정; 및 각 배치마다 상기 신경망의 파라미터를 갱신하는 과정을 포함하며, 상기 갱신하는 과정은, 상기 신경망을 이용하여 상기 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득하는 과정; 상기 각 이미지들에 대응하는 상기 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분하는 과정; 및 상기 제로 특징맵의 수, 및 상기 복수의 이미지 중 서로 다른 두 이미지에 대해 모두 제로 특징맵 또는 논제로 특징맵을 출력하는 필터의 수를 이용하여 상기 신경망의 파라미터를 수정하는 과정을 포함하되, 상기 제로 특징맵은 모든 엘리먼트가 0인 특징맵이고, 상기 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵인 훈련 방법을 제공한다.According to an aspect of the present invention, in a training method for compressing a neural network that generates feature maps using a plurality of filters for a plurality of batches including a plurality of images, obtaining the plurality of batches, providing an arrangement to the neural network; and updating the parameters of the neural network for each batch, wherein the updating includes: acquiring a plurality of feature maps corresponding to each image included in the batch using the neural network; classifying the plurality of feature maps corresponding to the respective images into a zero feature map and a non-zero feature map; and modifying the parameters of the neural network using the number of zero feature maps and the number of filters that output both zero feature maps or non-zero feature maps for two different images among the plurality of images, The zero feature map is a feature map in which all elements are 0, and the non-zero feature map provides a training method in which at least one of the elements is a non-zero feature map.

본 실시예의 다른 측면에 의하면, 이미지 처리 방법으로서, 입력 이미지를 획득하는 과정; 상기 입력 이미지를 제1신경망에 제공하는 과정, 상기 제1신경망은 복수의 필터를 이용하여 상기 입력 이미지에 대한 특징맵들을 생성함; 및 제2신경망이 상기 제1신경망으로부터 수신한 상기 특징맵들을 이용하여 상기 이미지를 처리한 결과를 획득하는 과정을 포함하고, 상기 제1신경망은 복수의 이미지를 포함하는 복수의 배치에 대해 상기 제2신경망과 함께 훈련된 것이며, 훈련 방법은 각 배치마다 상기 제1신경망을 이용하여 상기 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득하는 과정; 각 이미지들에 대응하는 상기 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분하는 과정; 및 상기 제로 특징맵의 수, 및 상기 복수의 이미지 중 서로 다른 두 이미지에 대해 모두 제로 특징맵 또는 논제로 특징맵을 출력하는 필터의 수를 이용하여 상기 제1신경망의 파라미터들을 수정하는 과정을 포함하되, 상기 제로 특징맵은 모든 엘리먼트(element)가 0인 특징맵이고, 상기 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵인 이미지 처리 방법을 제공한다.According to another aspect of this embodiment, there is provided an image processing method, comprising: acquiring an input image; providing the input image to a first neural network, wherein the first neural network generates feature maps for the input image using a plurality of filters; and obtaining, by a second neural network, a result of processing the image using the feature maps received from the first neural network, wherein the first neural network performs the first processing for a plurality of batches including a plurality of images. It is trained together with two neural networks, and the training method includes: obtaining a plurality of feature maps corresponding to each image included in the batch by using the first neural network for each batch; classifying the plurality of feature maps corresponding to each image into a zero feature map and a non-zero feature map; and modifying parameters of the first neural network using the number of zero feature maps and the number of filters that output both zero feature maps or non-zero feature maps for two different images among the plurality of images. However, the zero feature map is a feature map in which all elements are 0, and the non-zero feature map provides an image processing method in which at least one of the elements is a non-zero feature map.

이상에서 설명한 바와 같이 본 발명의 일 실시예에 의하면, 신경망 내 필터에 입력되는 입력 특징맵의 크기에 상관없이 필터에 의해 생성되는 특징맵에 기초하여 제로 특징맵을 생성하는 필터를 제거함으로써, 신경망이 학습할 파라미터의 수를 줄여 신경망의 연산 처리량 및 연산 속도를 감소시킬 수 있다.As described above, according to an embodiment of the present invention, a filter for generating a zero feature map based on the feature map generated by the filter is removed regardless of the size of the input feature map input to the filter in the neural network, thereby making the neural network By reducing the number of parameters to learn, the computational throughput and computational speed of the neural network can be reduced.

본 발명의 다른 일 실시예에 의하면, 임의의 이미지에 대해 필터가 모두 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하도록 훈련시킨 뒤 제로 특징맵을 생성하는 필터를 제거함으로써, 신경망의 성능을 유지함과 동시에 학습 파라미터의 수를 줄여 신경망의 연산 처리량 및 연산 속도를 감소시킬 수 있다.According to another embodiment of the present invention, the performance of the neural network is improved by removing the filter generating the zero feature map after training the filter to output all zero feature maps or all non-zero feature maps for an arbitrary image. At the same time, it is possible to reduce the number of learning parameters while reducing the computational throughput and computational speed of the neural network.

도 1a 및 도 1b는 컨볼루션 신경망에서 신경망을 압축하는 방법 중 채널 프루닝 방법을 설명하기 위한 도면이다.
도 2는 본 발명의 일 실시예에 따른 신경망을 압축하는 과정을 설명하기 위한 도면이다.
도 3은 본 발명의 일 실시예에 따른 신경망 압축 방법을 수학식으로 설명하기 위한 도면이다.
도 4는 본 발명의 일 실시예에 따른 신경망의 압축 훈련 방법을 나타내는 순서도이다.
도 5는 본 발명의 일 실시예에 따른 압축된 신경망을 이용하는 방법을 설명하기 위한 순서도이다.
1A and 1B are diagrams for explaining a channel pruning method among methods of compressing a neural network in a convolutional neural network.
2 is a diagram for explaining a process of compressing a neural network according to an embodiment of the present invention.
3 is a diagram for explaining a neural network compression method according to an embodiment of the present invention by an equation.
4 is a flowchart illustrating a compression training method of a neural network according to an embodiment of the present invention.
5 is a flowchart illustrating a method of using a compressed neural network according to an embodiment of the present invention.

이하, 본 발명의 일부 실시예들을 예시적인 도면을 통해 상세하게 설명한다. 각 도면의 구성요소들에 참조부호를 부가함에 있어서, 동일한 구성요소들에 대해서는 비록 다른 도면상에 표시되더라도 가능한 한 동일한 부호를 가지도록 하고 있음에 유의해야 한다. 또한, 본 발명을 설명함에 있어, 관련된 공지 구성 또는 기능에 대한 구체적인 설명이 본 발명의 요지를 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명은 생략한다.Hereinafter, some embodiments of the present invention will be described in detail with reference to exemplary drawings. In adding reference numerals to the components of each drawing, it should be noted that the same components are given the same reference numerals as much as possible even though they are indicated on different drawings. In addition, in describing the present invention, if it is determined that a detailed description of a related known configuration or function may obscure the gist of the present invention, the detailed description thereof will be omitted.

또한, 본 발명의 구성 요소를 설명하는 데 있어서, 제 1, 제 2, A, B, (a), (b) 등의 용어를 사용할 수 있다. 이러한 용어는 그 구성 요소를 다른 구성 요소와 구별하기 위한 것일 뿐, 그 용어에 의해 해당 구성 요소의 본질이나 차례 또는 순서 등이 한정되지 않는다. 명세서 전체에서, 어떤 부분이 어떤 구성요소를 '포함', '구비'한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다. 또한, 명세서에 기재된 '~부', '모듈' 등의 용어는 적어도 하나의 기능이나 동작을 처리하는 단위를 의미하며, 이는 하드웨어나 소프트웨어 또는 하드웨어 및 소프트웨어의 결합으로 구현될 수 있다.In addition, in describing the components of the present invention, terms such as first, second, A, B, (a), (b), etc. may be used. These terms are only for distinguishing the components from other components, and the essence, order, or order of the components are not limited by the terms. Throughout the specification, when a part 'includes' or 'includes' a certain component, it means that other components may be further included, rather than excluding other components, unless otherwise stated. . In addition, terms such as '~ unit' and 'module' described in the specification mean a unit that processes at least one function or operation, which may be implemented as hardware or software or a combination of hardware and software.

도 1a 및 도 1b는 컨볼루션 신경망에서 신경망을 압축하는 방법 중 채널 프루닝 방법을 설명하기 위한 도면이다.1A and 1B are diagrams for explaining a channel pruning method among methods of compressing a neural network in a convolutional neural network.

도 1a를 참조하면, 입력 특징맵(feature map, 100), 커널(kernel), 즉 제1필터(102), 중간 특징맵(104), 제2필터(106) 및 출력 특징맵(108)이 예시된다.Referring to FIG. 1A , an input feature map 100, a kernel, that is, a first filter 102, an intermediate feature map 104, a second filter 106, and an output feature map 108 are is exemplified

입력 특징맵(100)은 입력 이미지로부터 추출되며, 3개의 채널을 가지는 것으로 설명한다. 3개의 입력 특징맵(100)이 5개의 제1필터(102)에 입력된다. 각 필터는 3개의 채널에 대해 하나의 중간 특징맵(104)를 생성한다. 즉, 중간 특징맵(104)의 개수는 제1필터의 개수에 의해 정해진다. 5개의 중간 특징맵(104)는 2개의 제2필터(106)에 입력되고, 각 필터는 5개의 중간 특징맵(104)에 대해 2개의 출력 특징맵(108)을 생성한다.The input feature map 100 is extracted from the input image and will be described as having three channels. Three input feature maps 100 are input to five first filters 102 . Each filter generates one intermediate feature map 104 for three channels. That is, the number of intermediate feature maps 104 is determined by the number of first filters. The five intermediate feature maps 104 are input to two second filters 106 , and each filter generates two output feature maps 108 for the five intermediate feature maps 104 .

채널 프루닝 방법을 적용하기 위해, 필터에 포함된 파라미터의 크기가 작은 필터를 제거한다. 5개의 제1필터(102) 중 2개의 필터에 포함된 파라미터의 크기가 작을 때, 2개의 필터에 대해 신경망의 성능에 영향을 미치지 않는 필터라고 판단하고, 2개의 필터에 의해 생성되는 2개의 중간 특징맵 또한 신경망의 성능에 영향을 미치지 않는 특징맵으로 판단할 수 있다. In order to apply the channel pruning method, a filter with a small parameter included in the filter is removed. When the size of parameters included in two of the five first filters 102 is small, it is determined that the two filters are filters that do not affect the performance of the neural network, and two intermediates generated by the two filters The feature map can also be determined as a feature map that does not affect the performance of the neural network.

도 1b를 참조하면, 크기가 작은 파라미터로 이루어진 2개의 필터를 제거한 후 신경망을 재훈련(re-training)하는 과정이 나타난다.Referring to FIG. 1B , a process of re-training the neural network after removing two filters with small parameters is shown.

3개의 입력 특징맵(100)은 3개의 제1필터(112)에 입력되고, 3개의 제1필터(112)는 3개의 중간 특징맵(114)를 생성한다. 3개의 중간 특징맵(114)는 2개의 제2필터(116)에 입력되고, 2개의 제2필터(116)는 2개의 출력 특징맵(118)을 생성한다.The three input feature maps 100 are input to the three first filters 112 , and the three first filters 112 generate three intermediate feature maps 114 . The three intermediate feature maps 114 are input to the two second filters 116 , and the two second filters 116 generate two output feature maps 118 .

이때, 2개의 필터가 제거되기 전, 2개의 필터에 의해 생성되는 2개의 중간 특징맵도 2개의 필터와 함께 제거된다. 이때, 2개의 필터에 포함된 파라미터의 크기가 작더라도, 2개의 중간 특징맵은 크기가 큰 파라미터를 포함할 수 있다. 즉, 2개의 필터를 제거함으로써 신경망의 성능에 영향을 줄 수 있는 특징맵까지 제거되므로, 신경망의 성능이 저하될 수 있다.At this time, before the two filters are removed, the two intermediate feature maps generated by the two filters are also removed together with the two filters. In this case, even if the size of the parameter included in the two filters is small, the two intermediate feature maps may include the parameter having a large size. That is, by removing the two filters, even the feature map that can affect the performance of the neural network is removed, so the performance of the neural network may be degraded.

5개의 입력 필터 중 2개의 필터가 제거되어 신경망의 성능이 저하되는 것을 방지하기 위해, 신경망은 3개의 제1필터(112)에 포함된 파라미터를 다시 훈련하는 과정을 수행한다. In order to prevent the performance of the neural network from being deteriorated by removing two of the five input filters, the neural network performs a process of retraining the parameters included in the three first filters 112 .

도 2는 본 발명의 일 실시예에 따른 신경망을 압축하는 과정을 설명하기 위한 도면이다.2 is a diagram for explaining a process of compressing a neural network according to an embodiment of the present invention.

도 2를 참조하면, 제1이미지(210), 제2 이미지(220), 신경망(230), 4개의 필터(232, 234, 236, 238), 제1 이미지에 대한 4개의 제1 특징맵들(212, 214, 216, 218) 및 제2 이미지에 대한 4개의 제2 특징맵들(222, 224, 226, 228)이 나타나 있다.Referring to FIG. 2 , a first image 210 , a second image 220 , a neural network 230 , four filters 232 , 234 , 236 , 238 , and four first feature maps for the first image (212, 214, 216, 218) and four second feature maps (222, 224, 226, 228) for the second image are shown.

제1 이미지(210) 및 제2 이미지(220)는 신경망의 훈련 데이터이다. 다만, 제1 이미지(210) 및 제2 이미지(220)는 하나의 실시예일뿐, 이에 한정되지 않고 복수의 글자들을 다차원 행렬로 표현한 데이터일 수 있다.The first image 210 and the second image 220 are training data of the neural network. However, the first image 210 and the second image 220 are only one embodiment, and are not limited thereto, and may be data in which a plurality of characters are expressed in a multidimensional matrix.

신경망(230)은 4개의 필터(232, 234, 236, 238)을 포함하나, 이는 하나의 실시예일뿐, 복수의 필터를 포함할 수도 있다. 신경망(230)은 제1 이미지(210) 및 제2 이미지(220)을 제공받고, 4개의 필터(232, 234, 236, 238)을 이용하여 특징맵들을 생성한다. 제1 특징맵들(212, 214, 216, 218) 및 제2 특징맵들(222, 224, 226, 228)은 각 특징맵마다 복수의 엘리먼트를 포함한다.The neural network 230 includes four filters 232 , 234 , 236 , and 238 , but this is only one embodiment and may include a plurality of filters. The neural network 230 receives the first image 210 and the second image 220 , and generates feature maps using four filters 232 , 234 , 236 , and 238 . The first feature maps 212 , 214 , 216 , and 218 and the second feature maps 222 , 224 , 226 , and 228 include a plurality of elements for each feature map.

제1 특징맵들(212, 214, 216, 218)은 신경망(230)이 제1 이미지(210)에 대해 생성한 특징맵들이며, 제2 특징맵들(222, 224, 226, 228)은 신경망(230)이 제2 이미지(220)에 대해 생성한 특징맵들이다. 구체적으로, 제1 필터(232)는 제1 이미지에 대한 특징맵(212) 및 제2 이미지에 대한 특징맵(222)를 생성한다. 마찬가지로, 제2 필터(234), 제3 필터(236) 및 제4 필터(238)는 각각 제1 이미지에 대한 특징맵들(214, 216, 218) 및 제2 이미지에 대한 특징맵들(224, 226, 228)를 생성한다.The first feature maps 212 , 214 , 216 , and 218 are feature maps generated by the neural network 230 for the first image 210 , and the second feature maps 222 , 224 , 226 , 228 are neural networks 230 are feature maps generated with respect to the second image 220 . Specifically, the first filter 232 generates a feature map 212 for the first image and a feature map 222 for the second image. Similarly, the second filter 234 , the third filter 236 , and the fourth filter 238 include feature maps 214 , 216 , 218 for the first image and feature maps 224 for the second image, respectively. , 226, 228).

제1 특징맵들(212, 214, 216, 218) 및 제2 특징맵들(222, 224, 226, 228)은 제로 특징맵(zero feature map)과 논제로 특징맵(non-zero feature map)으로 구분된다. 여기서, 제로 특징맵은 모든 엘리먼트(element)의 값이 0인 특징맵을 의미하고, 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵을 의미한다. 제1 특징맵들 중 일부(212, 214)는 논제로 특징맵이며, 제1 특징맵들 중 나머지(216, 218)는 제로 특징맵이다. 제2 특징맵들 중 일부(214, 216)는 논제로 특징맵이며, 제2 특징맵들 중 나머지(212, 218)는 제로 특징맵이다.The first feature maps 212, 214, 216, 218 and the second feature maps 222, 224, 226, 228 are a zero feature map and a non-zero feature map. is divided into Here, the zero feature map means a feature map in which the values of all elements are 0, and the non-zero feature map means a feature map in which at least one of the elements is not zero. Some of the first feature maps 212 and 214 are non-zero feature maps, and others 216 and 218 of the first feature maps are zero feature maps. Some of the second feature maps 214 and 216 are non-zero feature maps, and others 212 and 218 of the second feature maps are zero feature maps.

신경망(230)의 파라미터는 제로 특징맵들(216, 218, 222, 228)의 수, 제1 이미지(210) 및 제2 이미지(220)에 대해 모두 제로 특징맵을 출력하는 필터(238)의 수에 부분적으로 기초하여 수정될 수 있다.The parameters of the neural network 230 are the number of zero feature maps 216 , 218 , 222 , and 228 , the first image 210 and the second image 220 of the filter 238 that outputs zero feature maps. It can be modified based in part on the number.

본 발명의 일 실시예에 따른 신경망을 압축하는 훈련 방법은 제1 이미지(210) 및 제2 이미지(220)에 대해 모두 제로 특징맵을 생성하거나 모두 논제로 특징맵을 생성하는 필터의 수가 증가되도록 신경망(230)의 파라미터를 수정한다.The training method for compressing the neural network according to an embodiment of the present invention is such that the number of filters that generate both zero feature maps or all non-zero feature maps for the first image 210 and the second image 220 increases. The parameters of the neural network 230 are modified.

본 발명의 다른 실시예에 따른 신경망을 압축하는 훈련 방법은 제1 이미지(210) 및 제2 이미지(220)에 대해 생성된 복수의 특징맵 중 제로 특징맵 의 수가 증가되도록 신경망(230)의 파라미터를 수정한다.A training method for compressing a neural network according to another embodiment of the present invention is a parameter of the neural network 230 such that the number of zero feature maps among a plurality of feature maps generated for the first image 210 and the second image 220 is increased. to correct

본 발명의 일 실시예에 따른 신경망을 압축하는 훈련 방법은 복수의 배치(batch)에 대해 각 배치 단위로 신경망의 파라미터를 갱신할 수 있다. 여기서, 배치는 훈련 데이터인 복수의 이미지를 포함하는 단위이다. 복수의 배치에 대해 신경망의 파라미터를 갱신한 후, 복수의 이미지 중 서로 다른 두 이미지를 신경망에 제공한다. 신경망에 포함된 복수의 필터 중 서로 다른 두 이미지에 대해 모두 제로 특징맵을 생성하는 필터를 제거한다.The training method for compressing a neural network according to an embodiment of the present invention may update parameters of the neural network in units of each batch for a plurality of batches. Here, the batch is a unit including a plurality of images that are training data. After updating the parameters of the neural network for a plurality of batches, two different images among the plurality of images are provided to the neural network. Among a plurality of filters included in the neural network, a filter that generates a zero feature map for two different images is removed.

구체적으로, 신경망을 압축하는 훈련 방법은 복수의 배치 중 하나의 배치를 신경망에 제공하고, 신경망을 이용하여 하나의 배치에 포함된 각 이미지에 대응하는 복수의 특징맵을 획득한다. 각 이미지에 대응하는 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분한다. 하나의 배치에 포함된 서로 다른 두 이미지에 대해 모두 제로 특징맵 또는 논제로 특징맵을 출력하는 필터의 수 및 제로 특징맵의 수에 기초하여 신경망의 파라미터를 수정할 수 있다. 이후, 위의 과정을 각 배치마다 반복하여 수행함으로써 신경망을 훈련할 수 있다. 예를 들어, 2개의 배치가 주어지고, 각 배치는 8개의 이미지를 포함할 때, 신경망 훈련 방법은 하나의 배치에 대해 신경망의 파라미터를 총 28번 갱신할 수 있다. 28번은 C(8, 2)로부터 계산되며, C(8, 2)는 8개의 이미지 중 서로 다른 두 이미지의 조합을 의미한다.Specifically, the training method for compressing a neural network provides one batch of a plurality of batches to the neural network, and acquires a plurality of feature maps corresponding to each image included in one batch by using the neural network. A plurality of feature maps corresponding to each image are divided into a zero feature map and a non-zero feature map. The parameters of the neural network may be modified based on the number of filters that output zero feature maps or non-zero feature maps and the number of zero feature maps for two different images included in one batch. Thereafter, the neural network can be trained by repeating the above process for each batch. For example, when two batches are given, and each batch includes eight images, the neural network training method can update the parameters of the neural network for one batch a total of 28 times. Number 28 is calculated from C(8, 2), and C(8, 2) means a combination of two different images among eight images.

도 2에서 설명한 과정들을 통해 압축된 신경망을 훈련할 수 있으며, 신경망의 파라미터에 대한 훈련 및 압축이 동시에 이루어지므로, 신경망이 학습하는 파라미터의 수가 줄어들되, 별도의 재훈련 과정이 요구되지 않고 신경망의 성능이 유지된다. The compressed neural network can be trained through the processes described in FIG. 2, and since training and compression of the parameters of the neural network are performed at the same time, the number of parameters the neural network learns is reduced, but a separate retraining process is not required. performance is maintained.

도 3은 본 발명의 일 실시예에 따른 신경망 압축 방법을 수학식으로 설명하기 위한 도면이다.3 is a diagram for explaining a neural network compression method according to an embodiment of the present invention by an equation.

본 발명의 일 실시예에 따른 신경망 압축 훈련 방법은 두 개의 손실(loss)이 포함된 손실함수를 이용한다. 두 개의 손실은 채널 로스(channel loss)와 xor 로스(exclusive or loss)이다. The neural network compression training method according to an embodiment of the present invention uses a loss function including two losses. The two losses are channel loss and xor loss (exclusive or loss).

채널 로스는 컨볼루션 레이어로부터 출력되는 복수의 특징맵 중 제로 특징맵의 수를 증가시키는 파라미터이다. 즉, 채널 로스가 적을수록 출력 특징맵 중 제로 특징맵이 많아진다. The channel loss is a parameter that increases the number of zero feature maps among a plurality of feature maps output from the convolutional layer. That is, as the channel loss decreases, the number of zero feature maps among the output feature maps increases.

xor 로스는 입력 이미지가 달라지더라도 제로 특징맵을 생성하는 필터를 제거하기 위한 파라미터이다. xor 로스를 이용하여 두 입력 이미지에 대해 모두 제로 특징맵을 생성하거나 모두 논제로 특징맵을 생성하는 필터의 수를 증가시킬 수 있다. 즉, xor 로스가 작을수록 임의의 입력 이미지에 대해 항상 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하는 필터의 수가 증가한다. The xor loss is a parameter for removing the filter that generates the zero feature map even if the input image is different. By using xor loss, we can increase the number of filters that generate both zero feature maps or all non-zero feature maps for both input images. That is, as the xor loss is smaller, the number of filters that always output zero feature maps or all non-zero feature maps for an arbitrary input image increases.

본 발명의 일 실시예는 두 손실을 이용하여 임의의 이미지에 대해 항상 제로 특징맵을 생성하는 필터를 제거함으로써, 신경망의 성능을 유지하되 신경망의 학습 파라미터 수를 줄일 수 있다.An embodiment of the present invention can reduce the number of learning parameters of the neural network while maintaining the performance of the neural network by removing the filter that always generates a zero feature map for an arbitrary image by using the two losses.

도 3을 참조하면, B는 신경망의 파라미터를 갱신하는 단위이며, 컨볼루션 레이어는 신경망에 포함되고 복수의 필터를 포함하되 복수의 특징맵을 출력하는 구성이다.

Figure 112019099758024-pat00001
은 L번째 컨볼루션 레이어로부터 출력되는 특징맵들이고,
Figure 112019099758024-pat00002
은 L번째 레이어로부터 출력되는 특징맵들의 개수를 나타내는 채널이다. Referring to FIG. 3 , B is a unit for updating parameters of a neural network, and a convolution layer is included in the neural network and includes a plurality of filters, but outputs a plurality of feature maps.
Figure 112019099758024-pat00001
are the feature maps output from the L-th convolutional layer,
Figure 112019099758024-pat00002
is a channel indicating the number of feature maps output from the L-th layer.

본 발명의 일 실시예에 따른 훈련 방법은 배치 B에 포함된 이미지 i 및 이미지 j를 신경망에 제공하고, 신경망에 포함된 컨볼루션 레이어 l로부터 특징맵들을 획득한다. 이후, 이미지 i에 대한 복수의 특징맵인

Figure 112019099758024-pat00003
와 이미지 j에 대한 복수의 특징맵인
Figure 112019099758024-pat00004
에 대해 L0-정규화(L0-normalization)를 통해 제로 특징맵과 논제로 특징맵으로 구분한다. xor 로스는 이미지 i 및 이미지 j에 대해 모두 제로 특징맵을 생성하거나 모두 논제로 특징맵을 생성하는 필터의 수를 합한 값에 부분적으로 기초하여 계산된다. 채널 로스는 이미지 i 및 이미지 j에 대해 논제로 특징맵을 생성하는 필터의 수를 모두 합한 값에 부분적으로 기초하여 계산된다.A training method according to an embodiment of the present invention provides image i and image j included in batch B to a neural network, and acquires feature maps from a convolution layer l included in the neural network. After that, a plurality of feature maps for image i
Figure 112019099758024-pat00003
and multiple feature maps for image j.
Figure 112019099758024-pat00004
is divided into a zero feature map and a non-zero feature map through L0-normalization. The xor loss is calculated based in part on the sum of the number of filters that generate both zero feature maps or all non-zero feature maps for image i and image j. The channel loss is calculated based in part on the sum of the number of filters that generate non-zero feature maps for image i and image j.

구체적으로, 채널 로스 및 xor 로스는 각각 수학식 1 및 수학식 2에 의해 계산된다. 수학식 1 및 수학식 2에서

Figure 112019099758024-pat00005
는 L0-norm으로서, 특징맵 x에 포함된 모든 엘리먼트가 0이면 0을 반환하고, 엘리먼트 중 적어도 하나가 0이 아니면 1을 반환하는 기호이다. 또한, 수학식 2에서 t는 채널의 인덱스(index)를 의미한다.Specifically, the channel loss and the xor loss are calculated by Equations 1 and 2, respectively. In Equation 1 and Equation 2
Figure 112019099758024-pat00005
is a L0-norm, a symbol that returns 0 if all elements included in the feature map x are 0, and returns 1 if at least one of the elements is not 0. Also, in Equation 2, t means an index of a channel.

Figure 112019099758024-pat00006
Figure 112019099758024-pat00006

Figure 112019099758024-pat00007
Figure 112019099758024-pat00007

본 발명의 일 실시예에 따라.

Figure 112019099758024-pat00008
는 수학식 3과 같이 수정될 수 있다. 수학식 3에서
Figure 112019099758024-pat00009
는 L2-norm(L2 정규화)이다. 이는, 채널 로스 및 xor 로스를 포함하는 손실함수를 미분가능하도록 하기 위함이다.
Figure 112019099758024-pat00010
일 수 있다.According to one embodiment of the present invention.
Figure 112019099758024-pat00008
can be modified as in Equation (3). in Equation 3
Figure 112019099758024-pat00009
is L2-norm (L2 normalized). This is to make a loss function including a channel loss and an xor loss differentiable.
Figure 112019099758024-pat00010
can be

Figure 112019099758024-pat00011
Figure 112019099758024-pat00011

도 4는 본 발명의 일 실시예에 따른 신경망의 압축 훈련 방법을 나타내는 순서도이다.4 is a flowchart illustrating a compression training method of a neural network according to an embodiment of the present invention.

이하에서 설명하는 과정들은 하나 이상의 메모리 및 하나 이상의 프로세서를 이용하여 수행될 수 있다.The processes described below may be performed using one or more memories and one or more processors.

우선, 복수의 이미지를 포함하는 저장하는 메모리로부터 복수의 이미지를 획득한다(S400). 이때, 복수의 이미지를 포함하는 배치 단위로 이미지를 획득할 수도 있다.First, a plurality of images is acquired from a memory for storing the plurality of images (S400). In this case, images may be acquired in units of batches including a plurality of images.

복수의 배치를 신경망에 제공하고, 신경망이 하나의 배치에 포함된 각 이미지들에 대해 복수의 필터를 이용하여 생성한 복수의 특징맵을 수신한다(S402).A plurality of batches are provided to the neural network, and a plurality of feature maps generated by the neural network using a plurality of filters for each image included in one batch are received ( S402 ).

각 이미지들에 대응하는 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분한다(S404).A plurality of feature maps corresponding to each image are divided into a zero feature map and a non-zero feature map (S404).

복수의 이미지 중 서로 다른 두 이미지에 대해 모두 제로 특징맵 또는 모두 논제로 특징맵을 생성하는 필터의 수가 증가하도록 신경망의 파라미터를 수정한다(S406).The parameters of the neural network are modified to increase the number of filters that generate all-zero feature maps or all-non-zero feature maps for two different images among the plurality of images (S406).

복수의 특징맵 중 제로 특징맵의 수가 증가하도록 신경망의 파라미터를 수정한다(S408).The parameters of the neural network are modified so that the number of zero feature maps among the plurality of feature maps is increased (S408).

본 발명의 일 실시예에 따른 신경망 훈련 방법은 과정 S402 내지 과정 S408을 각 배치에 대해 반복하여 수행할 수 있다. 또한, 신경망 훈련 방법은 과정 S406 및 과정 S408을 동시에 수행할 수도 있다.The neural network training method according to an embodiment of the present invention may repeat steps S402 to S408 for each batch. Also, the neural network training method may simultaneously perform steps S406 and S408.

도 5는 본 발명의 일 실시예에 따른 압축된 신경망을 이용하는 방법을 설명하기 위한 순서도이다.5 is a flowchart illustrating a method of using a compressed neural network according to an embodiment of the present invention.

압축된 신경망을 이용하여 이미지를 처리하는 방법으로서, 훈련된 제1 신경망과 훈련된 제2 신경망을 이용하는 방법을 설명한다. As a method of processing an image using a compressed neural network, a method using a trained first neural network and a trained second neural network will be described.

도 5를 참조하면, 메모리로부터 복수의 입력 이미지를 획득한다(S500).Referring to FIG. 5 , a plurality of input images is acquired from a memory ( S500 ).

획득한 복수의 입력 이미지를 제1신경망에 제공한다(S502). 제1 신경망은 복수의 필터를 이용하여 복수의 입력 이미지 각각에 대한 특징맵들을 생성한다. 제1 신경망에 의해 생성된 특징맵들은 제2 신경망에 전달된다.The plurality of acquired input images are provided to the first neural network (S502). The first neural network generates feature maps for each of a plurality of input images by using a plurality of filters. The feature maps generated by the first neural network are transmitted to the second neural network.

제2 신경망이 제1 신경망으로부터 수신한 특징맵들을 이용하여 이미지를 처리한 결과를 획득한다(S504). The second neural network obtains a result of image processing using the feature maps received from the first neural network (S504).

여기서, 제2 신경망이 이미지 분류기인 경우, 제2 신경망이 복수의 이미지를 분류한 결과를 획득할 수 있다. Here, when the second neural network is an image classifier, a result obtained by classifying a plurality of images by the second neural network may be obtained.

반면, 제2 신경망이 이미지 스타일 변환기인 경우, 복수의 이미지 중 서로 다른 두 이미지에 대해 이미지 스타일 전환이 적용된 합성 이미지를 획득할 수 있다. 이미지 스타일 전환이란, 두 이미지 중 하나의 이미지로부터 컨텐츠 특징을 추출하고, 다른 하나의 이미지로부터 스타일 특징을 추출한 후, 컨텐츠 특징과 스타일 특징을 합성한 이미지를 출력하는 기술을 의미한다.On the other hand, when the second neural network is an image style converter, it is possible to obtain a composite image to which image style conversion is applied to two different images among a plurality of images. Image style conversion refers to a technique of extracting content features from one image among two images, extracting style features from the other image, and outputting an image in which content features and style features are synthesized.

한편, 제1 신경망과 제2 신경망은 함께 훈련될 수 있다. 이하에서 설명한다.Meanwhile, the first neural network and the second neural network may be trained together. It will be described below.

훈련 방법은, 우선 복수의 배치 중 각 배치마다 제1 신경망을 이용하여 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득한다. 제1 신경망에 의해 생성된 복수의 특징맵은 제2 신경망에 전달된다. 이후, 각 이미지들에 대응하는 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분한다. 제로 특징맵의 수, 및 복수의 이미지 중 서로 다른 두 이미지에 대해 모두 제로 특징맵 또는 모두 논제로 특징맵을 출력하는 필터의 수를 이용하여 제1신경망의 파라미터들을 수정한다.The training method first acquires a plurality of feature maps corresponding to each image included in the batch by using a first neural network for each batch among a plurality of batches. The plurality of feature maps generated by the first neural network are transmitted to the second neural network. Thereafter, a plurality of feature maps corresponding to each image are divided into a zero feature map and a non-zero feature map. The parameters of the first neural network are modified by using the number of zero feature maps and the number of filters that output all zero feature maps or all non-zero feature maps for two different images among the plurality of images.

본 발명의 일 실시예에 따라 제1 신경망과 제2 신경망이 복수의 이미지를 분류하도록 훈련된 경우, 제2 신경망은 이미지 분류기일 수 있다. 훈련 방법에 있어서, 우선 제1 신경망에 복수의 이미지를 제공한다. 제1 신경망은 복수의 이미지에 대한 복수의 특징맵을 생성하여 제2 신경망에 전달하고, 제2 신경망은 복수의 특징맵을 이용하여 복수의 이미지에 대해 각각 라벨링(labelling)한다. 라벨링된 복수의 이미지와 기 설정된 정답 데이터로부터 손실 함수를 추출한다. 추출된 손실함수에 제1 신경망의 채널 로스 및 xor 로스를 합한다. 마지막으로, 채널 로스 및 xor 로스를 포함하는 손실함수를 기 설정된 값까지 줄어들도록 제1 신경망의 파라미터와 제2 신경망의 파라미터를 함께 수정함으로써, 제1 신경망 및 제2 신경망을 훈련할 수 있다.When the first neural network and the second neural network are trained to classify a plurality of images according to an embodiment of the present invention, the second neural network may be an image classifier. In the training method, first, a plurality of images are provided to the first neural network. The first neural network generates a plurality of feature maps for a plurality of images and transmits them to the second neural network, and the second neural network labels each of the plurality of images using the plurality of feature maps. A loss function is extracted from a plurality of labeled images and preset correct answer data. The channel loss and xor loss of the first neural network are added to the extracted loss function. Finally, the first neural network and the second neural network may be trained by modifying the parameters of the first and second neural networks together to reduce the loss function including the channel loss and the xor loss to a preset value.

반면, 본 발명의 일 실시예에 따라 제1 신경망과 제2 신경망이 이미지 스타일을 변환하도록 훈련된 경우, 제1 신경망은 인코더(encoder)이고, 제2 신경망은 디코더(decoder)일 수 있다. On the other hand, when the first neural network and the second neural network are trained to transform an image style according to an embodiment of the present invention, the first neural network may be an encoder and the second neural network may be a decoder.

훈련 방법에 있어서, 우선 제1 신경망에 서로 다른 두 이미지를 제공한다. 제1 신경망은 하나의 이미지로부터 컨텐츠에 관련된 특징맵을 추출하고, 나머지 하나의 이미지로부터 스타일에 관련된 특징맵을 추출한다. 제1 신경망은 컨텐츠에 관련된 특징맵 및 스타일에 관련된 특징맵을 제2 신경망에 전달한다. 제2 신경망은 컨텐츠에 관련된 특징맵 및 스타일에 관련된 특징맵을 이용하여 컨텐츠와 스타일이 합성된 이미지를 생성한다. 합성된 이미지와 기 설정된 정답 데이터로부터 손실 함수를 추출한다. 추출된 손실함수에 제1 신경망의 채널 로스 및 xor 로스를 합한다. 마지막으로, 채널 로스 및 xor 로스를 포함하는 손실함수를 기 설정된 값까지 줄어들도록 제1 신경망의 파라미터와 제2 신경망의 파라미터를 함께 수정함으로써, 제1 신경망 및 제2 신경망을 훈련할 수 있다.In the training method, first, two different images are provided to the first neural network. The first neural network extracts a content-related feature map from one image, and extracts a style-related feature map from the other image. The first neural network transmits a feature map related to content and a feature map related to a style to the second neural network. The second neural network generates an image in which content and style are synthesized by using a feature map related to content and a feature map related to style. A loss function is extracted from the synthesized image and preset correct answer data. The channel loss and xor loss of the first neural network are added to the extracted loss function. Finally, the first neural network and the second neural network may be trained by modifying the parameters of the first and second neural networks together to reduce the loss function including the channel loss and the xor loss to a preset value.

도 4 및 도 5에서는 과정 S400 내지 과정 S504를 순차적으로 실행하는 것으로 기재하고 있으나, 이는 본 발명의 일 실시예의 기술 사상을 예시적으로 설명한 것에 불과한 것이다. 다시 말해, 본 발명의 일 실시예가 속하는 기술 분야에서 통상의 지식을 가진 자라면 본 발명의 일 실시예의 본질적인 특성에서 벗어나지 않는 범위에서 도 4 및 도 5에 기재된 순서를 변경하여 실행하거나 과정 S400 내지 과정 S504 중 하나 이상의 과정을 병렬적으로 실행하는 것으로 다양하게 수정 및 변형하여 적용 가능할 것이므로, 도 4 및 도 5는 시계열적인 순서로 한정되는 것은 아니다.Although it is described that steps S400 to S504 are sequentially executed in FIGS. 4 and 5 , this is merely illustrative of the technical idea of an embodiment of the present invention. In other words, those of ordinary skill in the art to which an embodiment of the present invention pertain change the order described in FIGS. 4 and 5 within a range that does not deviate from the essential characteristics of an embodiment of the present invention, or process S400 to process S400 Since it will be possible to apply various modifications and variations to parallel execution of one or more processes in S504, FIGS. 4 and 5 are not limited to a time-series order.

한편, 도 4 및 도 5에 도시된 과정들은 컴퓨터로 읽을 수 있는 기록매체에 컴퓨터가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 즉, 컴퓨터가 읽을 수 있는 기록매체는 마그네틱 저장매체(예를 들면, 롬, 플로피 디스크, 하드디스크 등) 및 광학적 판독 매체(예를 들면, 시디롬, 디브이디 등)와 같은 저장매체를 포함한다. 또한 컴퓨터가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어 분산방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다. 또한, 하나 이상의 프로세서 및 명령어를 저장하는 하나 이상의 메모리를 포함하되, 상기 명령어가 상기 하나 이상의 프로세서에 의해 실행되는 경우, 상기 명령어는 상기 하나 이상의 프로세서로 하여금 과정 S400 내지 과정 S408 또는 과정 S500 내지 S504를 수행하도록 한다.Meanwhile, the processes shown in FIGS. 4 and 5 can be implemented as computer-readable codes on a computer-readable recording medium. The computer-readable recording medium includes all kinds of recording devices in which data readable by a computer system is stored. That is, the computer-readable recording medium includes a magnetic storage medium (eg, a ROM, a floppy disk, a hard disk, etc.) and an optical readable medium (eg, a CD-ROM, a DVD, etc.). In addition, the computer-readable recording medium is distributed in a network-connected computer system so that the computer-readable code can be stored and executed in a distributed manner. In addition, one or more processors and one or more memories for storing instructions, wherein when the instructions are executed by the one or more processors, the instructions cause the one or more processors to perform steps S400 to S408 or S500 to S504. to do it

이상의 설명은 본 실시예의 기술 사상을 예시적으로 설명한 것에 불과한 것으로서, 본 실시예가 속하는 기술 분야에서 통상의 지식을 가진 자라면 본 실시예의 본질적인 특성에서 벗어나지 않는 범위에서 다양한 수정 및 변형이 가능할 것이다. 따라서, 본 실시예들은 본 실시예의 기술 사상을 한정하기 위한 것이 아니라 설명하기 위한 것이고, 이러한 실시예에 의하여 본 실시예의 기술 사상의 범위가 한정되는 것은 아니다. 본 실시예의 보호 범위는 아래의 청구범위에 의하여 해석되어야 하며, 그와 동등한 범위 내에 있는 모든 기술 사상은 본 실시예의 권리범위에 포함되는 것으로 해석되어야 할 것이다.The above description is merely illustrative of the technical idea of this embodiment, and various modifications and variations will be possible by those skilled in the art to which this embodiment belongs without departing from the essential characteristics of the present embodiment. Accordingly, the present embodiments are intended to explain rather than limit the technical spirit of the present embodiment, and the scope of the technical spirit of the present embodiment is not limited by these embodiments. The protection scope of this embodiment should be interpreted by the following claims, and all technical ideas within the equivalent range should be interpreted as being included in the scope of the present embodiment.

100: 입력 특징맵 108: 출력 특징맵
210: 제1 이미지 220: 제2 이미지
230: 신경망
100: input feature map 108: output feature map
210: first image 220: second image
230: neural network

Claims (16)

복수의 이미지를 포함하는 복수의 배치(batch)에 대해 복수의 필터(filter)를 이용하여 특징맵들(feature maps)을 생성하는 신경망(neural network)을 압축하는 훈련 방법에 있어서,
상기 복수의 배치를 획득하고, 상기 복수의 배치를 상기 신경망에 제공하는 과정; 및
각 배치마다 상기 신경망의 파라미터를 갱신하는 과정을 포함하며,
상기 갱신하는 과정은,
상기 신경망을 이용하여 상기 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득하는 과정;
상기 각 이미지들에 대응하는 상기 복수의 특징맵을 제로 특징맵(zero feature map)과 논제로 특징맵(non-zero feature map)으로 구분하는 과정; 및
서로 다른 두 입력에 대해 모두 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하는 필터의 수, 및 상기 제로 특징맵의 수를 이용하여 상기 신경망의 파라미터를 수정하는 과정을 포함하되,
상기 제로 특징맵은 모든 엘리먼트(element)가 0인 특징맵이고, 상기 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵인 훈련 방법.
In a training method for compressing a neural network that generates feature maps using a plurality of filters for a plurality of batches including a plurality of images,
obtaining the plurality of batches and providing the plurality of batches to the neural network; and
It includes the process of updating the parameters of the neural network for each batch,
The update process is
obtaining a plurality of feature maps corresponding to each image included in the arrangement by using the neural network;
classifying the plurality of feature maps corresponding to the respective images into a zero feature map and a non-zero feature map; and
A process of modifying the parameters of the neural network using the number of filters that output all zero feature maps or all non-zero feature maps for two different inputs, and the number of zero feature maps,
The zero feature map is a feature map in which all elements are 0, and the non-zero feature map is a feature map in which at least one of the elements is non-zero.
제1항에 있어서,
상기 신경망은 적어도 하나의 컨볼루션 레이어(convolution layer)를 포함하고, 상기 복수의 필터는 상기 적어도 하나의 컨볼루션 레이어에 포함된 것인 훈련 방법.
According to claim 1,
The neural network includes at least one convolution layer, and the plurality of filters are included in the at least one convolution layer.
제1항에 있어서,
상기 수정하는 과정은,
상기 제로 특징맵의 수 및 상기 필터의 수가 증가하도록 상기 파라미터를 수정하는 것인 훈련 방법.
According to claim 1,
The modification process is
and modifying the parameter to increase the number of zero feature maps and the number of filters.
이미지 처리 방법으로서,
입력 이미지를 획득하는 과정;
상기 입력 이미지를 제1신경망에 제공하는 과정, 상기 제1신경망은 복수의 필터를 이용하여 상기 입력 이미지에 대한 특징맵들을 생성함; 및
제2신경망이 상기 제1신경망으로부터 수신한 상기 특징맵들을 이용하여 상기 이미지를 처리한 결과를 획득하는 과정을 포함하고,
상기 제1신경망은 복수의 이미지를 포함하는 복수의 배치에 대해 상기 제2신경망과 함께 훈련된 것이며, 훈련 방법은 각 배치마다
상기 제1신경망을 이용하여 상기 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득하는 과정;
각 이미지들에 대응하는 상기 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분하는 과정; 및
서로 다른 두 입력에 대해 모두 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하는 필터의 수, 및 상기 제로 특징맵의 수를 이용하여 상기 제1신경망의 파라미터들을 수정하는 과정;
을 포함하되,
상기 제로 특징맵은 모든 엘리먼트(element)가 0인 특징맵이고, 상기 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵인 이미지 처리 방법.
An image processing method comprising:
acquiring an input image;
providing the input image to a first neural network, wherein the first neural network generates feature maps for the input image using a plurality of filters; and
a second neural network obtaining a result of processing the image using the feature maps received from the first neural network,
The first neural network is trained together with the second neural network for a plurality of batches including a plurality of images, and the training method is for each batch.
obtaining a plurality of feature maps corresponding to each image included in the arrangement by using the first neural network;
classifying the plurality of feature maps corresponding to each image into a zero feature map and a non-zero feature map; and
modifying parameters of the first neural network using the number of filters that output all zero feature maps or all non-zero feature maps for two different inputs, and the number of zero feature maps;
including,
The zero feature map is a feature map in which all elements are 0, and the non-zero feature map is a feature map in which at least one of the elements is non-zero.
제4항에 있어서,
상기 제1신경망은 적어도 하나의 컨볼루션 레이어를 포함하고, 상기 복수의 필터는 상기 적어도 하나의 컨볼루션 레이어에 포함된 것인 이미지 처리 방법.
5. The method of claim 4,
The first neural network includes at least one convolutional layer, and the plurality of filters are included in the at least one convolutional layer.
제4항에 있어서,
상기 수정하는 과정은,
상기 제로 특징맵의 수 및 상기 필터의 수가 증가하도록 상기 파라미터를 수정하는 것인 이미지 처리 방법.
5. The method of claim 4,
The modification process is
and modifying the parameter to increase the number of the zero feature maps and the number of filters.
제4항에 있어서,
상기 제1신경망은 인코더(encoder)이며, 상기 제2신경망은 디코더(decoder)인 것을 특징으로 하는 이미지 처리 방법
5. The method of claim 4,
The first neural network is an encoder, and the second neural network is a decoder.
제4항에 있어서,
상기 제1신경망은 인코더이며, 상기 제2신경망은 이미지 분류기인 것을 특징으로 하는 이미지 처리 방법.
5. The method of claim 4,
The first neural network is an encoder, and the second neural network is an image classifier.
신경망을 압축하기 위한 시스템에 있어서,
하나 이상의 프로세서; 및
명령어를 저장하는 하나 이상의 메모리를 포함하되,
상기 명령어가 상기 하나 이상의 프로세서에 의해 실행되는 경우, 상기 명령어는 상기 하나 이상의 프로세서로 하여금 신경망 훈련 방법을 수행하도록 하며,
상기 훈련 방법은,
복수의 이미지를 포함하는 복수의 배치에 대해 복수의 필터를 이용하여 특징맵들을 생성하는 상기 신경망을 압축하는 훈련 방법으로서,
상기 복수의 배치를 획득하고, 상기 복수의 배치를 상기 신경망에 제공하는 과정; 및
각 배치마다 상기 신경망의 파라미터를 갱신하는 과정을 포함하며,
상기 갱신하는 과정은,
상기 신경망을 이용하여 상기 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득하는 과정;
상기 각 이미지들에 대응하는 상기 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분하는 과정; 및
서로 다른 두 입력에 대해 모두 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하는 필터의 수, 및 상기 제로 특징맵의 수를 이용하여 상기 신경망의 파라미터를 수정하는 과정을 포함하되,
상기 제로 특징맵은 모든 엘리먼트가 0인 특징맵이고, 상기 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵인 시스템.
A system for compressing a neural network, comprising:
one or more processors; and
one or more memories for storing instructions;
when the instructions are executed by the one or more processors, the instructions cause the one or more processors to perform a neural network training method;
The training method is
A training method for compressing the neural network that generates feature maps using a plurality of filters for a plurality of batches including a plurality of images,
obtaining the plurality of batches and providing the plurality of batches to the neural network; and
It includes the process of updating the parameters of the neural network for each batch,
The update process is
obtaining a plurality of feature maps corresponding to each image included in the arrangement by using the neural network;
classifying the plurality of feature maps corresponding to the respective images into a zero feature map and a non-zero feature map; and
A process of modifying the parameters of the neural network using the number of filters that output all zero feature maps or all non-zero feature maps for two different inputs, and the number of zero feature maps,
The zero feature map is a feature map in which all elements are 0, and the non-zero feature map is a feature map in which at least one of the elements is non-zero.
제9항에 있어서,
상기 신경망은 적어도 하나의 컨볼루션 레이어를 포함하고, 상기 복수의 필터는 상기 적어도 하나의 컨볼루션 레이어에 포함된 것인 시스템.
10. The method of claim 9,
wherein the neural network includes at least one convolutional layer, and the plurality of filters are included in the at least one convolutional layer.
제9항에 있어서,
상기 수정하는 과정은,
상기 제로 특징맵의 수 및 상기 필터의 수가 증가하도록 상기 파라미터를 수정하는 것인 시스템.
10. The method of claim 9,
The modification process is
and modifying the parameter to increase the number of zero feature maps and the number of filters.
이미지를 처리하기 위한 시스템에 있어서,
하나 이상의 프로세서; 및
명령어를 저장하는 하나 이상의 메모리를 포함하되,
상기 명령어가 상기 하나 이상의 프로세서에 의해 실행되는 경우, 상기 명령어는 상기 하나 이상의 프로세서로 하여금 이미지 처리 방법을 수행하도록 하며,
상기 이미지 처리 방법은,
입력 이미지를 획득하는 과정;
상기 입력 이미지를 제1신경망에 제공하는 과정, 상기 제1신경망은 복수의 필터를 이용하여 상기 입력 이미지에 대한 특징맵들을 생성함; 및
제2신경망이 상기 제1신경망으로부터 수신한 상기 특징맵들을 이용하여 상기 이미지를 처리한 결과를 획득하는 과정을 포함하고,
상기 제1신경망은 복수의 이미지를 포함하는 복수의 배치에 대해 상기 제2신경망과 함께 훈련된 것이며, 훈련 방법은 각 배치마다
상기 제1신경망을 이용하여 상기 배치에 포함된 각 이미지들에 대응하는 복수의 특징맵을 획득하는 과정;
각 이미지들에 대응하는 상기 복수의 특징맵을 제로 특징맵과 논제로 특징맵으로 구분하는 과정; 및
서로 다른 두 입력에 대해 모두 제로 특징맵을 출력하거나 모두 논제로 특징맵을 출력하는 필터의 수, 및 상기 제로 특징맵의 수를 이용하여 상기 제1신경망의 파라미터들을 수정하는 과정;
을 포함하며,
상기 제로 특징맵은 모든 엘리먼트가 0인 특징맵이고, 상기 논제로 특징맵은 엘리먼트 중 적어도 하나가 0이 아닌 특징맵인 시스템.
A system for processing an image, comprising:
one or more processors; and
one or more memories for storing instructions;
when the instructions are executed by the one or more processors, the instructions cause the one or more processors to perform an image processing method,
The image processing method is
acquiring an input image;
providing the input image to a first neural network, wherein the first neural network generates feature maps for the input image using a plurality of filters; and
a second neural network obtaining a result of processing the image using the feature maps received from the first neural network,
The first neural network is trained together with the second neural network for a plurality of batches including a plurality of images, and the training method is for each batch.
obtaining a plurality of feature maps corresponding to each image included in the arrangement by using the first neural network;
classifying the plurality of feature maps corresponding to each image into a zero feature map and a non-zero feature map; and
modifying parameters of the first neural network using the number of filters that output all zero feature maps or all non-zero feature maps for two different inputs, and the number of zero feature maps;
includes,
The zero feature map is a feature map in which all elements are 0, and the non-zero feature map is a feature map in which at least one of the elements is non-zero.
제12항에 있어서,
상기 제1신경망은 적어도 하나의 컨볼루션 레이어를 포함하고, 상기 복수의 필터는 상기 적어도 하나의 컨볼루션 레이어에 포함된 것인 시스템.
13. The method of claim 12,
The first neural network includes at least one convolutional layer, and the plurality of filters are included in the at least one convolutional layer.
제12항에 있어서,
상기 수정하는 과정은,
상기 제로 특징맵의 수 및 상기 필터의 수가 증가하도록 상기 파라미터를 수정하는 것인 시스템.
13. The method of claim 12,
The modification process is
and modifying the parameter to increase the number of zero feature maps and the number of filters.
제12항에 있어서,
상기 제1신경망은 인코더이며, 상기 제2신경망은 디코더인 것을 특징으로 하는 시스템.
13. The method of claim 12,
The first neural network is an encoder, and the second neural network is a decoder.
제12항에 있어서,
상기 제1신경망은 인코더이며, 상기 제2신경망은 이미지 분류기인 것을 특징으로 하는 시스템.
13. The method of claim 12,
The first neural network is an encoder, and the second neural network is an image classifier.
KR1020190120627A 2019-09-30 2019-09-30 Method for Training to Compress Neural Network and Method for Using Compressed Neural Network KR102305981B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020190120627A KR102305981B1 (en) 2019-09-30 2019-09-30 Method for Training to Compress Neural Network and Method for Using Compressed Neural Network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020190120627A KR102305981B1 (en) 2019-09-30 2019-09-30 Method for Training to Compress Neural Network and Method for Using Compressed Neural Network

Publications (2)

Publication Number Publication Date
KR20210038027A KR20210038027A (en) 2021-04-07
KR102305981B1 true KR102305981B1 (en) 2021-09-27

Family

ID=75469781

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020190120627A KR102305981B1 (en) 2019-09-30 2019-09-30 Method for Training to Compress Neural Network and Method for Using Compressed Neural Network

Country Status (1)

Country Link
KR (1) KR102305981B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102603427B1 (en) * 2023-03-09 2023-11-17 주식회사 노타 Method for optimizing neural network model and electronic apparatus for performing the same

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Bert Moons et al., A 0.3-2.6 TOPS/W Precision-Scalable Processor for Real-Time Large-Scale ConvNets, 2016 IEEE Symposium on VLSI Circuits (VLSI-Circuits), 1-2pages 1부*
김선국 et al., 영상수준과 픽셀수준 분류를 결합한 영상 의미분할, Journal of Korea Multimedia Society Vol. 21, No. 12, 1425~1430pages 1부*
임수창 et al, 지역적 가중치 파라미터 제거를 적용한 CNN 모델 압축, 한국정보통신학회논문지 22(9), 1166-1171pages 1부*

Also Published As

Publication number Publication date
KR20210038027A (en) 2021-04-07

Similar Documents

Publication Publication Date Title
CN109840531B (en) Method and device for training multi-label classification model
CN109919183B (en) Image identification method, device and equipment based on small samples and storage medium
CN111275107A (en) Multi-label scene image classification method and device based on transfer learning
CN110570433B (en) Image semantic segmentation model construction method and device based on generation countermeasure network
CN109344893B (en) Image classification method based on mobile terminal
CN113011581A (en) Neural network model compression method and device, electronic equipment and readable storage medium
US20220164666A1 (en) Efficient mixed-precision search for quantizers in artificial neural networks
CN110874563A (en) Method and apparatus for providing integrated feature maps through multiple image outputs of CNN
CN110781923A (en) Feature extraction method and device
KR102305981B1 (en) Method for Training to Compress Neural Network and Method for Using Compressed Neural Network
US20200167655A1 (en) Method and apparatus for re-configuring neural network
US20220261641A1 (en) Conversion device, conversion method, program, and information recording medium
JP6935868B2 (en) Image recognition device, image recognition method, and program
CN111784699A (en) Method and device for carrying out target segmentation on three-dimensional point cloud data and terminal equipment
US20230410465A1 (en) Real time salient object detection in images and videos
CN112669324B (en) Rapid video target segmentation method based on time sequence feature aggregation and conditional convolution
CN114299304A (en) Image processing method and related equipment
CN110135428A (en) Image segmentation processing method and device
CN113743277A (en) Method, system, equipment and storage medium for short video frequency classification
CN111935484B (en) Video frame compression coding method and device
CN111582284B (en) Privacy protection method and device for image recognition and electronic equipment
CN110647917B (en) Model multiplexing method and system
CN111402164B (en) Training method and device for correction network model, text recognition method and device
US11983246B2 (en) Data analysis system, learning device, method, and program
CN113038134B (en) Picture processing method, intelligent terminal and storage medium

Legal Events

Date Code Title Description
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant