KR102263371B1 - Method for converting neural network model and apparatus therefor - Google Patents

Method for converting neural network model and apparatus therefor Download PDF

Info

Publication number
KR102263371B1
KR102263371B1 KR1020180130899A KR20180130899A KR102263371B1 KR 102263371 B1 KR102263371 B1 KR 102263371B1 KR 1020180130899 A KR1020180130899 A KR 1020180130899A KR 20180130899 A KR20180130899 A KR 20180130899A KR 102263371 B1 KR102263371 B1 KR 102263371B1
Authority
KR
South Korea
Prior art keywords
neural network
model
standard
network model
transformation
Prior art date
Application number
KR1020180130899A
Other languages
Korean (ko)
Other versions
KR20200048629A (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 KR1020180130899A priority Critical patent/KR102263371B1/en
Publication of KR20200048629A publication Critical patent/KR20200048629A/en
Application granted granted Critical
Publication of KR102263371B1 publication Critical patent/KR102263371B1/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/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/08Learning methods

Landscapes

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

Abstract

신경망 모델 변환 방법 및 이를 위한 장치가 개시된다. 본 발명의 일실시예에 따른 신경망 모델 변환 방법은 NNEF(NEURAL NETWORK EXCHANGE FORMAT) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화하는 단계; 계층 기반의 신경망 명세를 기반으로 상기 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성하는 단계; 및 상기 표준 신경망 모델과 상기 변환 모델을 비교하여 상기 변환 모델을 검증하는 단계를 포함한다.A method for transforming a neural network model and an apparatus therefor are disclosed. A neural network model transformation method according to an embodiment of the present invention comprises the steps of specifying a NNEF-based standard neural network model in a neural network unit based on a NNEF (NEURAL NETWORK EXCHANGE FORMAT) rule and target framework command information; generating a transformation model by substituting specification data of the standard neural network model into a layer-based neural network code based on a layer-based neural network specification; and verifying the transformation model by comparing the standard neural network model with the transformation model.

Description

신경망 모델 변환 방법 및 이를 위한 장치 {METHOD FOR CONVERTING NEURAL NETWORK MODEL AND APPARATUS THEREFOR}Neural network model conversion method and apparatus therefor {METHOD FOR CONVERTING NEURAL NETWORK MODEL AND APPARATUS THEREFOR}

본 발명은 신경망 모델을 변환하는 기술에 관한 것으로, 특히 표준화된 신경망 코드를 계층 기반 신경망 코드로 변환함으로써 사전에 생성된 딥 뉴럴 네트워크를 또 다른 신경망 프레임워크에서 동작하도록 할 수 있는 기술에 관한 것이다.The present invention relates to a technique for transforming a neural network model, and more particularly, to a technique capable of operating a pre-generated deep neural network in another neural network framework by converting a standardized neural network code into a layer-based neural network code.

국내외에서 인공신경망 기반 딥러닝 기술이 활발히 연구되고 있으며, 향후에도 많은 응용 분야들에서 사용될 것으로 예상되고 있다. 그러나 신경망 모델은 구조화하는 방식이 통일되어 있지 않기 때문에 각각의 응용 분야마다 개별화된 방법으로 구조화하고 구현을 해야 한다. 이러한 점은 소프트웨어 및 코드의 재사용성과 유지보수 측면에서 많은 비용을 야기할 수 있기 때문에 표준화된 데이터 구조가 요구된다. Artificial neural network-based deep learning technology is being actively studied at home and abroad, and it is expected to be used in many application fields in the future. However, since the method of structuring the neural network model is not unified, it must be structured and implemented in an individualized way for each application field. A standardized data structure is required because this can cause a lot of cost in terms of reusability and maintenance of software and code.

국제적으로는 신경망 모델의 구조화와 시각화를 위한 표준화 방식에 대한 논의가 진행되어오고 있으며, 그에 대한 결과물로 NNEF(Neural Network Exchange Format)이라는 방식을 개발하고 있다. NNEF는 신경망(neural network)의 표준화 방법 중 하나로, NNEF를 통해 정의된 neural network graph는 다양한 neural network configuration platform으로 쉽게 교환이 가능하다.Internationally, there has been a discussion about a standardization method for structuring and visualizing a neural network model, and as a result, a method called NNEF (Neural Network Exchange Format) is being developed. NNEF is one of the standardization methods for neural networks, and the neural network graph defined through NNEF can be easily exchanged with various neural network configuration platforms.

한국 공개 특허 제10-2010-0057495호, 2010년 5월 31일 공개(명칭: 고수준 언어 코드를 HDL 코드로 변환하는 방법 및 시스템)Korean Patent Publication No. 10-2010-0057495, published on May 31, 2010 (Title: Method and system for converting high-level language code into HDL code)

본 발명의 목적은 딥 뉴럴 네트워크를 또 다른 프레임워크에서 동작하도록 신경망 코드를 변환하는 기술을 제공하는 것이다.An object of the present invention is to provide a technique for converting a neural network code to operate a deep neural network in another framework.

또한, 본 발명의 목적은 미리 만들어진 학습데이터와 신경망을 원하는 장치에서 지원하는 프레임워크로 구동시키는 것이다.In addition, it is an object of the present invention to drive pre-made learning data and a neural network as a framework supported by a desired device.

또한, 본 발명의 목적은 처리능력이 우수한 장치에서 학습된 딥 뉴럴 네트워크를 임베디드 시스템의 프레임워크에서 구동시키는 것이다.In addition, it is an object of the present invention to drive a deep neural network learned from a device with excellent processing power in the framework of an embedded system.

또한, 본 발명의 목적은 딥 러닝 프레임워크 간의 호환성을 보장하는 것이다.It is also an object of the present invention to ensure compatibility between deep learning frameworks.

상기한 목적을 달성하기 위한 본 발명에 따른 신경망 모델 변환 방법은 NNEF(NEURAL NETWORK EXCHANGE FORMAT) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화하는 단계; 계층 기반의 신경망 명세를 기반으로 상기 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성하는 단계; 및 상기 표준 신경망 모델과 상기 변환 모델을 비교하여 상기 변환 모델을 검증하는 단계를 포함한다.A neural network model transformation method according to the present invention for achieving the above object comprises the steps of specifying a NNEF-based standard neural network model in neural network units based on NNEF (NEURAL NETWORK EXCHANGE FORMAT) rules and target framework command information; generating a transformation model by substituting specification data of the standard neural network model into a layer-based neural network code based on a layer-based neural network specification; and verifying the transformation model by comparing the standard neural network model with the transformation model.

이 때, 명세화하는 단계는 상기 표준 신경망 모델에 상응하는 표준 신경망 코드를 신경망 단위로 파싱(PARSING)하는 단계; 및 상기 파싱에 의해 생성된 파서 트리(PARSER TREE)를 기반으로 상기 명세화 데이터를 저장하는 단계를 포함할 수 있다.In this case, the specification may include: parsing a standard neural network code corresponding to the standard neural network model in a neural network unit; and storing the specification data based on a parser tree generated by the parsing.

이 때, 명세화 데이터는 상기 표준 신경망 코드에 상응하는 명령어 및 인자값 중 적어도 하나를 포함할 수 있다.In this case, the specification data may include at least one of a command and a factor value corresponding to the standard neural network code.

이 때, 검증하는 단계는 상기 표준 신경망 코드와 상기 변환 모델에 상응하는 신경망 코드 간의 명령어 계수, 명령어 순서 및 인자 수 중 적어도 하나를 비교하여 검증을 수행할 수 있다.In this case, the verifying may be performed by comparing at least one of an instruction coefficient, an instruction order, and a number of arguments between the standard neural network code and the neural network code corresponding to the transformation model.

이 때, 명세화하는 단계는 상기 인자값에 상응하는 변수값의 변수가 존재하지 않을 경우, 상기 변수값이 상기 계층 기반의 신경망 코드에 대입되는 위치 및 조건을 고려하여 상기 변수값에 상응하는 변수를 생성하는 단계를 더 포함할 수 있다.At this time, in the specifying step, when a variable of a variable value corresponding to the factor value does not exist, a variable corresponding to the variable value is selected in consideration of the location and condition in which the variable value is substituted into the layer-based neural network code. It may further include the step of generating.

이 때, 파싱하는 단계는 상기 표준 신경망 코드를 라인(LINE) 별로 읽어서 처리하되, 새로운 명령어가 확인되는 경우에 신경망 단위의 분리를 위해 변수 초기화를 수행한 뒤 다음 라인의 코드를 읽을 수 있다.In this case, in the parsing step, the standard neural network code is read line by line and processed, but when a new command is confirmed, variable initialization is performed to separate the neural network unit, and then the code of the next line can be read.

또한, 본 발명의 일실시예에 따른 신경망 모델 변환 장치는, NNEF(NEURAL NETWORK EXCHANGE FORMAT) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화하고, 계층 기반의 신경망 명세를 기반으로 상기 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성하고, 상기 표준 신경망 모델과 상기 변환 모델을 비교하여 상기 변환 모델을 검증하는 프로세서 및 상기 NNEF 규칙 및 대상 프레임워크 명령어 정보를 관리하고, 상기 표준 신경망 모델 및 변환 모델을 저장하는 메모리를 포함한다.In addition, the apparatus for converting a neural network model according to an embodiment of the present invention specifies a NNEF-based standard neural network model as a neural network unit based on NNEF (NEURAL NETWORK EXCHANGE FORMAT) rules and target framework command information, and a layer-based neural network A processor and the NNEF rule and target for generating a transformation model by substituting specification data of the standard neural network model into a layer-based neural network code based on a specification, and verifying the transformation model by comparing the standard neural network model with the transformation model and a memory for managing framework instruction information and storing the standard neural network model and the transformation model.

이 때, 프로세서는 상기 표준 신경망 모델에 상응하는 표준 신경망 코드를 신경망 단위로 파싱(PARSING)하고, 상기 파싱에 의해 생성된 파서 트리(PARSER TREE)를 기반으로 상기 명세화 데이터를 저장할 수 있다.In this case, the processor may parse the standard neural network code corresponding to the standard neural network model in units of neural networks, and store the specification data based on the parser tree generated by the parsing.

이 때, 명세화 데이터는 상기 표준 신경망 코드에 상응하는 명령어 및 인자값 중 적어도 하나를 포함할 수 있다.In this case, the specification data may include at least one of a command and a factor value corresponding to the standard neural network code.

이 때, 프로세서는 상기 표준 신경망 코드와 상기 변환 모델에 상응하는 신경망 코드 간의 명령어 계수, 명령어 순서 및 인자 수 중 적어도 하나를 비교하여 검증을 수행할 수 있다.In this case, the processor may perform verification by comparing at least one of an instruction coefficient, an instruction order, and a number of arguments between the standard neural network code and the neural network code corresponding to the transformation model.

이 때, 프로세서는 상기 인자값에 상응하는 변수값의 변수가 존재하지 않을 경우, 상기 변수값이 상기 계층 기반의 신경망 코드에 대입되는 위치 및 조건을 고려하여 상기 변수값에 상응하는 변수를 생성할 수 있다.At this time, when a variable of a variable value corresponding to the factor value does not exist, the processor generates a variable corresponding to the variable value in consideration of the location and condition in which the variable value is substituted into the layer-based neural network code. can

이 때, 프로세서는 상기 표준 신경망 코드를 라인(LINE)별로 읽어서 처리하되, 새로운 명령어가 확인되는 경우에 신경망 단위의 분리를 위해 변수 초기화를 수행한 뒤 다음 라인의 코드를 읽을 수 있다.In this case, the processor reads and processes the standard neural network code line by line, but when a new command is identified, variable initialization is performed to separate the neural network unit, and then the code of the next line can be read.

본 발명에 따르면, 딥 뉴럴 네트워크를 또 다른 프레임워크에서 동작하도록 신경망 코드를 변환할 수 있다.According to the present invention, a neural network code can be converted to operate a deep neural network in another framework.

또한, 본 발명은 미리 만들어진 학습데이터와 신경망을 원하는 장치에서 지원하는 프레임워크로 구동시킬 수 있다.In addition, the present invention can drive pre-made learning data and a neural network as a framework supported by a desired device.

또한, 본 발명은 처리능력이 우수한 장치에서 학습된 딥 뉴럴 네트워크를 임베디드 시스템의 프레임워크에서 구동시킬 수 있다.In addition, the present invention can drive a deep neural network learned from a device with excellent processing power in the framework of an embedded system.

또한, 본 발명은 딥 러닝 프레임워크 간의 호환성을 보장할 수 있다.In addition, the present invention can ensure compatibility between deep learning frameworks.

도 1은 본 발명의 일실시예에 따른 신경망 모델 변환 시스템을 나타낸 도면이다.
도 2는 본 발명의 일실시예에 따른 신경망 모델 변환 방법을 나타낸 동작 흐름도이다.
도 3은 본 발명에 따른 명세화 과정의 일예를 나타낸 도면이다.
도 4 내지 도 7은 본 발명에 따른 신경망 모델 변환 과정에 상응하게 생성되는 코드 또는 데이터의 일 예를 나타낸 도면이다.
도 8은 본 발명의 일실시예에 따른 신경망 모델 변환 방법 중 명세화 데이터를 생성하는 과정을 상세하게 나타낸 동작흐름도이다.
도 9는 본 발명의 일실시예에 따른 신경망 모델 변환 방법 중 변환된 모델을 검증하는 과정을 상세하게 나타낸 동작흐름도이다.
도 10은 본 발명의 일실시예에 따른 신경망 모델 변환 장치를 나타낸 블록도이다.
도 11은 본 발명의 일실시예에 따른 컴퓨터 시스템을 나타낸 도면이다.
1 is a diagram illustrating a neural network model transformation system according to an embodiment of the present invention.
2 is an operation flowchart illustrating a method for converting a neural network model according to an embodiment of the present invention.
3 is a diagram illustrating an example of a specification process according to the present invention.
4 to 7 are diagrams illustrating examples of codes or data generated corresponding to the neural network model transformation process according to the present invention.
8 is a detailed operation flowchart illustrating a process of generating specification data in a method for converting a neural network model according to an embodiment of the present invention.
9 is a detailed operation flowchart illustrating a process of verifying a converted model in a method for converting a neural network model according to an embodiment of the present invention.
10 is a block diagram illustrating an apparatus for converting a neural network model according to an embodiment of the present invention.
11 is a diagram illustrating a computer system according to an embodiment of the present invention.

본 발명을 첨부된 도면을 참조하여 상세히 설명하면 다음과 같다. 여기서, 반복되는 설명, 본 발명의 요지를 불필요하게 흐릴 수 있는 공지 기능, 및 구성에 대한 상세한 설명은 생략한다. 본 발명의 실시형태는 당 업계에서 평균적인 지식을 가진 자에게 본 발명을 보다 완전하게 설명하기 위해서 제공되는 것이다. 따라서, 도면에서의 요소들의 형상 및 크기 등은 보다 명확한 설명을 위해 과장될 수 있다.The present invention will be described in detail with reference to the accompanying drawings as follows. Here, repeated descriptions, well-known functions that may unnecessarily obscure the gist of the present invention, and detailed descriptions of configurations will be omitted. The embodiments of the present invention are provided in order to more completely explain the present invention to those of ordinary skill in the art. Accordingly, the shapes and sizes of elements in the drawings may be exaggerated for clearer description.

이하, 본 발명에 따른 바람직한 실시예를 첨부된 도면을 참조하여 상세하게 설명한다.Hereinafter, preferred embodiments according to the present invention will be described in detail with reference to the accompanying drawings.

도 1은 본 발명의 일실시예에 따른 신경망 모델 변환 시스템을 나타낸 도면이다.1 is a diagram illustrating a neural network model transformation system according to an embodiment of the present invention.

도 1을 참조하면, 본 발명의 일실시예에 따른 신경망 모델 변환 시스템은 다양한 프레임워크에서 개발한 신경망 코드들을 NNEF(Neural Network Exchange Format)를 이용하여 NNEF 기반의 신경망 코드로 전환한 이후, 특정한 장치 또는 사용자가 원하는 장치에서 동작하는 프레임워크에 적합한 신경망 코드로 변환할 수 있다.Referring to FIG. 1 , the neural network model conversion system according to an embodiment of the present invention converts neural network codes developed in various frameworks into NNEF-based neural network codes using NNEF (Neural Network Exchange Format), and then a specific device Alternatively, it can be converted into a neural network code suitable for a framework operating on a device desired by the user.

예를 들어, 도 1에 도시된 것처럼 AI(Artificial Intelligence) 학습 엔진의 일종인 텐서플로(Tensorflow)를 기반으로 작성된 텐서플로 기반 뉴럴 네트워크 모델(100)을 NNEF 기반 뉴럴 네트워크 모델(111)로 변환한 상태에서 본 발명의 일실시예에 따른 신경망 모델 변환 장치에 입력하면, 계층 기반 뉴럴 네트워크 모델(112)로 변환할 수 있다.For example, as shown in FIG. 1, a TensorFlow-based neural network model 100 created based on Tensorflow, a kind of AI (Artificial Intelligence) learning engine, is converted into an NNEF-based neural network model 111. In the state, if it is input to the neural network model transformation apparatus according to an embodiment of the present invention, it can be converted into the layer-based neural network model 112 .

이 때, 텐서플로 기반 뉴럴 네트워크 모델(100)이 계층 기반 뉴럴 네트워크 모델(112)로 변환되는 전체 과정 중에서 신경망 모델 변환 영역(110)에 상응하는 과정이 본 발명에 의한 변환 과정에 상응할 수 있다.At this time, the process corresponding to the neural network model transformation region 110 among the entire process in which the TensorFlow-based neural network model 100 is transformed into the layer-based neural network model 112 may correspond to the transformation process according to the present invention. .

이 때, 형식 기반 또는 계층 기반의 뉴럴 네트워크 모델(112)은 딥 뉴럴 네트워크의 표현으로 많이 사용되므로, 추후에 다양한 딥 뉴럴 네트워크의 개발 프레임워크에 적용시켜 사용될 수 있다. In this case, since the form-based or layer-based neural network model 112 is often used as an expression of a deep neural network, it may be applied to a development framework of various deep neural networks in the future.

이와 같이 본 발명에서는 다양한 형태의 신경망 코드들을 최종적으로는 계층 기반 뉴럴 네트워크 모델(112)에 상응하는 형태로 변환함으로써 다양한 딥 뉴럴 네트워크의 개발 프레임워크 사이에 호환성을 보장할 수 있다.As described above, in the present invention, compatibility among development frameworks of various deep neural networks can be ensured by finally converting various types of neural network codes into a form corresponding to the layer-based neural network model 112 .

도 2는 본 발명의 일실시예에 따른 신경망 모델 변환 방법을 나타낸 동작 흐름도이다.2 is an operation flowchart illustrating a method for converting a neural network model according to an embodiment of the present invention.

도 2를 참조하면, 본 발명의 일실시예에 따른 신경망 모델 변환 방법은 NNEF(Neural Network Exchange Format) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화한다(S210).Referring to FIG. 2 , the method for converting a neural network model according to an embodiment of the present invention specifies a NNEF-based standard neural network model in units of neural networks based on Neural Network Exchange Format (NNEF) rules and target framework command information (S210) ).

