Electronic device and method for controlling the same
阅读说明:本技术 电子装置和用于控制该电子装置的方法 (Electronic device and method for controlling the same ) 是由 赵韩秀 金庆勳 朴永焕 金硕镇 金铉中 权东旭 于 2018-06-05 设计创作,主要内容包括:公开了一种电子装置。所述电子装置包括:存储器;以及处理器,针对从根据神经网络的学习产生的多个滤波器选择的每个主样式的滤波器检查用于对神经网络的输入数据进行滤波的操作命令,并且将检查的操作命令存储在存储器中。(An electronic device is disclosed. The electronic device includes: a memory; and a processor checking an operation command for filtering input data of the neural network for each filter of the main pattern selected from the plurality of filters generated according to the learning of the neural network, and storing the checked operation command in the memory.)
1. An electronic device, comprising:
a memory; and
a processor configured to check an operation instruction for filtering input data of the neural network for a filter of each main pattern selected from a plurality of filters generated according to learning by the neural network, and store the checked operation instruction in the memory.
2. The electronic device as claimed in claim 1, wherein the processor performs a filtering operation by the filter of the main pattern by using the stored operation instruction.
3. The electronic apparatus according to claim 1, wherein the filter of the main pattern is a filter selected among the plurality of generated filters based on a statistical weight of an operation amount occupied by each pattern for each pattern in which non-zero elements are arranged.
4. The electronic device of claim 1, wherein the processor selects the primary pattern among the plurality of generated filters based on a frequency of each pattern in which non-zero elements are arranged.
5. The electronic device of claim 1, further comprising: a communication device for communicating with a plurality of communication devices,
wherein the processor transmits the operation instruction to another electronic device through the communicator, and
the other electronic device performs a filtering operation by the filter of the main pattern by using the operation instruction.
6. The electronic device of claim 1, wherein the processor checks optimization data from which zero elements are removed from the selected filter of the main pattern and an operation instruction corresponding to the optimization data, and stores the checked optimization data and operation instruction in the memory.
7. The electronic device of claim 6, wherein the processor performs a filtering operation through the filter of the main pattern by using the stored optimization data and an operation instruction corresponding to the identification information included in the stored optimization data.
8. The electronic device of claim 6, further comprising: a communication device for communicating with a plurality of communication devices,
wherein the processor transmits the optimization data and the operation instruction to another electronic device through the communicator, and
the other electronic device performs a filtering operation through the filter of the main pattern by using the received optimization data and an operation instruction corresponding to the identification information included in the received optimization data.
9. A method for controlling an electronic device, the method comprising:
checking an operation instruction for filtering input data of the neural network for a filter of each main pattern selected from a plurality of filters generated according to learning by the neural network; and is
The checked operation instruction is stored.
10. The method of claim 9, further comprising: performing a filtering operation by the filter of the main pattern by using the stored operation instruction.
11. The method of claim 9, wherein the filter of the main pattern is a filter selected among the plurality of generated filters based on a statistical weight of an operation amount occupied by each pattern for each pattern in which non-zero elements are arranged.
12. The method of claim 9, wherein in the checking of the operation instruction, the main pattern is selected among the generated plurality of filters based on a frequency of each pattern in which non-zero elements are arranged.
13. The method of claim 9, further comprising: transmitting the stored operation instruction to another electronic device,
wherein the other electronic device performs a filtering operation by the filter of the main pattern by using an operation instruction.
14. The method of claim 9, wherein in the checking of the operation instruction, optimization data in which zero elements are removed from the selected filter of the main pattern and an operation instruction corresponding to the optimization data are checked, and
in the step of storing the checked operation instruction, the checked optimization data and the operation instruction are stored.
15. The method of claim 14, further comprising: performing a filtering operation through the filter of the main pattern by using the stored optimization data and an operation instruction corresponding to the identification information included in the stored optimization data.
Technical Field
The present disclosure relates to an electronic device and a method for controlling the same, and more particularly, to an electronic device and a method for controlling the same to reduce the amount of operations required in a process of performing learning through a neural network.
Background
Machine learning in the field of artificial intelligence refers to a technique for studying and constructing a system for predicting the future and improving its performance by collecting and analyzing large-scale big data and an algorithm for the system.
In recent years, as hardware technology has been developed, as computer skills and techniques capable of collecting and storing large data and analyzing the large data have become more complicated and rapid, research into machine learning, which is an algorithm that can recognize an object and understand information like a human, has been actively conducted. In particular, in the field of machine learning technology, research on deep learning of a self-learning method using a neural network is active.
The neural network is an algorithm in which an excitation function is intended to determine a final output by comparing a sum obtained by multiplying a plurality of inputs with weights with a specific boundary value to actively simulate the function of the human brain, and generally includes a plurality of layers. Representative examples of the neural network include a convolutional neural network (hereinafter, CNN) widely used for image recognition, a recurrent neural network (hereinafter, RNN) widely used for voice recognition, and the like.
However, in the conventional CNN, since a filtering operation by convolution is basically performed, a large number of operations are required since a plurality of filters are applied to input data. That is, since the convolution operation is repeated for the generation of the feature map, a large number of operations and large-capacity neural network parameters are required, which in turn causes problems of degradation in operation speed and inefficient use of memory.
Therefore, in machine learning, there is a demand for a method for reducing the burden of such an operation.
Disclosure of Invention
Technical problem
The present disclosure provides an electronic device and a method for controlling the electronic device to improve operation speed and memory usage in an operation process of a neural network.
Technical scheme
According to an embodiment of the present disclosure, an electronic apparatus includes: a memory; and a processor configured to check an operation instruction for filtering input data of the neural network for a filter of each main pattern selected from a plurality of filters generated according to learning by the neural network, and store the checked operation instruction in the memory.
The processor may perform a filtering operation by the filter of the main pattern by using the stored operation instructions.
The filter of the main pattern may be a filter selected among the plurality of generated filters based on a statistical weight of an operation amount occupied by each pattern for each pattern in which non-zero elements are arranged.
The processor may select a main pattern among the generated plurality of filters based on a frequency of each pattern in which non-zero elements are arranged.
The electronic device may further include a communicator, wherein the processor may transmit the operation instruction to another electronic device through the communicator, and the another electronic device may perform a filtering operation through the filter of the main pattern by using the operation instruction.
The processor may check the optimization data from which zero elements are removed from the filter of the selected main pattern and an operation instruction corresponding to the optimization data, and store the checked optimization data and operation instruction in the memory.
The processor may perform a filtering operation through the filter of the main pattern by using the stored optimization data and an operation instruction corresponding to the identification information included in the stored optimization data.
The processor may transmit the optimization data and the operation instruction to the other electronic device through the communicator, and the other electronic device may perform a filtering operation through the filter of the main pattern by using the received optimization data and the operation instruction corresponding to the identification information included in the received optimization data.
According to another embodiment of the present disclosure, a method for controlling an electronic device includes: checking an operation instruction for filtering input data of the neural network for a filter of each main pattern selected from a plurality of filters generated according to learning by the neural network; and stores the checked operation instruction.
The method may further include performing a filtering operation by the filter of the main pattern by using the stored operation instruction.
The filter of the main pattern may be a filter selected among the plurality of generated filters based on a statistical weight of an operation amount occupied by each pattern for each pattern in which non-zero elements are arranged.
In the checking of the operation instruction, a main pattern may be selected among the generated plurality of filters based on a frequency of each pattern in which non-zero elements are arranged.
The method may further include transmitting the stored operation instruction to another electronic device, wherein the another electronic device may perform a filtering operation by the filter of the main pattern using the operation instruction.
In the checking of the operation instruction, the optimization data from which the zero elements are removed from the filter of the selected main pattern and the operation instruction corresponding to the optimization data may be checked, and in the storing of the checked operation instruction, the checked optimization data and the operation instruction may be stored.
The method may further include performing a filtering operation through the filter of the main pattern by using the stored optimization data and the operation instruction included in the stored optimization data.
The method may further include transmitting the stored optimization data and the operation instruction to the other electronic device, wherein the other electronic device may perform a filtering operation through the filter of the main pattern by using the optimization data and the operation instruction corresponding to the identification information included in the optimization data.
Advantageous effects
According to the various embodiments disclosed above, in the operations required for machine learning, the operation speed can be greatly reduced and the operation amount can be reduced, and the memory usage can also be reduced compared to the conventional memory usage.
Drawings
Fig. 1a and 1b are block diagrams schematically illustrating a configuration of an electronic device according to different embodiments of the present disclosure.
Fig. 2 is a diagram illustrating an operation process of a generic CNN performing a classification operation by applying a plurality of filters to input data according to an embodiment of the present disclosure.
Fig. 3a and 3b are diagrams for describing a filter of a main pattern according to an embodiment of the present disclosure.
Fig. 4 is a diagram illustrating a structure of optimization data for a filter having a style a as one of main styles according to an embodiment of the present disclosure.
Fig. 5 is a block diagram schematically illustrating a configuration of another electronic apparatus according to an embodiment of the present disclosure.
Fig. 6 is a diagram illustrating a machine learning system that receives an operation instruction for a main filter from a server and performs a convolution operation using the operation instruction according to an embodiment of the present disclosure.
Fig. 7a and 7b are diagrams for describing a method for learning various types of input images and recognizing the input images using the learned data according to an embodiment of the present disclosure.
Fig. 8 is a flowchart for describing a method of performing learning by a neural network according to an embodiment of the present disclosure.
Detailed Description
Before describing the present disclosure in detail, a method of describing the specification and drawings will be described.
First, general terms have been selected for terms used in the present specification and claims in consideration of the functions of the present disclosure. However, these terms may be changed according to the intention of those skilled in the art, legal or technical explanations, and the emergence of new technologies. In addition, some terms are arbitrarily selected by the applicant. Unless otherwise defined, these terms may be construed as meanings as defined herein and may be construed based on the overall contents of the specification and common technical knowledge in the prior art.
In addition, like reference numerals or symbols in the drawings attached to the present specification denote components or elements performing substantially the same function. For ease of explanation and understanding, the same reference numbers or symbols will be used to describe the different embodiments. That is, although all components having the same reference number are shown in the drawings, the drawings do not imply one embodiment.
In addition, in the present specification and claims, terms including ordinals (such as "first" and "second") may be used to distinguish between components. These ordinals are used to distinguish the same or similar components from each other, and the meaning of the terms should not be construed as being limited by the use of these ordinals. As an example, components combined with these ordinals should not be construed as limiting the order of their use or arrangement. The respective ordinals may be used interchangeably, if necessary.
In this specification, the singular forms include the plural forms unless the context clearly dictates otherwise. It will be understood that the terms "comprises" and "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and components, or groups of features, integers, steps, operations, elements, and components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and components, or groups thereof.
The terms "module", "unit", "means", and the like in the embodiments of the present disclosure are terms used to denote a component that performs at least one function or operation, and such a component may be implemented in hardware or software or a combination of hardware and software. In addition, a plurality of "modules", "units", "parts", etc. may be integrated into at least one module or chip, and may be implemented in at least one processor (not shown), except for the case where the plurality of "modules", "units", "parts", etc. are required to be implemented each in a single specific hardware.
In addition, in the embodiments of the present disclosure, when a component is connected to another component, this includes not only a direct connection but also an indirect connection through another medium. In addition, unless explicitly described otherwise, the meaning of any part "comprising" any component means that any part does not exclude other components and may also include other components.
Hereinafter, the present disclosure will be described in detail with reference to the accompanying drawings.
Fig. 1a and 1b are block diagrams schematically illustrating the configuration of an electronic device according to an embodiment of the present disclosure.
Referring to fig. 1a, an
The
The
The
Here, the filter is defined as a weight matrix as a mask having weights. The filter is also considered a window or kernel. The weights constituting the matrix in the filter include zero elements of 0 (zero value) or approximately 0 and non-zero elements having a constant value between 0 and 1, and may have various patterns according to the function of the filter.
For example, in the case where the neural network is implemented as a convolutional neural network (hereinafter, CNN) for identifying an image, the
As described above, the
On the other hand, the filter of the main pattern is a filter in which non-zero elements among a plurality of learned filters are arranged as the main pattern, and refers to a filter including a pattern occupying an operation amount larger than or equal to a predetermined ratio during a filtering operation, or a filter including a pattern occupying a frequency larger than or equal to the predetermined ratio among a plurality of learned filters. This will be described in detail with reference to fig. 3a and 3 b.
On the other hand, the preprocessing performed by the
The
In addition, the electronic device 100' according to another embodiment may further include a communicator 130 as shown in fig. 1b, and the
The communicator 130 may transmit and receive a wireless signal with the other
In addition, communicator 130 may support Wi-Fi, Bluetooth, and Wi-Fi direct, and may include an Ethernet terminal for connecting to a wired network.
In addition, the communicator 130 may transmit the operation instruction to the other
On the other hand, the
In addition, the operation instruction is an instruction for causing, in an operation module for filtering input data of the neural network, a specific processing element among a plurality of processing elements included in the operation module to perform a specific operation. The plurality of processing elements may be arranged in a predetermined configuration to construct an operational module.
Such an operation module may be included in the other
On the other hand, the
Fig. 2 illustrates an operation process of a general CNN performing a classification operation by applying a plurality of filters to input data according to an embodiment of the present disclosure.
As shown in fig. 2, a plurality of filters 22-1 to 22-n may be applied to the
Here, the
The CNN basically has a structure in which a convolutional layer and a pooling layer are repeated. In the convolutional layer, a plurality of feature maps 23-1 to 23-n for the
Fig. 3a and 3b are diagrams for describing a filter of a main pattern according to an embodiment of the present disclosure.
As shown in fig. 3a, in a neural network, a filter having a constant pattern based on a form in which zero values or zero elements (which may be approximated to zero values) and non-zero elements (having a constant value between 0 and 1, non-zero values) are arranged is used.
In this case, as shown in fig. 3b, among the filters used in the neural network, there is a filter having a pattern of use (that is, a main pattern) of a certain high frequency. Filters with a main pattern are widely used for all types of neural networks, and the filters with the main pattern can be used to classify images with a constant high probability. Since the operation amount for the filter having the main pattern statistically occupies a high operation ratio of the total operation amount of the neural network, the operation efficiency can be improved by performing the preprocessing on the main filter.
The
On the other hand, the filter of the main pattern may also be selected among the plurality of filters generated according to learning by the neural network based on the statistical weight of the operation amount occupied by each pattern for each pattern in which the non-zero elements are arranged. That is, filters having a predetermined number of different main patterns may be selected in order of a high ratio of the operation amount to the total operation amount required to process the input data, and in this case, a specific number of filters having a sum of the operation amounts exceeding a specific ratio may be selected.
For example, in the case of VGG16, which is one type of neural network, assuming that the number of recognition objects is 10, the operation amount required to apply 20 types of filters among the 215 types of filters used in VGG16 to input data accounts for 60% of the total operation amount. In this case, the
That is, although there are several hundreds types of filters used in the neural network, the number of patterns of the operation amount occupying the predetermined threshold ratio may be several tens of types among the several hundreds types of filters. In view of such a tendency, an object of the present disclosure is to reduce the operation amount of the convolution operation of the filter according to the main pattern by storing in advance an operation instruction corresponding to filtering of input data by the applied filter when the filter having the main pattern is applied to the input data.
On the other hand, in the above-described embodiment, although it is assumed that the position of the non-zero element on the two-dimensional plane (x, y) of the filter has a predetermined pattern, the preprocessed object may be extended to a "pattern" unit instead of a "filter" unit. In this case, when a main pattern of a non-element exists in one region of the filter, an operation instruction for the region in which the main pattern exists may be stored in advance. In this case, an embodiment in which an operation is performed by using a pre-stored operation instruction for an area in which a main pattern exists and a filtering operation by conventional convolution is performed for the remaining areas other than the area in which the main pattern exists may also be included in the technical spirit of the present disclosure. In addition, even in the case where a non-element main pattern exists in the depth (z) direction of the filter, an operation instruction for a region where the main pattern exists may be stored in advance.
Fig. 4 shows a structure of optimization data for a filter having a pattern a as one of main patterns.
When input data of a neural network is filtered using a filter having a pattern a as a main pattern (hereinafter, filter a) among the filters 41-1 to 41-n having a plurality of patterns, the filter a applied to the input data may have a data array structure in which non-zero elements and zero elements included in the filter a are arranged in series as shown in (a) of fig. 4.
The optimization data of the filter a proposed in the present disclosure has a structure in which a tag indicating that the applied filter is the pattern a is included in the first field region of the data array and the remaining field region is composed of only non-zero elements of the filter a. Here, the label is used as identification information for identifying the style a. In summary, the optimized data has a structure in which all zero elements are removed from the existing data array structure and only a tag indicating the type of style is added.
Fig. 5 is a block diagram schematically illustrating a configuration of another electronic apparatus according to an embodiment of the present disclosure.
The further
Referring to fig. 5, the second
The
In addition, the second
In addition, the
The
In addition,
The
The
The
On the other hand, when a filter of the main pattern among the plurality of filters is applied to the input data, the
The
In this case, the
Fig. 6 illustrates a machine learning system that receives operational instructions for a primary filter from a first electronic device and performs convolution operations using the operational instructions, according to an embodiment of the disclosure. Fig. 6 illustrates an embodiment in which the first electronic device 100' performing learning through a neural network is implemented as a server and the second
The server 100' is configured to perform preprocessing on the main filter and generate optimized data and operation instructions corresponding to the main filter.
As shown in fig. 6, the server 100' includes a
Referring to fig. 6, the
On the other hand, the first to third optimization data may be data from which zero elements included in the filter are removed. In this case, the first to third optimization data may have a smaller number of occupied bits than the originally learned data. That is, in this case, since the first to third optimization data include only non-zero elements and a tag indicating a type of a pattern of the filter, the number of occupied bits can be saved compared to the original learned data occupying a certain number of bits regardless of the type of the filter. In this case, the number of bits representing the optimized data may be variously determined according to the value of the non-zero element. For example, the non-zero elements at positions "1", "4", and "7" in the first optimization data may be represented by 8 bits, respectively, where 8 bits is an optimal number of bits for representing each non-zero element. On the other hand, the non-zero elements at positions "1" and "9" in the second optimization data may be represented by 16 bits, respectively, where 16 bits is an optimal number of bits for representing each non-zero element.
Meanwhile, the
The
Referring to fig. 6, the
The first to third optimization data stored in the
On the other hand, the
Fig. 7a and 7b are diagrams for describing a method for learning various types of input images and recognizing the input images using the learned data according to an embodiment of the present disclosure.
As shown in fig. 7a, the
In this case, the optimization data regarding the main pattern learning may be stored in the
When the image data is input to the
In this case, as shown in fig. 7a, the
Accordingly, the
Fig. 8 is a flowchart for describing a method for controlling a first electronic device according to an embodiment of the present disclosure.
First, an operation instruction for filtering input data of the neural network is checked for a filter of each main pattern selected from a plurality of filters generated according to learning by the neural network (S810). In this case, the filter of the main pattern may be a filter selected among the plurality of generated filters based on a statistical weight of an operation amount occupied by each pattern for each pattern in which the non-zero elements are arranged. Alternatively, the main pattern may be selected among the generated plurality of filters based on a frequency of each pattern in which non-zero elements are arranged. In this case, the plurality of filters generated by learning may differ according to a learning object of the neural network.
Thereafter, an operation instruction for filtering input data of the neural network for the filter of each selected main pattern is checked (S820). In this case, it is possible to check the optimization data from which zero elements are removed from the filter of the selected main pattern and the operation instruction corresponding to the optimization data.
Thereafter, the checked operation instruction is stored.
In an embodiment, the filtering operation by the filter of the main pattern may be performed according to the stored operation instruction.
Additionally, in another embodiment, the stored operational instructions may be sent to the second electronic device. In this case, the second electronic device may filter the input data of the neural network by using the operation instruction.
As described above, by preprocessing the filter of the main pattern occupying the main operation amount in advance, the burden on the memory is reduced and the operation efficiency is improved.
The learning method by the neural network according to the various embodiments described above may be implemented as a program and stored in various recording media. That is, a computer program that is processed by various processors and that can execute the various display methods described above may also be used in a state stored in a recording medium. As an example, a non-transitory computer-readable medium storing a program may be provided, wherein the program performs an operation of checking an operation instruction for filtering input data of a neural network for a filter of each main pattern selected from a plurality of filters learned through the neural network and an operation of storing the checked operation instruction.
A non-transitory computer readable medium is not a medium that stores data for a short time, such as a register, a cache, a memory, and the like, but refers to a machine readable medium that stores data semi-permanently. In particular, the various applications or programs described above may be stored and provided in a non-transitory computer readable medium, such as a Compact Disc (CD), a Digital Versatile Disc (DVD), a hard disk, a blu-ray disc, a Universal Serial Bus (USB), a memory card, a Read Only Memory (ROM), and the like.
Although embodiments of the present disclosure have been shown and described above, the present disclosure is not limited to the above-described specific embodiments, but various modifications may be made by those skilled in the art to which the present disclosure pertains without departing from the scope and spirit of the present disclosure as claimed in the claims. Such modifications should also be understood as falling within the technical spirit and scope of the present disclosure.