이 때, NNEF(Neural Network Exchange Format)은 학습용 프레임워크와 추론 엔진 간의 학습된 신경망의 보편적인 교환을 위한 표준 규격에 해당할 수 있다. 즉, 다양한 범위의 장치와 플랫폼에서 응용 프로그램이 사용할 수 있는 신경망 학습 도구와 추론 엔진의 풍부한 혼합을 가능하게 하여 머신러닝 배포 단편화를 줄일 수 있다. 예를 들어, NNEF을 기반으로 A 머신에서 학습된 인공지능 데이터를 B 머신에 입력하여 학습시킬 수 있고, B 머신의 학습 결과를 A 머신에 추가로 학습시켜 결과를 비교해 볼 수도 있다. At this time, the Neural Network Exchange Format (NNEF) may correspond to a standard specification for universal exchange of the learned neural network between the learning framework and the inference engine. This means reducing machine learning deployment fragmentation by enabling a rich mix of neural network learning tools and inference engines that applications can use on a wide range of devices and platforms. For example, based on NNEF, artificial intelligence data learned from machine A can be input to machine B for training, and the results of machine B's learning can be additionally trained on machine A to compare the results.

이 때, 본 발명에서 의미하는 NNEF 규칙은 NNEF를 기반으로 하는 일종의 신경망 변환 규칙에 상응할 수 있다. 즉, 본 발명에서는 NNEF 기반 신경망 모델에 상응하는 표준 신경망 모델을 계층 기반의 신경망 모델로 변환하는 과정에 NNEF 규칙을 적용할 수 있다. 이와 같은 과정을 통해 변환된 계층 기반의 신경망 모델은 NNEF에 기반한 규칙을 고려하여 변환된 코드에 상응하므로, 다양한 프레임워크에 호환되어 사용될 수 있다. In this case, the NNEF rule in the present invention may correspond to a kind of neural network transformation rule based on NNEF. That is, in the present invention, the NNEF rule may be applied to the process of converting a standard neural network model corresponding to the NNEF-based neural network model into a layer-based neural network model. The layer-based neural network model converted through this process corresponds to the code converted by considering the rules based on NNEF, so it can be used interchangeably with various frameworks.

또한, 대상 프레임워크 명령어 정보는 표준 신경망 모델을 적용하여 사용하고자 하는 대상 프레임워크에서 사용하는 명령어들에 대한 정보에 상응하는 것으로, 대상 프레임워크에 대해 규격화된 정보를 의미할 수도 있다. In addition, the target framework command information corresponds to information on commands used in a target framework to be used by applying a standard neural network model, and may mean standardized information for the target framework.

예를 들어, 대상 프레임워크 명령어 정보에는 대상 프레임워크에서 사용하는 다양한 명령어들에 대한 명령어 계수 체계, 명령어 순서 체계 및 명령어 인자 체계 등의 내용이 포함될 수 있다. For example, the target framework command information may include contents such as a command counting system, a command order system, and a command argument system for various commands used in the target framework.

이하에서는, 도 3을 참조하여 NNEF 규칙과 대상 프레임워크 명령어 정보를 기반으로 표준 신경망 모델을 신경망 단위로 명세화하는 과정을 상세하게 설명하도록 한다. Hereinafter, a process of specifying a standard neural network model in units of neural networks based on NNEF rules and target framework instruction information will be described in detail with reference to FIG. 3 .

먼저, 본 발명에 따른 명세화 데이터를 생성하기 위해서는 NNEF 기반의 신경망 모델인 표준 신경망 모델을 입력 받을 수 있다(S310).First, in order to generate specification data according to the present invention, a standard neural network model, which is an NNEF-based neural network model, may be input (S310).

이 때, 표준 신경망 모델은 다양한 프레임워크에서 개발한 신경망 모델들을 NNEF 기반으로 변환시킨 신경망 모델에 상응할 수 있다. 예를 들어, 텐서플로(tensorflow)와 같은 AI 학습 엔진을 기반으로 개발된 신경망 코드를 NNEF 기반의 신경망 코드로 전환하여 도 4에 도시된 것과 같은 표준 신경망 모델로 생성할 수 있다. In this case, the standard neural network model may correspond to a neural network model in which neural network models developed in various frameworks are converted based on NNEF. For example, a neural network code developed based on an AI learning engine such as tensorflow may be converted into a NNEF-based neural network code to generate a standard neural network model as shown in FIG. 4 .

이 때, 텐서플로와 같은 다양한 종류의 딥러닝 프레임워크에서는 인공지능 신경망을 computation graph 혹은 네트워크 계층으로 표현한다. 하지만 각 프레임워크마다 computation graph를 표현하는 방식이 다르기 때문에 통일된 방법으로 신경망을 구현하기 위해서는 NNEF와 같은 표준화된 방식이 필요하다. At this time, in various kinds of deep learning frameworks such as TensorFlow, artificial intelligence neural networks are expressed as computation graphs or network layers. However, since each framework has a different way of expressing the computation graph, a standardized method such as NNEF is needed to implement a neural network in a unified way.

이 후, 렉시칼 분석(Lexical analysis) 및 구문 문석을 수행함으로써(S320) 표준 신경망 모델의 신경망 단위 별 파서 트리를 생성할 수 있다. Thereafter, by performing lexical analysis and syntax analysis ( S320 ), a parser tree for each neural network unit of the standard neural network model may be generated.

이 때, 렉시칼 분석은 원시 프로그램의 각 문장을 입력으로 받아들여 이를 스트링토큰으로 변환하는 과정이고, 구문 분석은 스트링토큰이 특정 구문에 적합한지를 여부를 검사하는 과정에 해당할 수 있다. 따라서, 본 발명에 따른 구문분석 시에는 NNER 규칙 DB(301)를 기반으로 스트링토큰이 NNER 규칙에 상응하는 구문구조에 적합한지 여부를 검사할 수 있다. In this case, the lexical analysis is a process of receiving each sentence of the source program as input and converting it into a string token, and the syntax analysis may correspond to a process of checking whether the string token is suitable for a specific syntax. Therefore, when analyzing the syntax according to the present invention, based on the NNER rule DB 301, it can be checked whether the string token is suitable for the syntax structure corresponding to the NNER rule.

이러한 작업을 파싱(Parsing)이라 하며, 스트링토큰이 구문에 적합한 경우에는 표준 신경망 모델에 나타나는 명령어 및 인자값 등을 검출하여 도 5에 도시된 것과 같은 파서 트리(Parse Tree)의 형태로 출력할 수 있고(S330), 스트링토큰이 구문에 어긋나면 구문 에러를 출력할 수 있다. This operation is called parsing, and when the string token is suitable for syntax, commands and factor values appearing in the standard neural network model can be detected and output in the form of a parse tree as shown in FIG. There is (S330), and if the string token is out of syntax, a syntax error may be output.

이 때, 표준 신경망 모델에 상응하는 표준 신경망 코드를 신경망 단위로 파싱(Parsing)할 수 있다. In this case, the standard neural network code corresponding to the standard neural network model may be parsed in units of neural networks.

예를 들어, 도 3에 도시된 대상 프레임워크에 상응하는 프레임워크 명령어 DB(302)를 기반으로 대상 프레임워크 명령어 정보를 획득할 수 있고, 대상 프레임워크 명령어 정보에 포함된 명령어들을 기준으로 표준 신경망 모델의 계층을 분리하여 파싱을 수행할 수 있다. 즉, 표준 신경망 코드를 읽어서 처리하는 중에 코드 내에서 새로운 명령어가 인식되는 경우, 새로운 명령어가 인식된 부분을 기준으로 계층을 분리하여 계층별로 파싱을 수행할 수 있다. For example, target framework command information may be obtained based on the framework command DB 302 corresponding to the target framework shown in FIG. 3 , and based on the commands included in the target framework command information, a standard neural network Parsing can be performed by separating the layers of the model. That is, when a new command is recognized in the code while the standard neural network code is read and processed, the layers may be separated based on the recognized part of the new command, and the parsing may be performed for each layer.

이 때, 표준 신경망 코드를 라인(Line) 별로 읽어서 처리하되, 새로운 명령어가 확인되는 경우에 신경망 단위의 분리를 위해 변수 초기화를 수행한 뒤 다음 라인의 코드를 읽을 수 있다. At this time, the standard neural network code is read and processed line by line, but when a new command is confirmed, variable initialization is performed to separate the neural network unit, and then the code of the next line can be read.

예를 들어, 표준 신경망 코드에서 코드를 한 줄 읽어오고, 해당 코드 한 줄에 대한 파싱을 수행하여 파서 트리를 생성할 수 있다. 즉, 한 줄의 코드를 트리구조로 분리하여 생성할 수 있다. 이 후, 다음 라인의 코드를 또 한 줄 읽어와서 처리하되, 다음 라인의 코드에서 새로운 명령어가 인식되는 경우에는 신경망 단위의 계층 분리를 위해서 변수를 초기화한 뒤 다음 라인을 처리하도록 할 수도 있다. For example, a parser tree can be generated by reading a line of code from a standard neural network code and parsing the line of code. That is, one line of code can be generated by separating it into a tree structure. After that, the next line of code is read and processed, but when a new command is recognized in the code of the next line, the variable may be initialized for layer separation of the neural network unit and then the next line may be processed.

이와 같은 방식으로 표준 신경망 코드 전체를 읽어서 신경망 단위로 파싱을 수행하여 복수개의 파서 트리들을 생성할 수 있다. In this way, a plurality of parser trees can be generated by reading the entire standard neural network code and performing parsing in units of neural networks.

이 때, 파싱에 의해 생성된 파서 트리(Parser Tree)를 기반으로 명세화 데이터를 저장할 수 있다. 또는 파서 트리의 형태 자체를 명세화 데이터로 저장할 수도 있다. In this case, specification data may be stored based on a parser tree generated by parsing. Alternatively, the form of the parser tree itself may be stored as specification data.

이 때, 명세화 데이터는 표준 신경망 코드에 상응하는 명령어 및 인자값 중 적어도 하나를 포함할 수 있다. In this case, the specification data may include at least one of a command and a factor value corresponding to a standard neural network code.

이 때, 인자값은 변수와 변수값, 배열값 등을 포함할 수 있는데, 변수값의 변수가 존재하지 않을 경우에는 변수값이 계층 기반의 신경망 코드에 대입되는 위치 및 조건을 고려하여 변수값에 상응하는 변수를 생성할 수 있다. 예를 들어, 변수값의 변수가 존재하지 않지만, 변수값이 계층 기반의 신경망 코드에 대입되는 위치 및 조건 상 변수값의 bottom의 값이라고 가정한다면, 변수값에 상응하게 bottom에 상응하는 변수를 생성할 수도 있다. At this time, the factor value may include a variable, a variable value, an array value, and the like. If a variable of a variable value does not exist, the variable value is applied to the variable value in consideration of the location and condition in which the variable value is substituted into the layer-based neural network code. Corresponding variables can be created. For example, if there is no variable of the variable value, but the variable value is the value of the bottom of the variable value according to the location and condition assigned to the layer-based neural network code, create a variable corresponding to the bottom corresponding to the variable value. You may.

상기에서 설명한 것과 같이, 표준 신경망 모델 또는 표준 신경망 코드를 분리하는 기본 분리단위는 신경망 1개의 생성단위에 상응할 수 있으며, 대상 프레임워크가 지원하는 명령어를 기준으로 분리하여 명세화할 수 있다. As described above, the basic division unit for separating the standard neural network model or the standard neural network code may correspond to one generation unit of the neural network, and may be separated and specified based on the instruction supported by the target framework.

또한, 본 발명의 일실시예에 따른 신경망 모델 변환 방법은 계층 기반의 신경망 명세를 기반으로 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성한다(S220).In addition, the neural network model transformation method according to an embodiment of the present invention generates a transformation model by substituting specification data of a standard neural network model into a layer-based neural network code based on a layer-based neural network specification ( S220 ).

이 때, 신경망 단위로 생성된 명세화 데이터에 포함된 명령어 및 인자값을 각각 계층 기반의 신경망 코드에 대입시킬 수 있다. In this case, the command and factor values included in the specification data generated in units of the neural network may be substituted into the layer-based neural network code, respectively.

예를 들어, 도 6에 도시된 형식은 NNEF 기반 신경망 모델을 계층 기반의 신경망 모델로 변경한 변환 모델의 형식, 즉 계층 기반의 신경망 명세 형식에 상응할 수 있다. 도 6을 참조하면, 명세화 데이터에 포함된 각각의 신경망의 명령어 부분의 변수를 name로 설정하고, 프레임워크 명령어 정보를 기반으로 해당 명령어의 type을 설정할 수 있다. For example, the format shown in FIG. 6 may correspond to the format of the transformation model obtained by changing the NNEF-based neural network model to the layer-based neural network model, that is, the layer-based neural network specification format. Referring to FIG. 6 , a variable of a command part of each neural network included in the specification data may be set as a name, and a type of a corresponding command may be set based on framework command information.

또한, 입력값은 bottom에 대입하고, 출력값은 top에 대입하여 나타낼 수 있다. 이 때, top은 명령어에 대응하는 변수명을 대입하여 생성될 수 있으며, 대입할 bottom과 top이 더 있다면 추가적으로 기입할 수도 있다. Also, the input value can be substituted for the bottom and the output value can be substituted for the top. At this time, top can be created by substituting the variable name corresponding to the command, and if there are more bottom and top to be assigned, they can be additionally written.

또한, 입력과 출력의 차원들은 명세화 데이터에 저장된 각각의 신경망 변수들을 확인하여 분리하고 대입시킬 수 있다. 이 후, 나머지 필요한 부분만을 대입하여 계층 기반의 명세를 생성할 수 있다. In addition, the dimensions of the input and output can be separated and assigned by checking each neural network variable stored in the specification data. After that, the layer-based specification can be created by substituting only the remaining necessary parts.

즉, 도 5에 도시된 표준 신경망 모델의 명세화 데이터를 도 6과 같은 계층 기반의 신경망 명세 형식에 대입하여 도 7에 도시된 것과 같은 변환 모델을 생성할 수 있다. 이 때, 도 6에 도시된 형식은 Caffe 계층 기반의 신경망 모델에 상응할 수 있다. That is, the transformation model shown in FIG. 7 may be generated by substituting the specification data of the standard neural network model shown in FIG. 5 into the layer-based neural network specification format shown in FIG. 6 . In this case, the format shown in FIG. 6 may correspond to a Caffe layer-based neural network model.

또한, 본 발명의 일실시예에 따른 신경망 모델 변환 방법은 표준 신경망 모델과 변환 모델을 비교하여 변환 모델을 검증한다(S230).In addition, the neural network model transformation method according to an embodiment of the present invention verifies the transformation model by comparing the standard neural network model with the transformation model ( S230 ).

이 때, 표준 신경망 코드와 변환 모델에 상응하는 신경망 코드 간의 명령어 계수, 명령어 순서 및 인자 수 중 적어도 하나를 비교하여 검증을 수행할 수 있다. In this case, verification may be performed by comparing at least one of the instruction coefficient, the instruction order, and the number of arguments between the standard neural network code and the neural network code corresponding to the transformation model.

예를 들어, 표준 신경망 코드의 명령어 계수를 변환 모델에 상응하는 계층 기반 신경망 코드의 계층(Layer) 명령어 계수와 비교하여 검증을 수행할 수 있다. 이 때, 표준 신경망 코드의 명령어 계수와 계층 기반 신경망 코드의 계층 명령어 계수가 일치하지 않는 경우, 명령어 계수 오류가 발생한 것으로 판단하고, 오류 정보를 출력할 수 있다. For example, the verification may be performed by comparing the instruction coefficients of the standard neural network code with the layer instruction coefficients of the layer-based neural network code corresponding to the transformation model. At this time, when the instruction coefficient of the standard neural network code and the layer instruction coefficient of the layer-based neural network code do not match, it is determined that an instruction coefficient error has occurred, and error information may be output.

다른 예를 들어, 표준 신경망 코드의 명령어 순서를 변환 모델에 상응하는 계층 기반 신경망 코드의 계층(Layer) 명령어 순서와 비교하여 검증을 수행할 수 있다. 이 때, 표준 신경망 코드의 명령어 순서와 계층 기반 신경망 코드의 계층 명령어 순서가 일치하지 않는 경우, 명령어 순서 오류가 발생한 것으로 판단하고, 오류 정보를 출력할 수 있다.As another example, the verification may be performed by comparing the instruction order of the standard neural network code with the layer instruction order of the layer-based neural network code corresponding to the transformation model. In this case, when the command sequence of the standard neural network code does not match the layer command sequence of the layer-based neural network code, it is determined that a command sequence error has occurred, and error information may be output.

또 다른 예를 들어, 표준 신경망 코드의 명령어 인자 수를 변환 모델에 상응하는 계층 기반 신경망 코드의 계층(Layer) 명령어 인자 수와 비교하여 검증을 수행할 수 있다. 이 때, 표준 신경망 코드의 명령어 인자 수와 계층 기반 신경망 코드의 명령어 인자 수가 일치하지 않는 경우, 명령어 인자 수 오류가 발생한 것으로 판단하고, 오류 정보를 출력할 수도 있다.As another example, verification may be performed by comparing the number of instruction arguments of the standard neural network code with the number of layer instruction arguments of the layer-based neural network code corresponding to the transformation model. At this time, when the number of command parameters of the standard neural network code does not match the number of command parameters of the layer-based neural network code, it is determined that an error in the number of command parameters has occurred, and error information may be output.

이 때, 명령어 계수, 명령어 순서 및 인자 수를 각각 이용한 검증 과정은 순서에 상관없이 수행될 수 있으며, 명령어 계수, 명령어 순서 및 인자 수를 모두 이용하여 검증을 수행할 수도 있고 명령어 계수, 명령어 순서 및 인자 수 중 일부만을 이용하여 검증을 수행할 수도 있다. In this case, the verification process using each of the instruction coefficient, instruction order, and number of arguments may be performed irrespective of the order, and the verification may be performed using all of the instruction coefficient, instruction order, and number of arguments. Verification can also be performed using only a part of the number of factors.

이와 같은 과정을 통해서 계층 기반의 신경망 모델의 검증을 수행할 수 있고, 검증이 완료됨으로써 계층 기반의 신경망 모델의 생성이 완료될 수 있다. Through this process, verification of the layer-based neural network model can be performed, and when the verification is completed, the generation of the layer-based neural network model can be completed.

이와 같은 신경망 모델 변환 방법을 통해 자원제약적인 임베디드 시스템에서 구동하는 caffe와 같은 계층 기반의 신경망을 변환함으로써 학습된 신경망을 다른 장치 및 다른 신경망 도구에서 바로 구동시킬 수 있다.By transforming a layer-based neural network such as caffe running in a resource-constrained embedded system through such a neural network model transformation method, the learned neural network can be directly operated in other devices and other neural network tools.

또한, 딥 뉴럴 네트워크를 또 다른 프레임워크에서 동작하도록 신경망 코드를 변환할 수 있다.In addition, it is possible to transform the neural network code so that the deep neural network operates in another framework.

또한, 미리 만들어진 학습데이터와 신경망을 원하는 장치에서 지원하는 프레임워크로 구동시킬 수 있으며, 딥 러닝 프레임워크 간의 호환성을 보장할 수도 있다.In addition, pre-made training data and neural networks can be driven by a framework supported by a desired device, and compatibility between deep learning frameworks can be guaranteed.

도 8은 본 발명의 일실시예에 따른 신경망 모델 변환 방법 중 명세화 데이터를 생성하는 과정을 상세하게 나타낸 동작흐름도이다.8 is a detailed operation flowchart illustrating a process of generating specification data in a method for transforming a neural network model according to an embodiment of the present invention.

도 8을 참조하면, 본 발명의 일실시예에 따른 신경망 모델 변환 방법 중 명세화 데이터를 생성하는 과정은 먼저 신경망 모델 변환 장치로 NNEF 기반의 표준 신경망 모델 입력되면(S810), 입력된 표준 신경망 모델에 상응하는 표준 신경망 코드를 한 줄 읽어올 수 있다(S820).Referring to FIG. 8 , in the process of generating specification data in the method for converting a neural network model according to an embodiment of the present invention, first, the NNEF-based standard neural network model is input to the neural network model converter (S810), and the input standard neural network model is A corresponding standard neural network code may be read in one line (S820).

이 후, 한 줄의 코드에 대해 렉시칼 분석 및 구문 분석을 수행하여 파서 트리 기반의 트리구조로 분리할 수 있고(S830), 파서 트리를 기반으로 한 줄의 코드에 포함된 명령어 및 인자값을 저장하여 한 줄의 코드에 상응하는 명세화 데이터를 생성할 수 있다(S840).After that, lexical analysis and parsing of one line of code can be performed to separate the parser tree-based tree structure (S830), and commands and argument values included in one line of code based on the parser tree can be analyzed. By storing it, specification data corresponding to one line of code may be generated (S840).

이 때, 해당 코드에 새로운 명령어가 존재하는지 여부를 판단할 수 있다(S845).At this time, it may be determined whether a new instruction exists in the corresponding code (S845).

단계(S845)의 판단결과, 명령어가 존재하지 않으면 표준 신경망 코드에서 다음 라인을 한 줄 읽어와서 단계(S820)부터 단계(S840)의 단계를 반복적으로 수행할 수 있다.As a result of the determination in step S845, if the command does not exist, the next line is read from the standard neural network code one by one, and the steps from step S820 to step S840 can be repeatedly performed.

또한, 단계(S845)의 판단결과, 명령어가 존재하면 신경망 단위의 분리를 위해서 변수를 초기화할 수 있다(S850).In addition, as a result of the determination in step S845, if a command exists, a variable may be initialized for separation of a neural network unit (S850).

이 후, 해당 코드가 표준 신경망 코드의 마지막 코드인지 여부를 판단하고(S855), 마지막 코드가 아니면 표준 신경망 코드에서 다음 라인을 한 줄 읽어와서 단계(S820)부터 단계(S840)의 단계를 반복적으로 수행할 수 있다.After that, it is determined whether the corresponding code is the last code of the standard neural network code (S855), and if it is not the last code, the next line is read from the standard neural network code one line, and the steps from step S820 to step S840 are repeatedly repeated. can be done

또한, 해당 코드가 마지막 코드이면, 명세화 데이터 저장하고(S860) 명세화 작업을 종료할 수 있다. In addition, if the corresponding code is the last code, the specification data may be stored ( S860 ) and the specification operation may be terminated.

도 9는 본 발명의 일실시예에 따른 신경망 모델 변환 방법 중 변환된 모델을 검증하는 과정을 상세하게 나타낸 동작흐름도이다.9 is a detailed operation flowchart illustrating a process of verifying a converted model in a method for converting a neural network model according to an embodiment of the present invention.

도 9를 참조하면, 본 발명의 일실시예에 따른 신경망 모델 변환 방법 중 변환된 모델을 검증하는 과정은 먼저 표준 신경망 코드의 명령어 계수를 체크하고(S902), 변환 모델에 상응하는 계층(Layer) 기반 신경망 코드의 명령어 계수를 체크할 수 있다(S904).Referring to FIG. 9 , in the process of verifying the transformed model among the neural network model transformation method according to an embodiment of the present invention, first, the instruction coefficient of the standard neural network code is checked ( S902 ), and a layer corresponding to the transformation model is checked ( S902 ). It is possible to check the instruction coefficient of the underlying neural network code (S904).

이 후, 표준 신경망 코드의 명령어 계수와 변환 모델에 상응하는 계층 기반신경망 코드의 명령어 계수가 일치하는지 여부를 판단하고(S906), 계수가 일치하지 않으면 명령어 계수 오류가 발생한 것으로 판단하고 오류 정보를 출력할 수 있다(S908).Thereafter, it is determined whether the instruction coefficients of the standard neural network code match the instruction coefficients of the layer-based neural network code corresponding to the transformation model (S906), and if the coefficients do not match, it is determined that an instruction coefficient error has occurred and error information is output It can be done (S908).

또한, 단계(S906)의 판단결과, 표준 신경망 코드의 명령어 계수와 변환 모델에 상응하는 계층 기반 신경망 코드의 명령어 계수가 일치하면, 다음 단계의 검증을 위해 표준 신경망 코드의 명령어 순서를 체크하고(S910), 변환 모델에 상응하는 계층(Layer) 기반 신경망 코드의 명령어 순서 체크할 수 있다(S912).In addition, as a result of the determination in step S906, if the instruction coefficient of the standard neural network code and the instruction coefficient of the layer-based neural network code corresponding to the transformation model match, the instruction sequence of the standard neural network code is checked for verification of the next step (S910) ), it is possible to check the instruction order of the layer-based neural network code corresponding to the transformation model (S912).

이 후, 표준 신경망 코드의 명령어 순서와 변환 모델에 상응하는 계층 기반 신경망 코드의 명령어 순서가 일치하는지 여부를 판단하고(S914), 순서가 일치하지 않으면 명령어 순서 오류가 발생한 것으로 판단하고 오류 정보를 출력할 수 있다(S916).After that, it is determined whether the instruction sequence of the standard neural network code matches the instruction sequence of the layer-based neural network code corresponding to the transformation model (S914), and if the order does not match, it is determined that an instruction sequence error has occurred and error information is output It can be done (S916).

또한, 단계(S914)의 판단결과, 표준 신경망 코드의 명령어 순서와 변환 모델에 상응하는 계층 기반 신경망 코드의 명령어 순서가 일치하면, 다음 단계의 검증을 위해 표준 신경망 코드의 명령어 인자 수를 체크하고(S918), 변환 모델에 상응하는 계층(Layer) 기반 신경망 코드의 명령어 인자 수를 체크할 수 있다(S920).In addition, as a result of the determination in step S914, if the command sequence of the standard neural network code and the command sequence of the layer-based neural network code corresponding to the transformation model match, the number of command factors of the standard neural network code is checked for verification of the next step ( S918), it is possible to check the number of instruction factors of the layer-based neural network code corresponding to the transformation model (S920).

이 후, 표준 신경망 코드의 명령어 인자 수와 변환 모델에 상응하는 계층 기반 신경망 코드의 명령어 인자 수가 전체 일치하는지 여부를 판단하고(S922), 인자 수가 일치하지 않으면 인자 수 오류가 발생한 것으로 판단하고 오류 정보를 출력할 수 있다(S924).After that, it is determined whether the number of command factors of the standard neural network code and the number of command factors of the layer-based neural network code corresponding to the transformation model are completely identical (S922), and if the number of factors does not match, it is determined that an error in the number of factors has occurred and error information can be output (S924).

또한, 단계(S924)의 판단결과, 표준 신경망 코드의 명령어 인자 수와 변환 모델에 상응하는 계층 기반 신경망 코드의 명령어 인자 수가 일치하면 변환 모델에 대한 검증이 완료된 것으로 판단하고(S926) 변환 모델을 저장 및 사용할 수 있다.In addition, as a result of the determination in step S924, if the number of command factors of the standard neural network code and the number of command factors of the layer-based neural network code corresponding to the transformation model match, it is determined that the verification of the transformation model is completed (S926) and the transformation model is stored and can be used.

도 10은 본 발명의 일실시예에 따른 신경망 모델 변환 장치를 나타낸 블록도이다.10 is a block diagram illustrating an apparatus for converting a neural network model according to an embodiment of the present invention.

도 10을 참조하면, 본 발명의 일실시예에 따른 신경망 모델 변환 장치는 통신부(1010), 프로세서(1020) 및 메모리(1030)를 포함한다. Referring to FIG. 10 , an apparatus for converting a neural network model according to an embodiment of the present invention includes a communication unit 1010 , a processor 1020 , and a memory 1030 .

통신부(1010)는 네트워크와 같은 통신망을 통해 신경망 모델 변환을 위해 필요한 정보를 송수신하는 역할을 한다. 특히, 본 발명의 일실시예에 따른 통신부(1010)는 NNEF 기반의 표준 신경망 모델을 수신하거나 계층 기반 신경망 모델을 송신할 수 있다. The communication unit 1010 serves to transmit/receive information necessary for neural network model transformation through a communication network such as a network. In particular, the communication unit 1010 according to an embodiment of the present invention may receive a NNEF-based standard neural network model or transmit a layer-based neural network model.

프로세서(1020)는 NNEF(Neural Network Exchange Format) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화한다.The processor 1020 specifies the NNEF-based standard neural network model in units of neural networks based on Neural Network Exchange Format (NNEF) rules and target framework instruction information.

이 때, NNEF(Neural Network Exchange Format)은 학습용 프레임워크와 추론 엔진 간의 학습된 신경망의 보편적인 교환을 위한 표준 규격에 해당할 수 있다. 즉, 다양한 범위의 장치와 플랫폼에서 응용 프로그램이 사용할 수 있는 신경망 학습 도구와 추론 엔진의 풍부한 혼합을 가능하게 하여 머신러닝 배포 단편화를 줄일 수 있다. 예를 들어, NNEF을 기반으로 A 머신에서 학습된 인공지능 데이터를 B 머신에 입력하여 학습시킬 수 있고, B 머신의 학습 결과를 A 머신에 추가로 학습시켜 결과를 비교해 볼 수도 있다. At this time, the Neural Network Exchange Format (NNEF) may correspond to a standard specification for universal exchange of the learned neural network between the learning framework and the inference engine. This means reducing machine learning deployment fragmentation by enabling a rich mix of neural network learning tools and inference engines that applications can use on a wide range of devices and platforms. For example, based on NNEF, artificial intelligence data learned from machine A can be input to machine B for training, and the results of machine B's learning can be additionally trained on machine A to compare the results.

이 때, 본 발명에서 의미하는 NNEF 규칙은 NNEF를 기반으로 하는 일종의 신경망 변환 규칙에 상응할 수 있다. 즉, 본 발명에서는 NNEF 기반 신경망 모델에 상응하는 표준 신경망 모델을 계층 기반의 신경망 모델로 변환하는 과정에 NNEF 규칙을 적용할 수 있다. 이와 같은 과정을 통해 변환된 계층 기반의 신경망 모델은 NNEF에 기반한 규칙을 고려하여 변환된 코드에 상응하므로, 다양한 프레임워크에 호환되어 사용될 수 있다. In this case, the NNEF rule in the present invention may correspond to a kind of neural network transformation rule based on NNEF. That is, in the present invention, the NNEF rule may be applied to the process of converting a standard neural network model corresponding to the NNEF-based neural network model into a layer-based neural network model. The layer-based neural network model converted through this process corresponds to the code converted by considering the rules based on NNEF, so it can be used interchangeably with various frameworks.

또한, 대상 프레임워크 명령어 정보는 표준 신경망 모델을 적용하여 사용하고자 하는 대상 프레임워크에서 사용하는 명령어들에 대한 정보에 상응하는 것으로, 대상 프레임워크에 대해 규격화된 정보를 의미할 수도 있다. In addition, the target framework command information corresponds to information on commands used in a target framework to be used by applying a standard neural network model, and may mean standardized information for the target framework.

예를 들어, 대상 프레임워크 명령어 정보에는 대상 프레임워크에서 사용하는 다양한 명령어들에 대한 명령어 계수 체계, 명령어 순서 체계 및 명령어 인자 체계 등의 내용이 포함될 수 있다. For example, the target framework command information may include contents such as a command counting system, a command order system, and a command argument system for various commands used in the target framework.

이하에서는, 도 3을 참조하여 NNEF 규칙과 대상 프레임워크 명령어 정보를 기반으로 표준 신경망 모델을 신경망 단위로 명세화하는 과정을 상세하게 설명하도록 한다. Hereinafter, a process of specifying a standard neural network model in units of neural networks based on NNEF rules and target framework instruction information will be described in detail with reference to FIG. 3 .

먼저, 본 발명에 따른 명세화 데이터를 생성하기 위해서는 NNEF 기반의 신경망 모델인 표준 신경망 모델을 입력 받을 수 있다(S310).First, in order to generate specification data according to the present invention, a standard neural network model, which is an NNEF-based neural network model, may be input (S310).

이 때, 표준 신경망 모델은 다양한 프레임워크에서 개발한 신경망 모델들을 NNEF 기반으로 변환시킨 신경망 모델에 상응할 수 있다. 예를 들어, 텐서플로(tensorflow)와 같은 AI 학습 엔진을 기반으로 개발된 신경망 코드를 NNEF 기반의 신경망 코드로 전환하여 도 4에 도시된 것과 같은 표준 신경망 모델로 생성할 수 있다. In this case, the standard neural network model may correspond to a neural network model in which neural network models developed in various frameworks are converted based on NNEF. For example, a neural network code developed based on an AI learning engine such as tensorflow may be converted into a NNEF-based neural network code to generate a standard neural network model as shown in FIG. 4 .

이 후, 렉시칼 분석(Lexical analysis) 및 구문 문석을 수행함으로써(S320) 표준 신경망 모델의 신경망 단위 별 파서 트리를 생성할 수 있다. Thereafter, by performing lexical analysis and syntax parsing ( S320 ), a parser tree for each neural network unit of the standard neural network model may be generated.

이 때, 렉시칼 분석은 원시 프로그램의 각 문장을 입력으로 받아들여 이를 스트링토큰으로 변환하는 과정이고, 구문 분석은 스트링토큰이 특정 구문에 적합한지를 여부를 검사하는 과정에 해당할 수 있다. 따라서, 본 발명에 따른 구문분석 시에는 NNER 규칙 DB(301)를 기반으로 스트링토큰이 NNER 규칙에 상응하는 구문구조에 적합한지 여부를 검사할 수 있다. In this case, the lexical analysis is a process of receiving each sentence of the source program as input and converting it into a string token, and the syntax analysis may correspond to a process of checking whether the string token is suitable for a specific syntax. Therefore, when analyzing the syntax according to the present invention, based on the NNER rule DB 301, it can be checked whether the string token is suitable for the syntax structure corresponding to the NNER rule.

이러한 작업을 파싱(Parsing)이라 하며, 스트링토큰이 구문에 적합한 경우에는 표준 신경망 모델에 나타나는 명령어 및 인자값 등을 검출하여 도 5에 도시된 것과 같은 파서 트리(Parse Tree)의 형태로 출력할 수 있고(S330), 스트링토큰이 구문에 어긋나면 구문 에러를 출력할 수 있다. This operation is called parsing, and when the string token is suitable for syntax, commands and factor values appearing in the standard neural network model can be detected and output in the form of a parse tree as shown in FIG. There is (S330), and if the string token is out of syntax, a syntax error may be output.

이 때, 표준 신경망 모델에 상응하는 표준 신경망 코드를 신경망 단위로 파싱(Parsing)할 수 있다. In this case, the standard neural network code corresponding to the standard neural network model may be parsed in units of neural networks.

예를 들어, 도 3에 도시된 대상 프레임워크에 상응하는 프레임워크 명령어 DB(302)를 기반으로 대상 프레임워크 명령어 정보를 획득할 수 있고, 대상 프레임워크 명령어 정보에 포함된 명령어들을 기준으로 표준 신경망 모델의 계층을 분리하여 파싱을 수행할 수 있다. 즉, 표준 신경망 코드를 읽어서 처리하는 중에 코드 내에서 새로운 명령어가 인식되는 경우, 새로운 명령어가 인식된 부분을 기준으로 계층을 분리하여 계층별로 파싱을 수행할 수 있다. For example, target framework command information may be obtained based on the framework command DB 302 corresponding to the target framework shown in FIG. 3 , and based on the commands included in the target framework command information, a standard neural network Parsing can be performed by separating the layers of the model. That is, when a new command is recognized in the code while the standard neural network code is read and processed, the layers may be separated based on the recognized part of the new command, and the parsing may be performed for each layer.

이 때, 표준 신경망 코드를 라인(Line) 별로 읽어서 처리하되, 새로운 명령어가 확인되는 경우에 신경망 단위의 분리를 위해 변수 초기화를 수행한 뒤 다음 라인의 코드를 읽을 수 있다. At this time, the standard neural network code is read and processed line by line, but when a new command is confirmed, variable initialization is performed to separate the neural network unit, and then the code of the next line can be read.

예를 들어, 표준 신경망 코드에서 코드를 한 줄 읽어오고, 해당 코드 한 줄에 대한 파싱을 수행하여 파서 트리를 생성할 수 있다. 즉, 한 줄의 코드를 트리구조로 분리하여 생성할 수 있다. 이 후, 다음 라인의 코드를 또 한 줄 읽어와서 처리하되, 다음 라인의 코드에서 새로운 명령어가 인식되는 경우에는 신경망 단위의 계층 분리를 위해서 변수를 초기화한 뒤 다음 라인을 처리하도록 할 수도 있다. For example, a parser tree can be generated by reading a line of code from a standard neural network code and parsing the line of code. That is, one line of code can be generated by separating it into a tree structure. After that, the next line of code is read and processed. However, when a new command is recognized in the code of the next line, the variable may be initialized for layer separation of the neural network unit and then the next line may be processed.

이와 같은 방식으로 표준 신경망 코드 전체를 읽어서 신경망 단위로 파싱을 수행하여 복수개의 파서 트리들을 생성할 수 있다. In this way, a plurality of parser trees can be generated by reading the entire standard neural network code and performing parsing in units of neural networks.

이 때, 파싱에 의해 생성된 파서 트리(Parser Tree)를 기반으로 명세화 데이터를 저장할 수 있다. 또는 파서 트리의 형태 자체를 명세화 데이터로 저장할 수도 있다. In this case, specification data may be stored based on a parser tree generated by parsing. Alternatively, the form of the parser tree itself may be stored as specification data.

이 때, 명세화 데이터는 표준 신경망 코드에 상응하는 명령어 및 인자값 중 적어도 하나를 포함할 수 있다. In this case, the specification data may include at least one of a command and a factor value corresponding to a standard neural network code.

이 때, 인자값은 변수와 변수값, 배열값 등을 포함할 수 있는데, 변수값의 변수가 존재하지 않을 경우에는 변수값이 계층 기반의 신경망 코드에 대입되는 위치 및 조건을 고려하여 변수값에 상응하는 변수를 생성할 수 있다. 예를 들어, 변수값의 변수가 존재하지 않지만, 변수값이 계층 기반의 신경망 코드에 대입되는 위치 및 조건 상 변수값의 bottom의 값이라고 가정한다면, 변수값에 상응하게 bottom에 상응하는 변수를 생성할 수도 있다. At this time, the factor value may include a variable, a variable value, an array value, and the like. Corresponding variables can be created. For example, if there is no variable of the variable value, but the variable value is the value of the bottom of the variable value according to the location and condition assigned to the layer-based neural network code, create a variable corresponding to the bottom corresponding to the variable value. You may.

상기에서 설명한 것과 같이, 표준 신경망 모델 또는 표준 신경망 코드를 분리하는 기본 분리단위는 신경망 1개의 생성단위에 상응할 수 있으며, 대상 프레임워크가 지원하는 명령어를 기준으로 분리하여 명세화할 수 있다.As described above, the basic separation unit for separating the standard neural network model or the standard neural network code may correspond to one generation unit of the neural network, and may be separated and specified based on the instruction supported by the target framework.

또한, 프로세서(1020)는 계층 기반의 신경망 명세를 기반으로 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성한다.In addition, the processor 1020 generates a transformation model by substituting specification data of a standard neural network model into a layer-based neural network code based on a layer-based neural network specification.

이 때, 신경망 단위로 생성된 명세화 데이터에 포함된 명령어 및 인자값을 각각 계층 기반의 신경망 코드에 대입시킬 수 있다. In this case, the command and factor values included in the specification data generated in units of the neural network may be substituted into the layer-based neural network code, respectively.

예를 들어, 도 6에 도시된 형식은 NNEF 기반 신경망 모델을 계층 기반의 신경망 모델로 변경한 변환 모델의 형식, 즉 계층 기반의 신경망 명세 형식에 상응할 수 있다. 도 6을 참조하면, 명세화 데이터에 포함된 각각의 신경망의 명령어 부분의 변수를 name로 설정하고, 프레임워크 명령어 정보를 기반으로 해당 명령어의 type을 설정할 수 있다. For example, the format shown in FIG. 6 may correspond to the format of the transformation model obtained by changing the NNEF-based neural network model to the layer-based neural network model, that is, the layer-based neural network specification format. Referring to FIG. 6 , a variable of a command part of each neural network included in the specification data may be set as a name, and a type of a corresponding command may be set based on framework command information.

또한, 입력값은 bottom에 대입하고, 출력값은 top에 대입하여 나타낼 수 있다. 이 때, top은 명령어에 대응하는 변수명을 대입하여 생성될 수 있으며, 대입할 bottom과 top이 더 있다면 추가적으로 기입할 수도 있다. Also, the input value can be substituted for the bottom and the output value can be substituted for the top. At this time, top can be created by substituting the variable name corresponding to the command, and if there are more bottom and top to be assigned, they can be additionally written.

또한, 입력과 출력의 차원들은 명세화 데이터에 저장된 각각의 신경망 변수들을 확인하여 분리하고 대입시킬 수 있다. 이 후, 나머지 필요한 부분만을 대입하여 계층 기반의 명세를 생성할 수 있다. In addition, the dimensions of the input and output can be separated and assigned by checking each neural network variable stored in the specification data. After that, it is possible to create a layer-based specification by substituting only the remaining necessary parts.

즉, 도 5에 도시된 표준 신경망 모델의 명세화 데이터를 도 6과 같은 계층 기반의 신경망 명세 형식에 대입하여 도 7에 도시된 것과 같은 변환 모델을 생성할 수 있다. 이 때, 도 6에 도시된 형식은 Caffe 계층 기반의 신경망 모델에 상응할 수 있다. That is, the transformation model shown in FIG. 7 may be generated by substituting specification data of the standard neural network model shown in FIG. 5 into the layer-based neural network specification format shown in FIG. 6 . In this case, the format shown in FIG. 6 may correspond to a Caffe layer-based neural network model.

또한, 프로세서(1020)는 표준 신경망 모델과 변환 모델을 비교하여 변환 모델을 검증한다.In addition, the processor 1020 verifies the transformation model by comparing the standard neural network model with the transformation model.

이 때, 표준 신경망 코드와 변환 모델에 상응하는 신경망 코드 간의 명령어 계수, 명령어 순서 및 인자 수 중 적어도 하나를 비교하여 검증을 수행할 수 있다. In this case, verification may be performed by comparing at least one of the instruction coefficient, the instruction order, and the number of arguments between the standard neural network code and the neural network code corresponding to the transformation model.

예를 들어, 표준 신경망 코드의 명령어 계수를 변환 모델에 상응하는 계층 기반 신경망 코드의 계층(Layer) 명령어 계수와 비교하여 검증을 수행할 수 있다. 이 때, 표준 신경망 코드의 명령어 계수와 계층 기반 신경망 코드의 계층 명령어 계수가 일치하지 않는 경우, 명령어 계수 오류가 발생한 것으로 판단하고, 오류 정보를 출력할 수 있다. For example, the verification may be performed by comparing the instruction coefficients of the standard neural network code with the layer instruction coefficients of the layer-based neural network code corresponding to the transformation model. At this time, when the instruction coefficient of the standard neural network code and the instruction coefficient of the layer-based neural network code do not match, it is determined that an instruction coefficient error has occurred, and error information may be output.

다른 예를 들어, 표준 신경망 코드의 명령어 순서를 변환 모델에 상응하는 계층 기반 신경망 코드의 계층(Layer) 명령어 순서와 비교하여 검증을 수행할 수 있다. 이 때, 표준 신경망 코드의 명령어 순서와 계층 기반 신경망 코드의 계층 명령어 순서가 일치하지 않는 경우, 명령어 순서 오류가 발생한 것으로 판단하고, 오류 정보를 출력할 수 있다.As another example, verification may be performed by comparing the instruction sequence of the standard neural network code with the layer instruction sequence of the layer-based neural network code corresponding to the transformation model. In this case, when the command sequence of the standard neural network code does not match the layer command sequence of the layer-based neural network code, it is determined that a command sequence error has occurred, and error information may be output.

또 다른 예를 들어, 표준 신경망 코드의 명령어 인자 수를 변환 모델에 상응하는 계층 기반 신경망 코드의 계층(Layer) 명령어 인자 수와 비교하여 검증을 수행할 수 있다. 이 때, 표준 신경망 코드의 명령어 인자 수와 계층 기반 신경망 코드의 명령어 인자 수가 일치하지 않는 경우, 명령어 인자 수 오류가 발생한 것으로 판단하고, 오류 정보를 출력할 수도 있다.As another example, the verification may be performed by comparing the number of instruction arguments of the standard neural network code with the number of layer instruction arguments of the layer-based neural network code corresponding to the transformation model. At this time, when the number of command parameters of the standard neural network code does not match the number of command parameters of the layer-based neural network code, it is determined that an error in the number of command parameters has occurred, and error information may be output.

이 때, 명령어 계수, 명령어 순서 및 인자 수를 각각 이용한 검증 과정은 순서에 상관없이 수행될 수 있으며, 명령어 계수, 명령어 순서 및 인자 수를 모두 이용하여 검증을 수행할 수도 있고 명령어 계수, 명령어 순서 및 인자 수 중 일부만을 이용하여 검증을 수행할 수도 있다. In this case, the verification process using each of the instruction coefficient, instruction order, and number of arguments may be performed irrespective of the order, and the verification may be performed using all of the instruction coefficient, instruction order, and number of arguments. Verification can also be performed using only a part of the number of factors.

이와 같은 과정을 통해서 계층 기반의 신경망 모델의 검증을 수행할 수 있고, 검증이 완료됨으로써 계층 기반의 신경망 모델의 생성이 완료될 수 있다.Through this process, verification of the layer-based neural network model can be performed, and when the verification is completed, the generation of the layer-based neural network model can be completed.

메모리(1030)는 NNEF 규칙 및 대상 프레임워크 명령어 정보를 관리하고, 표준 신경망 모델 및 변환 모델을 저장할 수 있다.The memory 1030 may manage NNEF rules and target framework instruction information, and store a standard neural network model and a transformation model.

또한, 메모리(1030)는 상술한 바와 같이 본 발명의 일실시예에 따른 신경망 모델 변환을 위한 기능을 지원할 수도 있다. 이 때, 메모리(1030)는 별도의 대용량 스토리지로 동작할 수 있고, 동작 수행을 위한 제어 기능을 포함할 수도 있다. Also, as described above, the memory 1030 may support a function for transforming a neural network model according to an embodiment of the present invention. In this case, the memory 1030 may operate as a separate mass storage and may include a control function for performing an operation.

한편 신경망 모델 변환 장치는 메모리가 탑재되어 그 장치 내에서 정보를 저장할 수 있다. 일 구현예의 경우, 메모리는 컴퓨터로 판독 가능한 매체이다. 일 구현 예에서, 메모리는 휘발성 메모리 유닛일 수 있으며, 다른 구현예의 경우, 메모리는 비휘발성 메모리 유닛일 수도 있다. 일 구현예의 경우, 저장장치는 컴퓨터로 판독 가능한 매체이다. 다양한 서로 다른 구현 예에서, 저장장치는 예컨대 하드디스크 장치, 광학디스크 장치, 혹은 어떤 다른 대용량 저장장치를 포함할 수도 있다.On the other hand, the neural network model conversion device is equipped with a memory and can store information in the device. For one implementation, the memory is a computer-readable medium. In one implementation, the memory may be a volatile memory unit, and in another implementation, the memory may be a non-volatile memory unit. In one embodiment, the storage device is a computer-readable medium. In various different implementations, the storage device may include, for example, a hard disk device, an optical disk device, or some other mass storage device.

이와 같은 신경망 모델 변환 장치를 이용하여 딥 뉴럴 네트워크를 또 다른 프레임워크에서 동작하도록 신경망 코드를 변환할 수 있다.A neural network code can be converted to operate a deep neural network in another framework by using such a neural network model converter.

또한, 미리 만들어진 학습데이터와 신경망을 원하는 장치에서 지원하는 프레임워크로 구동시킬 수 있으며, 딥 러닝 프레임워크 간의 호환성을 보장할 수도 있다.In addition, pre-made training data and neural networks can be driven by a framework supported by a desired device, and compatibility between deep learning frameworks can be guaranteed.

도 11은 본 발명의 일실시예에 따른 컴퓨터 시스템을 나타낸 도면이다.11 is a diagram illustrating a computer system according to an embodiment of the present invention.

도 11을 참조하면, 본 발명의 실시예는 컴퓨터로 읽을 수 있는 기록매체와 같은 컴퓨터 시스템에서 구현될 수 있다. 도 11에 도시된 바와 같이, 컴퓨터 시스템(1100)은 버스(1120)를 통하여 서로 통신하는 하나 이상의 프로세서(1110), 메모리(1130), 사용자 입력 장치(1140), 사용자 출력 장치(1150) 및 스토리지(1160)를 포함할 수 있다. 또한, 컴퓨터 시스템(1100)은 네트워크(1180)에 연결되는 네트워크 인터페이스(1170)를 더 포함할 수 있다. 프로세서(1110)는 중앙 처리 장치 또는 메모리(1130)나 스토리지(1160)에 저장된 프로세싱 인스트럭션들을 실행하는 반도체 장치일 수 있다. 메모리(1130) 및 스토리지(1160)는 다양한 형태의 휘발성 또는 비휘발성 저장 매체일 수 있다. 예를 들어, 메모리는 ROM(1131)이나 RAM(1132)을 포함할 수 있다.Referring to FIG. 11 , an embodiment of the present invention may be implemented in a computer system such as a computer-readable recording medium. As shown in FIG. 11 , computer system 1100 includes one or more processors 1110 , memory 1130 , user input device 1140 , user output device 1150 , and storage that communicate with each other via bus 1120 . (1160) may be included. In addition, the computer system 1100 may further include a network interface 1170 coupled to the network 1180 . The processor 1110 may be a central processing unit or a semiconductor device that executes processing instructions stored in the memory 1130 or the storage 1160 . The memory 1130 and the storage 1160 may be various types of volatile or non-volatile storage media. For example, the memory may include a ROM 1131 or a RAM 1132 .

따라서, 본 발명의 실시예는 컴퓨터로 구현된 방법이나 컴퓨터에서 실행 가능한 명령어들이 기록된 비일시적인 컴퓨터에서 읽을 수 있는 매체로 구현될 수 있다. 컴퓨터에서 읽을 수 있는 명령어들이 프로세서에 의해서 수행될 때, 컴퓨터에서 읽을 수 있는 명령어들은 본 발명의 적어도 한 가지 측면에 따른 방법을 수행할 수 있다.Accordingly, the embodiment of the present invention may be implemented as a computer-implemented method or a non-transitory computer-readable medium in which computer-executable instructions are recorded. When the computer readable instructions are executed by a processor, the computer readable instructions may perform a method according to at least one aspect of the present invention.

이상에서와 같이 본 발명에 따른 신경망 모델 변환 방법 및 이를 위한 장치는 상기한 바와 같이 설명된 실시예들의 구성과 방법이 한정되게 적용될 수 있는 것이 아니라, 상기 실시예들은 다양한 변형이 이루어질 수 있도록 각 실시예들의 전부 또는 일부가 선택적으로 조합되어 구성될 수도 있다.As described above, in the method and apparatus for converting a neural network model according to the present invention, the configuration and method of the embodiments described above are not limitedly applicable, but the embodiments are implemented in each embodiment so that various modifications can be made. All or part of the examples may be configured in selective combination.

100: 텐서플로 기반 뉴럴 네트워크 모델
110: 신경망 모델 변환 영역 111: NNEF 기반 뉴럴 네트워크 모델
112: 계층 기반 뉴럴 네트워크 모델 301: NNEF 규칙 DB
302: 프레임워크 명령어 DB 1010: 통신부
1020: 프로세서 1030: 메모리
1100: 컴퓨터 시스템 1110: 프로세서
1120: 버스 1130: 메모리
1131: 롬 1132: 램
1140: 사용자 입력 장치 1150: 사용자 출력 장치
1160: 스토리지 1170: 네트워크 인터페이스
1180: 네트워크
100: TensorFlow-based neural network model
110: neural network model transformation domain 111: NNEF-based neural network model
112: Layer-based neural network model 301: NNEF rule DB
302: framework command DB 1010: communication unit
1020: processor 1030: memory
1100: computer system 1110: processor
1120: bus 1130: memory
1131: rom 1132: ram
1140: user input device 1150: user output device
1160: storage 1170: network interface
1180: network

Claims (12)

신경망 모델 변환 장치가, NNEF(NEURAL NETWORK EXCHANGE FORMAT)를 기반으로 하는 신경망 변환 규칙에 상응하는 NNEF(NEURAL NETWORK EXCHANGE FORMAT) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화하는 단계;
상기 신경망 모델 변환 장치가, 계층 기반의 신경망 명세를 기반으로 상기 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성하는 단계; 및
상기 신경망 모델 변환 장치가, 상기 표준 신경망 모델과 상기 변환 모델을 비교하여 상기 변환 모델을 검증하는 단계
를 포함하고,
상기 명세화하는 단계는
상기 NNEF 기반의 표준 신경망 모델에 상응하게 상기 NNEF 규칙에 의한 명령어 체계를 기반으로 작성된 표준 신경망 코드를 상기 대상 프레임워크 명령어 정보를 기준으로 신경망 단위로 파싱하고(PARSING), 상기 파싱에 의해 생성된 파서 트리(PARSER TREE)를 기반으로 상기 명세화 데이터를 저장하고,
상기 대상 프레임워크 명령어 정보는
상기 표준 신경망 모델을 적용하여 사용하고자 하는 대상 프레임워크에서 사용하는 명령어들에 대한 정보에 상응하는 것을 특징으로 하는 신경망 모델 변환 방법.
The neural network model transformation unit converts the NNEF-based standard neural network model into a neural network unit based on the NNEF (NEURAL NETWORK EXCHANGE FORMAT) rule and the target framework instruction information corresponding to the neural network transformation rule based on NNEF (NEURAL NETWORK EXCHANGE FORMAT). specifying;
generating, by the neural network model transformation apparatus, a transformation model by substituting specification data of the standard neural network model into a hierarchy-based neural network code based on a hierarchy-based neural network specification; and
Comparing, by the neural network model transformation device, the standard neural network model and the transformation model to verify the transformation model
including,
The step of specifying
Corresponding to the NNEF-based standard neural network model, the standard neural network code written based on the command system by the NNEF rule is parsed in units of neural networks based on the target framework command information (PARSING), and the parser generated by the parsing Storing the specification data based on the tree (PARSER TREE),
The target framework command information is
A method for converting a neural network model, characterized in that it corresponds to information on commands used in a target framework to be used by applying the standard neural network model.
삭제delete 청구항 1에 있어서,
상기 명세화 데이터는
상기 표준 신경망 코드에 상응하는 명령어 및 인자값 중 적어도 하나를 포함하는 것을 특징으로 하는 신경망 모델 변환 방법.
The method according to claim 1,
The specification data is
A method for transforming a neural network model comprising at least one of a command and a factor value corresponding to the standard neural network code.
청구항 1에 있어서,
상기 검증하는 단계는
상기 표준 신경망 코드와 상기 변환 모델에 상응하는 신경망 코드 간의 명령어 계수, 명령어 순서 및 인자 수 중 적어도 하나를 비교하여 검증을 수행하는 것을 특징으로 하는 신경망 모델 변환 방법.
The method according to claim 1,
The verification step is
A neural network model transformation method, characterized in that the verification is performed by comparing at least one of an instruction coefficient, an instruction order, and a number of arguments between the standard neural network code and the neural network code corresponding to the transformation model.
청구항 3에 있어서,
상기 명세화하는 단계는
상기 인자값에 상응하는 변수값의 변수가 존재하지 않을 경우, 상기 변수값이 상기 계층 기반의 신경망 코드에 대입되는 위치 및 조건을 고려하여 상기 변수값에 상응하는 변수를 생성하는 단계를 더 포함하는 것을 특징으로 하는 신경망 모델 변환 방법.
4. The method according to claim 3,
The step of specifying
When a variable of a variable value corresponding to the factor value does not exist, generating a variable corresponding to the variable value in consideration of the location and condition in which the variable value is substituted into the layer-based neural network code Neural network model transformation method, characterized in that.
청구항 1에 있어서,
상기 파싱하는 단계는
상기 표준 신경망 코드를 라인(LINE) 별로 읽어서 처리하되, 새로운 명령어가 확인되는 경우에 신경망 단위의 분리를 위해 변수 초기화를 수행한 뒤 다음 라인의 코드를 읽는 것을 특징으로 하는 신경망 모델 변환 방법.
The method according to claim 1,
The parsing step
The standard neural network code is read and processed by line (LINE), but when a new command is confirmed, variable initialization is performed to separate the neural network unit, and then the code of the next line is read.
NNEF(NEURAL NETWORK EXCHANGE FORMAT)를 기반으로 하는 신경망 변환 규칙에 상응하는 NNEF(NEURAL NETWORK EXCHANGE FORMAT) 규칙 및 대상 프레임워크 명령어 정보를 기반으로 NNEF 기반의 표준 신경망 모델을 신경망 단위로 명세화하고, 계층 기반의 신경망 명세를 기반으로 상기 표준 신경망 모델의 명세화 데이터를 계층 기반의 신경망 코드에 대입시켜 변환 모델을 생성하고, 상기 표준 신경망 모델과 상기 변환 모델을 비교하여 상기 변환 모델을 검증하는 프로세서 및
상기 NNEF 규칙 및 대상 프레임워크 명령어 정보를 관리하고, 상기 표준 신경망 모델 및 변환 모델을 저장하는 메모리
를 포함하고,
상기 프로세서는
상기 NNEF 기반의 표준 신경망 모델에 상응하게 상기 NNEF 규칙에 의한 명령어 체계를 기반으로 작성된 표준 신경망 코드를 상기 대상 프레임워크 명령어 정보를 기준으로 신경망 단위로 파싱하고(PARSING), 상기 파싱에 의해 생성된 파서 트리(PARSER TREE)를 기반으로 상기 명세화 데이터를 저장하고,
상기 대상 프레임워크 명령어 정보는
상기 표준 신경망 모델을 적용하여 사용하고자 하는 대상 프레임워크에서 사용하는 명령어들에 대한 정보에 상응하는 것을 특징으로 하는 신경망 모델 변환 장치.
Based on the NNEF (NEURAL NETWORK EXCHANGE FORMAT) rule and the target framework command information that corresponds to the neural network transformation rule based on NNEF (NEURAL NETWORK EXCHANGE FORMAT), the NNEF-based standard neural network model is specified as a neural network unit, and the A processor for generating a transformation model by substituting specification data of the standard neural network model into a layer-based neural network code based on a neural network specification, and verifying the transformation model by comparing the standard neural network model with the transformation model;
A memory that manages the NNEF rule and target framework instruction information, and stores the standard neural network model and transformation model
including,
the processor
Corresponding to the NNEF-based standard neural network model, the standard neural network code written based on the command system by the NNEF rule is parsed in units of neural networks based on the target framework command information (PARSING), and the parser generated by the parsing Storing the specification data based on the tree (PARSER TREE),
The target framework command information is
Neural network model conversion apparatus, characterized in that it corresponds to information on commands used in a target framework to be used by applying the standard neural network model.
삭제delete 청구항 7에 있어서,
상기 명세화 데이터는
상기 표준 신경망 코드에 상응하는 명령어 및 인자값 중 적어도 하나를 포함하는 것을 특징으로 하는 신경망 모델 변환 장치.
8. The method of claim 7,
The specification data is
Neural network model transformation apparatus comprising at least one of a command and a factor value corresponding to the standard neural network code.
청구항 7에 있어서,
상기 프로세서는
상기 표준 신경망 코드와 상기 변환 모델에 상응하는 신경망 코드 간의 명령어 계수, 명령어 순서 및 인자 수 중 적어도 하나를 비교하여 검증을 수행하는 것을 특징으로 하는 신경망 모델 변환 장치.
8. The method of claim 7,
the processor
A neural network model transformation apparatus, characterized in that the verification is performed by comparing at least one of an instruction coefficient, an instruction order, and a number of arguments between the standard neural network code and the neural network code corresponding to the transformation model.
청구항 9에 있어서,
상기 프로세서는
상기 인자값에 상응하는 변수값의 변수가 존재하지 않을 경우, 상기 변수값이 상기 계층 기반의 신경망 코드에 대입되는 위치 및 조건을 고려하여 상기 변수값에 상응하는 변수를 생성하는 것을 특징으로 하는 신경망 모델 변환 장치.
10. The method of claim 9,
the processor
Neural network, characterized in that when a variable of a variable value corresponding to the factor value does not exist, a variable corresponding to the variable value is generated in consideration of the location and condition in which the variable value is substituted into the layer-based neural network code model converter.
청구항 7에 있어서,
상기 프로세서는
상기 표준 신경망 코드를 라인(LINE)별로 읽어서 처리하되, 새로운 명령어가 확인되는 경우에 신경망 단위의 분리를 위해 변수 초기화를 수행한 뒤 다음 라인의 코드를 읽는 것을 것을 특징으로 하는 신경망 모델 변환 장치.
8. The method of claim 7,
the processor
The standard neural network code is read and processed by line (LINE), but when a new command is confirmed, variable initialization is performed to separate the neural network unit, and then the code of the next line is read.
KR1020180130899A 2018-10-30 2018-10-30 Method for converting neural network model and apparatus therefor KR102263371B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020180130899A KR102263371B1 (en) 2018-10-30 2018-10-30 Method for converting neural network model and apparatus therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180130899A KR102263371B1 (en) 2018-10-30 2018-10-30 Method for converting neural network model and apparatus therefor

Publications (2)

Publication Number Publication Date
KR20200048629A KR20200048629A (en) 2020-05-08
KR102263371B1 true KR102263371B1 (en) 2021-06-11

Family

ID=70677648

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180130899A KR102263371B1 (en) 2018-10-30 2018-10-30 Method for converting neural network model and apparatus therefor

Country Status (1)

Country Link
KR (1) KR102263371B1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102568010B1 (en) * 2020-11-20 2023-08-22 (주)한국플랫폼서비스기술 Predition system for fault of machine tool using deep learning inference system based on query and method thereof
KR20220088169A (en) * 2020-12-18 2022-06-27 삼성전자주식회사 Electronic device and operating method for converting an artificial intelligence model
CN113723601A (en) * 2021-08-30 2021-11-30 北京市商汤科技开发有限公司 Neural network model conversion method, device, equipment and storage medium
CN114116051B (en) * 2021-11-17 2024-03-22 招联消费金融股份有限公司 Processing method, device, equipment and storage medium based on neural network model

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100445264B1 (en) 2002-11-06 2004-08-21 학교법인 인하학원 Hardware of reconfigurable and expandable neural networks

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8336036B2 (en) 2008-11-21 2012-12-18 Korea University Industrial & Academic Collaboration Foundation System and method for translating high programming level languages code into hardware description language code
KR101686827B1 (en) * 2015-03-17 2016-12-16 인천대학교 산학협력단 Method for implementing artificial neural networks in neuromorphic hardware
KR102061615B1 (en) * 2016-12-26 2020-01-02 한국과학기술원 Dropout method for improving training speed and memory efficiency on artificial neural network and learning method based on the same
KR102043075B1 (en) * 2017-11-24 2019-11-11 슈어소프트테크주식회사 Model verification method through model change analysis and medel verification apparatus using the same

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100445264B1 (en) 2002-11-06 2004-08-21 학교법인 인하학원 Hardware of reconfigurable and expandable neural networks

Also Published As

Publication number Publication date
KR20200048629A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
KR102263371B1 (en) Method for converting neural network model and apparatus therefor
US11126798B1 (en) Applied artificial intelligence technology for conversational inferencing and interactive natural language generation
CN108885545B (en) Tools and methods for real-time dataflow programming languages
CN1195278C (en) XML-robot
EP3564812B1 (en) Method and system for automated creation of graphical user interfaces
CN109491658A (en) The generation method and device of computer-executable code data
US9405518B2 (en) Leveraging legacy applications for use with modern applications
CN106951305B (en) Method for generating midCore script from QVT-R language based on model conversion
US20100211197A1 (en) Methods and apparatus to configure a process control system using an electronic description language script
CN114840196B (en) Modelica language model processing method, device and storage medium
CN103677952A (en) Coder decoder generating device and method
CN113887173A (en) XML-based protocol dynamic packaging and analyzing method
CN115617963A (en) Generating relational links for question answering
CN107092474A (en) Program developing method, ETL processing method and processing devices
Tauscher Creating and maintaining IFC–Citygml conversion rules
CN110659022B (en) Method for automatically calling Python script based on Java
CN111708542A (en) Test case generation method, system, device and storage medium
WO2020093304A1 (en) Method, apparatus, and device for compiling neural network, storage medium, and program product
US20130287121A1 (en) Method and apparatus for parsing bitstream, and generic parsing apparatus
JP5201808B2 (en) Electronic document processing apparatus and electronic document processing method
CN113971032A (en) Full-process automatic deployment method and system of machine learning model for code generation
KR101314247B1 (en) Language conversion apparatus and method for autonomous of satellite control in satellite ground control system
KR20160123801A (en) Reference satellite database generating system by using mapping tables
JP5181788B2 (en) Source program language conversion apparatus, method and program
CN117555925B (en) Database access code conversion method and device and electronic equipment

Legal Events

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