WO2020149511A1 - Electronic device and control method therefor - Google Patents

Electronic device and control method therefor Download PDF

Info

Publication number
WO2020149511A1
WO2020149511A1 PCT/KR2019/016235 KR2019016235W WO2020149511A1 WO 2020149511 A1 WO2020149511 A1 WO 2020149511A1 KR 2019016235 W KR2019016235 W KR 2019016235W WO 2020149511 A1 WO2020149511 A1 WO 2020149511A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
layer
value
electronic device
parameter
Prior art date
Application number
PCT/KR2019/016235
Other languages
French (fr)
Korean (ko)
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
Priority claimed from KR1020190118918A external-priority patent/KR20200089588A/en
Application filed by 삼성전자주식회사 filed Critical 삼성전자주식회사
Priority to US17/286,982 priority Critical patent/US20210383190A1/en
Priority to EP19910158.5A priority patent/EP3852017A4/en
Publication of WO2020149511A1 publication Critical patent/WO2020149511A1/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

Definitions

  • the present disclosure relates to an electronic device and a control method thereof, and more particularly, to an electronic device and a control method thereof, which perform a function of reducing the size of an artificial neural network by adding a layer including a learnable function to the artificial neural network .
  • artificial neural networks are widely used in various fields such as machine translation, speech recognition, and image classification.
  • the size and required computation of artificial neural networks increased exponentially.
  • an on-device platform for example, a smart phone, an Internet of Things (IoT) device, etc.
  • Techniques are being researched and developed to reduce computational accuracy while reducing it.
  • One of the representative technologies is a channel pruning technology that reduces the channel size of an artificial neural network layer.
  • a channel pruning technique was used to calculate the sum of the absolute values of the weights of each channel of a layer included in a convolutional neural network, and sequentially cut the channels with the smallest sum of absolute values.
  • this technique has a limitation in that a case in which a channel having the smallest sum of absolute values of weights is not the least important channel in an artificial neural network may occur.
  • channel pruning technology was used to find the optimal combination by comparing all the channel combinations of the layers of the artificial neural network.
  • this technique has a limitation in that an exponential comparison operation must be performed in order to compare all channels of an artificial neural network layer.
  • the present disclosure has been devised in accordance with the above-described need, and the present disclosure adds a layer including a learnable function to a layer of an artificial neural network, and an electronic device for reducing an existing layer using a learnable function and a learned parameter, and an object thereof In providing a control method.
  • An electronic device for achieving the above object includes a memory storing at least one instruction and a processor connected to the memory to control the electronic device, wherein the processor comprises: By executing the at least one instruction, a second layer including a learnable function is added to a first layer of an artificial neural network including a plurality of layers, and the artificial neural network is trained to perform the second operation. Update a parameter value included in a layer, obtain the function value by inputting the updated parameter value in the learnable function, and at least one of a plurality of channels included in the first layer based on the acquired function value One channel may be removed to update the third layer.
  • the control method of the electronic device is applied to the first layer of the artificial neural network (Neural Network) including a plurality of layers, the second layer including a learnable function (append) Step of learning the artificial neural network, updating the parameter value included in the second layer, entering the updated parameter value in the learnable function to obtain a function value, and obtaining the acquired function value
  • the method may include updating at least one channel among the plurality of channels included in the first layer and updating to a third layer.
  • the electronic device reduces the size of the artificial neural network by performing pruning by adding a layer including a learnable function to the layer of the artificial neural network without comparing all channel combinations, and Accuracy of calculation can be maintained. Accordingly, the user can efficiently utilize the compressed artificial neural network in various fields through an electronic device that performs pruning.
  • 1A is a view for explaining a control method of an electronic device according to an embodiment of the present disclosure
  • 1B is a view for explaining a result obtained when an electronic device performs pruning on an artificial neural network according to an embodiment of the present disclosure
  • FIG. 2A is a block diagram schematically illustrating a configuration of an electronic device according to an embodiment of the present disclosure
  • 2B is a block diagram showing in detail the configuration of an electronic device according to an embodiment of the present disclosure
  • FIG. 3 is a diagram for explaining a method of learning an artificial neural network, according to an embodiment of the present disclosure
  • FIG. 4 is a diagram for describing a learnable function included in a second layer of an electronic device, according to an embodiment of the present disclosure
  • FIG. 5 is a view for explaining an experimental result related to an electronic device, according to an embodiment of the present disclosure.
  • FIG. 6 is a diagram for describing a control method of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 100 may store an artificial neural network including a plurality of layers.
  • Layer may refer to each stage of the artificial neural network.
  • the plurality of layers included in the artificial neural network has a plurality of weight values, and the calculation of the layer may be performed through calculation of a result of the previous layer and a plurality of weights.
  • the artificial neural network may be composed of a combination of several layers, and the layer may be represented by a plurality of weights.
  • a kernel is a set of weights included in one layer.
  • the kernel may be implemented as a multidimensional matrix tensor.
  • a channel may mean the last dimension when the kernel is implemented as a tensor. Therefore, the channel can also match the last dimension of the tensor representing the output value of a particular layer.
  • Examples of artificial neural networks include: Convolutional Neural Network (CNN), Deep Neural Network (DNN), Recurrent Neural Network (RNN), Restricted Boltzmann Machine (RBM), Deep Belief Network (DBN), and Bidirectional Recurrent Deep Neural Network (BRDNN).
  • CNN Convolutional Neural Network
  • DNN Deep Neural Network
  • RNN Recurrent Neural Network
  • RBM Restricted Boltzmann Machine
  • DNN Deep Belief Network
  • BNN Bidirectional Recurrent Deep Neural Network
  • BDN Bidirectional Recurrent Deep Neural Network
  • the electronic device 100 may add a second layer including a learnable function 30 to a first layer among a plurality of layers included in the artificial neural network to compress the artificial neural network. According to an embodiment, the electronic device 100 may add a layer including a learnable function to all layers included in the artificial neural network. As another embodiment, when a first layer is selected from a plurality of layers according to a user command, the electronic device 100 may add a second layer to the selected first layer.
  • the second layer may include a learnable function 30 and parameters W l, 1, W l, 2 ... W l, n 20.
  • the parameters W 1 and i illustrated in FIG. 1A mean parameters for deriving a function value corresponding to the i-th channel of the first layer.
  • the learnable function 30 may be a function having a non-trivial differential value when a parameter 20 defined as a real range is input.
  • the learnable function 30 is a function of adding a second function that is differentiable to a first function that outputs 0 or 1
  • the second function is a function of multiplying the function having a preset gradient and a function that is differentiable.
  • the first function may be a unit step function
  • the second function may be a sawtooth function, but this is only an example, and the second function is implemented as a differential function with a limited range of output values. Can be.
  • the electronic device 100 may input an arbitrary parameter value into the learnable function 30 to obtain 0 or 1 equal to the output value of the first function.
  • the electronic device 100 may obtain a function value 0 by inputting a negative parameter value into the learnable function 30, and inputting a positive parameter value into the learnable function 30 to obtain a function value 1. Can be obtained.
  • this is an embodiment and the electronic device 100 may input negative or positive parameter values into the learnable function 30 to obtain values having a difference within a range of 0 or 1 and a threshold, respectively.
  • the mathematical characteristics and proofs related to the learnable function 30 will be described in detail with reference to FIG. 4 later.
  • the electronic device 100 may learn the artificial neural network to update the parameter 20 included in the second layer. Specifically, the electronic device 100 multiplies the function value obtained when the parameter 20 is input to the learnable function 30 of the second layer and the output data 10 of the first layer to output data of the second layer (40).
  • the electronic device 100 when the function value obtained through the learnable function 30 is 0, the electronic device 100 is configured to correspond to the function value of 0 and the parameter 20 input to the learnable function 30.
  • the channel and the multiplication operation of the output data 10 of one layer can be performed. Accordingly, as illustrated in FIG. 1A, the output data 40 of the second layer is data in which some channels 50-1 and 50-2 of the output data 10 of the first layer are masked to zero.
  • the output data 10 and 40 of each layer may be implemented as a multi-dimensional matrix tensor, but this is only an embodiment and may be implemented in various forms (eg, vectors, etc.).
  • the electronic device 100 generates a loss function for the difference between the output value of the artificial neural network and the output value that the electronic device 100 wants to acquire based on the output data 40 of the second layer, , It is possible to obtain a parameter that outputs the minimum function value (ie, minimum loss value) of the generated loss function.
  • the electronic device 100 may obtain and update the parameter 20 value at which the loss value is minimum by applying a stochastic gradient descent algorithm to the loss function.
  • the stochastic gradient descent algorithm is an algorithm that can obtain a parameter value that can output a minimum function value (loss value) in a loss function.
  • the electronic device 100 may output a minimum function value by applying various algorithms (for example, a momentum algorithm, adagrad algorithm, adam algorithm, etc.) as well as a stochastic gradient descent algorithm to the loss function.
  • the parameter value can be obtained.
  • the electronic device 100 may update the parameter included in the second layer with a parameter that outputs a minimum function value of the loss function.
  • the loss function may be a function of a loss function for maximizing the accuracy of an artificial neural network operation, and an additional loss function indicating the size or computational complexity of a layer to be obtained after compression.
  • the loss function indicating the size of the layer may be calculated as the sum of the output values of the learnable function 30 included in the second layer, and the loss function indicating the computational complexity of the layer is included in the second layer It can be calculated as the product of the sum of the output values of the learned learnable function 30 and the size of the input value of the first layer.
  • the additional loss function may be implemented as a sum of weights of the loss function indicating the size or computational complexity of the layer.
  • the electronic device 100 obtains a function value by inputting the updated parameter 20 into the learnable function 30, and based on the obtained function value, at least one of a plurality of channels included in the first layer
  • the channel may be removed to update the third layer.
  • the electronic device 100 when a function value is obtained by inputting W l,i among the parameters to the learnable function 30, the electronic device 100 according to the acquired function value (0 or 1), the i-th channel of the first layer It can be determined whether or not to remove. If W 1, i of the parameters is input to the learnable function 30 to obtain a function value of 0, the electronic device 100 may remove the i-th channel of the first layer 10.
  • the input of W l,i to the learnable function 30 of the parameter to output 0 may mean that the i-th channel of the first layer is an insignificant channel of the entire calculation of the artificial neural network, and the electronic device 100 Can be removed by Therefore, the overall size and calculation amount of the artificial neural network is reduced, while the accuracy of calculation can be maintained.
  • W 1, i among parameters is input to the learnable function 30 to obtain a function value of 1, the electronic device 100 may maintain the i-th channel of the first layer.
  • the electronic device 100 may remove the second layer and update the third layer from which at least one channel among the plurality of channels included in the first layer is removed based on the function value.
  • the electronic device 100 may first update the first layer to the third layer and then remove the second layer.
  • the electronic device 100 adds a second layer to the first layer to perform pruning, thereby turning the first layer into a third layer with a reduced number of channels. It can be renewed. Specifically, the electronic device 100 may update the first layer to the third layer by removing some of the channels 60-1 and 60-2 included in the first layer based on the function value output from the learnable function. Can.
  • the electronic device 100 obtains a function value by inputting the updated parameter 20 value to the learnable function 30, and the weight of the first kernel based on the obtained function value And may update the first kernel of the first layer to a second kernel including the changed weight.
  • the electronic device 100 may update a parameter by adding a second layer having a learnable parameter 50 corresponding to the number of weights of the kernel of the first layer and learning the artificial neural network. Then, the electronic device 100 may determine whether to change the weight of the first kernel of the first layer to 0 according to the function value obtained by inputting the updated parameter to the learnable function 30. For example, when the first kernel of the first layer is implemented in a 3D 3x3x64 (ie, a 3X3 type filter is implemented in 64 channels) matrix form, the electronic device 100 is included in the first kernel A second layer including a trainable parameter 20 in the form of a matrix of 3x3x64 that can correspond to a weighted one-to-one can be added to the first layer.
  • 3D 3x3x64 ie, a 3X3 type filter is implemented in 64 channels
  • the electronic device 100 may update the parameters by learning the artificial neural network. Then, when the function value obtained by inputting the updated parameter to the learnable function 30 is 0, the electronic device 100 determines the weight of the first kernel of the first layer corresponding to the parameter input to the learnable function. Can be changed to 0. For example, when the parameter when outputting a function value of 0 corresponds to the weight of the (3,3,20) position of the first kernel, the electronic device 100 displays (3,3,20) of the first kernel ) You can change the weight of the position to 0. Then, when the obtained function value is 1, the electronic device 100 may maintain the weight of the first kernel of the first layer corresponding to the parameter input to the learnable function 30. Accordingly, the electronic device 100 may reduce the computation amount of the entire artificial neural network by changing some of the weights of the first kernel of the first layer to 0.
  • the electronic device 100 adds a second layer to the first layer to perform pruning, thereby partially part of the weights included in the first kernel of the first layer.
  • the first kernel can be updated to the second kernel 70 including the changed weight.
  • the electronic device 100 removes some channels of the layer based on the function value obtained by inputting the updated parameter to the learnable function, thereby reducing the weight of the artificial neural network or weighting the individual kernels of the layer to 0.
  • the electronic device 100 removes some channels of the layer based on the function value obtained by inputting the updated parameter to the learnable function, thereby reducing the weight of the artificial neural network or weighting the individual kernels of the layer to 0.
  • the electronic device 100 may remove at least one layer among a plurality of layers included in the artificial neural network based on the function value obtained by inputting the updated parameter 20 into the learnable function 30. have. For example, when the parameter input to the learnable function when the function value of 0 is output corresponds to the first layer, the electronic device 100 may remove the first layer of the artificial neural network. In addition, when the parameter input to the learnable function when the single function value is output corresponds to the first layer, the electronic device 100 may maintain the first layer of the artificial neural network.
  • the electronic device 100 performs pruning by adding a second layer including a learnable function 30 to each layer included in the artificial neural network. Some of the multiple layers can be removed. For example, when the function value obtained through the learnable function 30 is 0 and the parameters input to the learnable function 30 correspond to the first and third layers, the electronic device 100 may first and The artificial neural network can be made lighter by removing the third layer.
  • 2A is a diagram schematically illustrating a configuration of an electronic device 100 according to an embodiment of the present disclosure. As illustrated in FIG. 2A, the electronic device 100 may include a memory 110 and a processor 120. 2A are exemplary diagrams for implementing embodiments of the present disclosure, and appropriate hardware/software configurations of a level apparent to those skilled in the art may be additionally included in the electronic device 100.
  • the memory 110 may store instructions or data related to at least one other component of the electronic device 100.
  • the memory 110- may be implemented as a non-volatile memory, a volatile memory, a flash-memory, a hard disk drive (HDD) or a solid state drive (SSD).
  • the memory 110 is accessed by the processor 120, and data read/write/modify/delete/update may be performed by the processor 120.
  • the term memory is a memory card (not shown) mounted on a memory 110, a ROM (not shown), a RAM (not shown), or an electronic device 100 in a processor 120 (eg, micro SD) Card, memory stick).
  • the memory 110 may store an artificial neural network including a plurality of layers, and may store kernels and parameters included in each layer.
  • the memory 110 may store output data of each layer and output data of the entire artificial neural network.
  • the processor 120 is electrically connected to the memory 110 to control overall operations and functions of the electronic device 100.
  • the processor 120 adds a second layer including a learnable function to a first layer among artificial neural networks including a plurality of layers by executing at least one instruction stored in the memory 110, and artificial A neural network is trained to update parameter values included in the second layer, input updated parameter values to a learnable function to obtain function values, and a plurality of values included in the first layer based on the acquired function values At least one of the channels may be removed to update the third layer.
  • the processor 120 may add a layer including a learnable function to all layers included in the artificial neural network in order to reduce the size of the artificial neural network.
  • the processor 120 may add a learnable function to only the selected layer.
  • the learnable function may be a function of adding a second function that can be differentiated to a first function that outputs 0 or 1, and the second function may be a function of multiplying a function having a preset gradient and a function that can be differentiated.
  • the processor 120 may update the parameter values included in the second layer by learning the artificial neural network. For example, the processor 120 may obtain output data of the second layer by multiplying the function value of the learnable function included in the second layer and the output data of the first layer for each channel. For example, the parameters included in the second layer (W l, 1, W l, 2, ... W l, n) of the case, the processor 120 may learn the available function (W l, 1, W l, 2 ... W l,n ) to obtain the function value, and the obtained function value is the first channel and the second channel of the first layer. The output data of the second layer may be obtained by multiplying the n-th channel.
  • the processor 120 may generate a loss function based on the obtained output data of the second layer. Then, the processor 120 may apply a stochastic gradient descent algorithm to the loss function to obtain a parameter value that minimizes the function value (loss value), and update the existing parameter value with the acquired parameter value.
  • the stochastic gradient descent algorithm is only one embodiment, and the electronic device 100 applies various algorithms (for example, a momentum algorithm, adagrad algorithm, adam algorithm, etc.) to the loss function, and thus a minimum function value. It is possible to obtain a parameter value to have.
  • the processor 120 may obtain the function value by inputting the updated parameter value to the learnable function.
  • the processor 120 may obtain a function value of 0 by inputting a negative parameter value into the learnable function.
  • the processor 120 may obtain a function value of 1 by inputting a positive parameter value into a learnable function.
  • this is an embodiment and the processor 120 may input a negative or positive parameter value into a learnable function to obtain a value having a difference in a threshold range of 0 or 1, respectively.
  • the processor 120 may update the first layer to the third layer by removing at least one channel among the plurality of channels included in the first layer based on the acquired function value. Specifically, when the obtained function value is 0, the processor 120 may remove the kernel of the first layer corresponding to the parameter input to the learnable function. For example, when the input parameter is W l,1 when a function value of 0 is obtained, the processor 120 may delete the first channel of the first layer. In addition, when the inputted parameter is W l,2 when a function value of 1 is obtained, the processor 120 may maintain the second channel of the first layer. Then, the processor 120 may update the first layer to the third layer in which the channel is removed or maintained based on the function value.
  • the processor 120 may remove the second layer and remove at least one channel among a plurality of channels included in the first layer based on the function value to update the third layer, but this is an embodiment. After updating to 3 layers, the second layer can be removed.
  • the processor 120 obtains a function value by inputting an updated parameter value to the learnable function, changes the weight of the first kernel of the first layer based on the obtained function value, and removes the first layer
  • One kernel may be updated with a second kernel including the changed weight.
  • the processor 120 of the first kernel of the first layer corresponding to the parameter input to the learnable function
  • the weight can be changed to zero.
  • the processor 120 may (3,3,20) of the first kernel
  • the processor 120 displays the (3,3,20) position of the first kernel. The weight can be maintained.
  • the processor 120 may be composed of one or a plurality of processors.
  • the one or a plurality of processors 120 is a general-purpose processor such as a central processing unit (CPU), an application processor (AP), a graphics-processing unit (GPU), a graphics-only processor such as a VPU (Visual Processing Unit), or an NPU Neural Processing Unit).
  • One or a plurality of processors are controlled to process input data according to predefined operation rules or artificial intelligence models stored in the memory 110.
  • the predefined motion rules or artificial intelligence models are characterized by being created through learning.
  • learning means that by applying a learning algorithm to a plurality of learning data, a predefined action rule or artificial intelligence model of desired characteristics is created.
  • Such learning may be performed on a device on which artificial intelligence according to the present disclosure is performed, or may be performed through a separate server/system.
  • the learning algorithm is a method of training a predetermined target device (eg, a robot) using a plurality of learning data so that a predetermined target device can make a decision or make a prediction by itself.
  • Examples of learning algorithms include supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning, where learning algorithms in the present disclosure are specified. It is not limited to the above-mentioned example except.
  • 2B is a block diagram illustrating in detail the configuration of the electronic device 100 according to an embodiment of the present disclosure.
  • the electronic device 100 may include a memory 110, a processor 120, an input unit 130, a communication unit 140, a display 150, and an audio output unit 160.
  • the memory 110 and the processor 120 are described in FIG. 2A, redundant description will be omitted.
  • the input unit 130 may receive various user inputs and transmit them to the processor 120.
  • the input unit 130 may include a touch sensor, a (digital) pen sensor, a pressure sensor, a key, or a microphone.
  • the touch sensor for example, at least one of capacitive, pressure-sensitive, infrared, and ultrasonic methods may be used.
  • the (digital) pen sensor may be, for example, a part of the touch panel or may include a separate recognition sheet.
  • a user command for selecting a first layer to reduce the number of channels among a plurality of layers included in the artificial neural network may be received through the input unit 130 and transmitted to the processor 120.
  • the communication unit 140 may communicate with an external device through various communication methods.
  • the communication unit 140 may be connected to an external device through communication with a third device (eg, a repeater, a hub, an access point, a server, or a gateway).
  • a third device eg, a repeater, a hub, an access point, a server, or a gateway.
  • the communication unit 140 may include various communication modules to perform communication with an external device.
  • the communication unit 140 may include a wireless communication module, for example, LTE, LTE-A (LTE Advance), code division multiple access (CDMA), wideband CDMA (WCDMA), universal mobile telecommunications (UMTS) system), WiBro (Wireless Broadband), or GSM (Global System for Mobile Communications).
  • the wireless communication module may include, for example, at least one of WiFi (wireless fidelity), Bluetooth, Bluetooth low power (BLE), and Zigbee.
  • the display 150 may display various information under the control of the processor 120.
  • the display 150 may display an indicator that the first layer has been updated to the third layer under the control of the processor 140.
  • the display 150 may be implemented as a touch screen together with a touch panel. However, it is not limited to the above-described implementation, and the display 150 may be implemented differently according to the type of the electronic device 100.
  • the audio output unit 160 is a component that outputs various notification sounds or voice messages as well as various audio data performed by various processing operations such as decoding, amplification, and noise filtering by the audio processing unit (not shown). As an embodiment, the audio output unit 160 may output a notification sound that the first layer has been updated to the third layer.
  • the audio output unit 160 may be implemented as a speaker 160, but this is only an example, and may be implemented as another output terminal capable of outputting audio data.
  • FIG 3 is a diagram for explaining a method of learning an artificial neural network including a plurality of layers stored in the electronic device 100 according to an embodiment of the present disclosure.
  • the electronic device 100 may acquire the output data 330 by inputting the input data 310 to the first layer 320.
  • the input data 310 may be video data or audio data, but is not limited thereto.
  • the output data 330 may be a feature map obtained by performing a synthesis convolution operation between the kernel of the first layer 320 and the input data 310.
  • the input data 310 and the output data 330 illustrated in FIG. 3 may be implemented as a multi-dimensional matrix tensor, but this is only an embodiment and may be implemented in various forms (for example, vectors). have.
  • the electronic device 100 may obtain the masked output data 340 by multiplying the function value obtained by inputting the learnable parameter 370 into the learnable function 380 and the output data 330 for each channel. For example, when the parameter W 1,i of the function value to be multiplied by the i th eclectic data is negative, the electronic device 100 obtains a function value of 0 by inputting a negative parameter value to the learnable function, , The obtained zero function value can be multiplied with the i-th output data.
  • the electronic device 100 When the parameter W 1, i of the function value to be multiplied by the i-th output data is positive, the electronic device 100 obtains a function value of 1 by inputting a parameter value that is a positive value to the learnable function, and the acquired 1-function The value can be multiplied by the i-th output data. Accordingly, the electronic device 100 may obtain the masked output tensor 340 by multiplying the function value 0 or 1 for each channel of the output data 330. Meanwhile, the learnable function 380 and the learnable parameter 370 may be included in the second layer added to the first layer.
  • the learnable function 380 is a function of adding a second function that can be differentiated to a first function that outputs a discretization value, such as outputting 0 or 1 or outputting -1 or 1, and the second function is differentiation. It may be a function multiplied by a function having a predetermined gradient and a possible function.
  • the electronic device 100 obtains a loss function based on the masked output data 340 and applies a stochastic gradient descent algorithm to the loss function to minimize the function value (loss value).
  • the parameters can be obtained. Since a method of obtaining a parameter having a minimum function value in a loss function through a probabilistic gradient descent algorithm is a known technique, a detailed method will be omitted. Then, the electronic device 100 may update the existing parameter with the newly acquired parameter (360).
  • the electronic device 100 acquires output data by inputting input data to the first layer, and acquires updated data by obtaining the learnable function included in the second layer 370 ) To obtain the masked output data by multiplying the output data obtained by inputting the function value for each channel. Thereafter, a loss function may be obtained based on the output data masked as described above, and a parameter value that minimizes the loss function value may be obtained by applying a stochastic gradient descent algorithm to the loss function. Then, the electronic device 100 may update the existing parameters with the acquired parameters. That is, the electronic device 100 may learn an artificial neural network and update parameter values as illustrated in FIG. 3.
  • FIG. 4 is a diagram for describing a learnable function included in a second layer of an electronic device according to an embodiment of the present disclosure.
  • the learnable function 450 included in the second layer is a function of adding a second function 420 that can be differentiated to a first function 410 that outputs 0 or 1.
  • the first function 410 may be a unit staircase function that outputs 0 when a negative parameter value is input and 1 when a positive parameter value is input.
  • this is only an example, and the first function 410 may be implemented as another function that outputs 0 or 1.
  • the electronic device 100 loses a stochastic gradient descent algorithm utilizing the differential function. It cannot be applied to train parameters. Accordingly, a second function 420 that can be differentiated can be added to the unit step function.
  • the second function 420 may be a function of multiplying the derivative function 430 and a function (or derivative shape) 440 having a predetermined slope.
  • the derivable function 430 may be implemented as a function having a limited amount of derivative values in a range of output values, and may include a sawtooth function as an example.
  • the second function 430 which is a differential function that the differential function 430 is implemented as a sawtooth function, is expressed by Equation (1).
  • Equation 1 is a predetermined positive integer, and the slope value for any w (parameter) in Equation 1 is 1.
  • the learnable function 450 when the value of M exceeds a threshold value (for example, 10 ⁇ 5) when the learnable function 450 is implemented as in Equation 2, the learnable function 450 is an arbitrary w (parameter). With respect to, a function value that is the same as the first function or an error within the threshold range can be output. In addition, the learnable function may output a slope value in which an error occurs within the same or threshold range as the function 440 having a predetermined slope.
  • a threshold value for example, 10 ⁇ 5
  • the learnable function 450 is an arbitrary w (parameter).
  • a function value that is the same as the first function or an error within the threshold range can be output.
  • the learnable function may output a slope value in which an error occurs within the same or threshold range as the function 440 having a predetermined slope.
  • the learnable function 450 can output a function value equal to or equal to the first function for any w (parameter) or within a threshold range. Equation 3.
  • the learnable function 450 outputs a slope value that is equal to a function having a predetermined slope for any w (parameter) or an error within a threshold range. Equation 4.
  • the learnable function 450 is the same as the first function for any w (parameter) or an error within a threshold range occurs
  • the function value may be output, and a slope value in which an error in the same or threshold range as the function 440 having a predetermined slope occurs. Therefore, when a negative or positive parameter is input to the learnable function 450, the electronic device 100 outputs a function value of 0 or 1, respectively, or a function value in which an error occurs within a range of 0 or 1 and a threshold value.
  • the differential value of the learnable function 450 is not 0, it is possible to update the parameter value included in the second layer by learning by applying a stochastic gradient descent method to the artificial neural network.
  • FIG. 5 is a view for explaining an experimental result related to the electronic device 100 according to an embodiment of the present disclosure.
  • FIG. 5 is a diagram for comparing an experiment result (compression rate and accuracy of calculation after compression) of a method different from the method in which the electronic device 100 compresses the first layer in the present disclosure.
  • the compression rate FLOPs (Floating Point Operations)
  • FLOPs Floating Point Operations
  • the method (a) is a method of compressing the artificial neural network by acquiring the sum of the absolute values of weights for each channel of the kernel of the layer included in the artificial neural network, and removing the kernel of the channel having the smallest sum of absolute values.
  • the method (B) is a method of compressing an artificial neural network by multiplying each channel of a layer by a learned weight having a real value between 0 and 1, and removing a channel having a small value.
  • (C) is a method of compressing an artificial neural network using the above-described control method of the electronic device 100.
  • the compression ratio of the artificial neural network in (A) is 1.21 times, but in the case of (C), the compression is twice.
  • the compression ratio of the artificial neural network in the (B) method is doubled.
  • the accuracy of calculation after artificial neural network compression decreased by 1%, but in the case of (C) method, it decreased by 0.46%. That is, it can be seen from the experimental results of FIG. 5(a) that the (c) method has a higher compression rate and a calculation accuracy after compression of the artificial neural network than the (a) and (b) methods, respectively.
  • FIG. 6 is a flowchart illustrating a control method of the electronic device 100 according to an embodiment of the present disclosure.
  • the electronic device 100 may connect a second layer including a learnable function to a first layer of an artificial neural network including a plurality of layers (S610).
  • the electronic device 100 may connect layers including learnable functions to all layers included in the artificial neural network, respectively.
  • the electronic device 100 may connect a layer including a learnable function to the selected layer.
  • the learnable function is a function of adding a second function that can be differentiated to a first function that outputs 0 or 1
  • the second function is a function of multiplying a function having a preset gradient and a function that can be differentiated. Since the mathematical properties of the function have been described with reference to FIG. 4, redundant description will be omitted.
  • the electronic device 100 may learn the artificial neural network and update the parameter values included in the second layer (S620). Specifically, the electronic device 100 obtains the output data of the second layer by multiplying the output data of the first layer by the function value for each channel, and generates and generates a loss function based on the obtained output data of the second layer. A parameter that outputs the minimum function value of the lost function can be obtained. For example, the electronic device 100 may obtain a parameter outputting the minimum function value of the loss function by applying a stochastic gradient descent method to the loss function, and update the existing parameter with the acquired parameter.
  • the electronic device 100 may obtain the function value by inputting the updated parameter value to the learnable function (S630). Then, the electronic device 100 may update at the third layer by removing at least one channel among the plurality of channels included in the first layer based on the obtained function value (S640).
  • the electronic device 100 may obtain a function value 0 by inputting a negative parameter value into the learnable function, and remove the kernel of the first layer corresponding to the parameter. have. For example, when the negative parameter input to the learnable function is W 1,i , the electronic device 100 may acquire the function value 0 and remove the i-th channel of the first layer. If the positive parameter input to the learnable function is W 1,i , the electronic device 100 may acquire the function value 1 and maintain the i-th channel of the first layer.
  • the electronic device 100 removes the second layer added to the first layer, and removes at least one channel among the plurality of channels included in the first layer based on the function value, thereby removing the channel layer from the first layer.
  • a third layer can be obtained.
  • the second layer may be removed after updating the first layer to the third layer.
  • expressions such as “have,” “can have,” “includes,” or “can include,” include the presence of a corresponding feature (eg, a component such as a numerical value, function, operation, or part). And does not exclude the presence of additional features.
  • expressions such as “A or B,” “at least one of A or/and B,” or “one or more of A or/and B”, etc. may include all possible combinations of the items listed together.
  • Some component eg, first component
  • another component eg, second component
  • “connected to” it should be understood that any of the above components may be directly connected to the other component or may be connected through another component (eg, a third component).
  • a component eg, the first component
  • the component and the component It can be understood that there are no other components (eg, the third component) between the other components.
  • the expression “configured to” as used in the present disclosure may have, depending on the situation, for example, “having the capacity to” ,” “designed to,” “adapted to,” “made to,” or “capable of” can be used interchangeably.
  • the term “configured (or set) to” may not necessarily mean only “specifically designed to” in hardware. Instead, in some situations, the expression “device configured to” may mean that the device “can” with other devices or parts.
  • the phrase “subprocessor configured (or set) to perform A, B, and C” executes a dedicated processor (eg, an embedded processor) to perform the operation, or one or more software programs stored in the memory device. By doing so, it may mean a general-purpose processor (eg, a CPU or application processor) capable of performing the corresponding operations.
  • An electronic device may include, for example, at least one of a smart phone, a tablet PC, a desktop PC, a laptop PC, a netbook computer, a server, a PDA, a medical device, or a wearable device.
  • the electronic device may include at least one of a television, a refrigerator, an air conditioner, an air purifier, a set top box, a media box (eg, Samsung HomeSyncTM, Apple TVTM, or Google TVTM).
  • the term user may refer to a person using an electronic device or a device using an electronic device (eg, an artificial intelligence electronic device).
  • an electronic device eg, an artificial intelligence electronic device
  • Various embodiments of the present disclosure may be implemented with software including instructions stored in a machine (eg, computer) readable storage media.
  • a device that can be called and operated according to the called command, it may include an electronic device (eg, the electronic device 100) according to the disclosed embodiments.
  • the processor When the command is executed by a processor, the processor may directly or Under the control of the processor, other components may be used to perform functions corresponding to the command, which may include code generated or executed by a compiler or interpreter. It can be provided in the form of a non-transitory storage medium, where'non-transitory' means that the storage medium does not contain a signal and is tangible, but the data is semi-permanent. Or, it does not distinguish between temporary storage.
  • a method according to various embodiments disclosed in the present disclosure may be provided as being included in a computer program product.
  • Computer program products can be traded between sellers and buyers as products.
  • the computer program product may be distributed online in the form of a device-readable storage medium (eg compact disc read only memory (CD-ROM)) or through an application store (eg Play StoreTM).
  • a storage medium such as a memory of a manufacturer's server, an application store's server, or a relay server, or may be temporarily generated.
  • Each component may be composed of a singular or a plurality of entities, and some of the aforementioned sub-components may be omitted, or other sub-components may be various. It may be further included in the embodiment. Alternatively or additionally, some components (eg, modules or programs) can be integrated into one entity, performing the same or similar functions performed by each corresponding component before being integrated. According to various embodiments, operations performed by a module, program, or other component may be sequentially, parallelly, repeatedly, or heuristically executed, at least some operations may be executed in a different order, omitted, or other operations may be added. Can.

Abstract

An electronic device and a control method therefor are provided. The electronic device may comprise: a memory for storing at least one instruction; and a processor connected to the memory so as to control the electronic device, wherein the processor: by executing the at least one instruction, appends a second layer including a learnable function to a first layer in an artificial neural network including a plurality of layers; updates a parameter value included in the second layer by learning of the artificial neural network; acquires a function value by inputting the updated parameter value to the learnable function; and eliminates at least one channel among a plurality of channels included in the first layer on the basis of the acquired function value so as to achieve update to a third layer.

Description

전자 장치 및 이의 제어 방법Electronic device and control method therefor
본 개시는 전자 장치 및 이의 제어 방법에 관한 것으로서, 더욱 상세하게는 인공 신경망에 학습 가능한 함수를 포함하는 레이어를 부가하여 인공 신경망의 크기를 감소하는 기능을 수행하는 전자 장치 및 이의 제어 방법에 관한 것이다.The present disclosure relates to an electronic device and a control method thereof, and more particularly, to an electronic device and a control method thereof, which perform a function of reducing the size of an artificial neural network by adding a layer including a learnable function to the artificial neural network .
최근 인공 신경망은 기계 번역, 음성 인식, 영상 분류 등 다양한 분야에서 폭넓게 활용되고 있다. 인공 신경망의 활용 폭이 점차 넓어지고 정밀한 계산을 요구하게 되자, 인공 신경망의 크기 및 필요 계산량은 기하 급수적으로 증가하게 되었다. 온 디바이스 플랫폼(On-Device Platform)(예를 들어, 스마트 폰, IoT(Internet of Things) 장치 등)상에 큰 사이즈의 인공 신경망 모델을 저장하는데 한계가 있는 바, 인공 신경망의 크기 및 계산 량을 감소시키면서 계산의 정확도는 유지하는 기술이 연구 및 개발되고 있다. 대표적인 기술 중 하나는 인공 신경망의 레이어의 채널 크기를 줄이는 채널 프루닝(Channel Pruning) 기술이다.Recently, artificial neural networks are widely used in various fields such as machine translation, speech recognition, and image classification. As the use of artificial neural networks gradually widened and demanded precise calculation, the size and required computation of artificial neural networks increased exponentially. There is a limitation in storing a large-sized artificial neural network model on an on-device platform (for example, a smart phone, an Internet of Things (IoT) device, etc.). Techniques are being researched and developed to reduce computational accuracy while reducing it. One of the representative technologies is a channel pruning technology that reduces the channel size of an artificial neural network layer.
기존에는, 합성곱 인공 신경망(Convolutional Neural Network)에 포함된 레이어의 각 채널의 가중치의 절대값 합을 계산하고, 절대값의 합이 작은 채널부터 순차적으로 잘라내는 채널 프루닝 기술이 활용되었다. 다만, 해당 기술은 가중치의 절대값의 합이 가장 작은 채널이 인공 신경망에서 가장 중요하지 않은 채널이 아닌 경우가 발생할 수 있다는 한계가 존재하였다.Previously, a channel pruning technique was used to calculate the sum of the absolute values of the weights of each channel of a layer included in a convolutional neural network, and sequentially cut the channels with the smallest sum of absolute values. However, this technique has a limitation in that a case in which a channel having the smallest sum of absolute values of weights is not the least important channel in an artificial neural network may occur.
또한, 기존에는 인공 신경망의 레이어의 채널 조합을 모두 비교해서 최적의 조합을 찾는 채널 프루닝 기술이 활용되었다. 다만, 해당 기술은 인공 신경망의 레이어의 모든 채널을 비교하려면 기하급수적인 비교 연산이 수행되어야 한다는 한계가 존재하였다.In addition, in the past, channel pruning technology was used to find the optimal combination by comparing all the channel combinations of the layers of the artificial neural network. However, this technique has a limitation in that an exponential comparison operation must be performed in order to compare all channels of an artificial neural network layer.
또한, 기존에는 레이어의 각 채널에 0과 1사이의 실수 값을 가지는 학습된 가중치를 곱하고, 작은 값을 가지는 채널을 제거하는 소프트 게이팅(Soft Gating) 기술이 활용되었다. 다만, 해당 기술의 경우 가중치가 0과 1사이의 중간값을 가지고 있어 가중치 학습이 완전하지 않으므로 가중치에 정규화(Regularization) 또는 어닐링(Annealing) 알고리즘을 추가 적용해야 한다는 한계가 존재하였다.In addition, conventionally, a soft gating technique has been used in which each channel of a layer is multiplied by a learned weight having a real value between 0 and 1, and a channel having a small value is removed. However, in the case of the corresponding technique, since the weight has an intermediate value between 0 and 1, weight learning is not complete, there is a limitation that a regularization or annealing algorithm must be additionally applied to the weight.
또한, 기존에는 각 채널이 제거될 지에 대한 확률 분포 파라미터를 학습하는 Variational Method 기술이 활용되었으나, 채널이 제거될지 여부가 확률에 의존하므로 반복적으로 마스크를 샘플링해야 한다는 한계가 존재하였다.In addition, in the past, the Variational Method technique for learning the probability distribution parameter of whether each channel is to be removed has been utilized, but there is a limitation that the mask needs to be repeatedly sampled because the channel depends on the probability.
본 개시는 상술한 필요성에 따라 안출된 것으로서, 본 개시는 인공 신경망의 레이어에 학습 가능한 함수를 포함하는 레이어를 부가하고, 학습 가능한 함수 및 학습된 파라미터를 이용하여 기존 레이어를 경량화하는 전자 장치 및 이의 제어 방법을 제공함에 있다.The present disclosure has been devised in accordance with the above-described need, and the present disclosure adds a layer including a learnable function to a layer of an artificial neural network, and an electronic device for reducing an existing layer using a learnable function and a learned parameter, and an object thereof In providing a control method.
상술한 목적을 달성하기 위한 본 개시의 일 실시 예에 따른 전자 장치는 적어도 하나의 인스트럭션(instruction)을 저장하는 메모리 및 상기 메모리와 연결되어 상기 전자 장치를 제어하는 프로세서를 포함하고, 상기 프로세서는, 상기 적어도 하나의 인스트럭션을 실행함으로써 복수의 레이어를 포함하는 인공 신경망(Neural Network) 중 제1 레이어에 학습 가능한 함수를 포함하는 제2 레이어를 부가(append)하고, 상기 인공 신경망을 학습시켜 상기 제2 레이어에 포함되어 있는 파라미터 값을 갱신하고, 상기 학습 가능한 함수에 상기 갱신된 파라미터 값을 입력하여 함수 값을 획득하고, 상기 획득한 함수 값을 바탕으로 상기 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신할 수 있다.An electronic device according to an embodiment of the present disclosure for achieving the above object includes a memory storing at least one instruction and a processor connected to the memory to control the electronic device, wherein the processor comprises: By executing the at least one instruction, a second layer including a learnable function is added to a first layer of an artificial neural network including a plurality of layers, and the artificial neural network is trained to perform the second operation. Update a parameter value included in a layer, obtain the function value by inputting the updated parameter value in the learnable function, and at least one of a plurality of channels included in the first layer based on the acquired function value One channel may be removed to update the third layer.
한편, 상술한 목적을 달성하기 위한 실시 예에 따른 전자 장치의 제어 방법은 복수의 레이어를 포함하는 인공 신경망(Neural Network) 중 제1 레이어에 학습 가능한 함수를 포함하는 제2 레이어를 부가(append)하는 단계, 상기 인공 신경망을 학습시켜 상기 제2 레이어에 포함되어 있는 파라미터 값을 갱신하는 단계, 상기 학습 가능한 함수에 상기 갱신된 파라미터 값을 입력하여 함수 값을 획득하는 단계 및 상기 획득한 함수 값을 바탕으로 상기 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신하는 단계를 포함할 수 있다.On the other hand, the control method of the electronic device according to an embodiment for achieving the above object is applied to the first layer of the artificial neural network (Neural Network) including a plurality of layers, the second layer including a learnable function (append) Step of learning the artificial neural network, updating the parameter value included in the second layer, entering the updated parameter value in the learnable function to obtain a function value, and obtaining the acquired function value The method may include updating at least one channel among the plurality of channels included in the first layer and updating to a third layer.
상술한 바와 같이 본 개시의 다양한 실시 예에 의해, 전자 장치는 모든 채널의 조합을 비교하지 않고도 학습 가능한 함수를 포함하는 레이어를 인공 신경망의 레이어에 부가하여 프루닝을 수행함으로써 인공 신경망의 크기 감소 및 계산의 정확도를 유지할 수 있다. 따라서, 사용자는 프루닝을 수행하는 전자 장치를 통해 압축된 인공 신경망을 다양한 분야에서 효율적으로 활용할 수 있다.As described above, according to various embodiments of the present disclosure, the electronic device reduces the size of the artificial neural network by performing pruning by adding a layer including a learnable function to the layer of the artificial neural network without comparing all channel combinations, and Accuracy of calculation can be maintained. Accordingly, the user can efficiently utilize the compressed artificial neural network in various fields through an electronic device that performs pruning.
도 1a는 본 개시의 일 실시 예에 따른, 전자 장치의 제어 방법을 설명하기 위한 도면,1A is a view for explaining a control method of an electronic device according to an embodiment of the present disclosure;
도 1b는 본 개시의 일 실시 예에 다른, 전자 장치가 인공 신경망에 프루닝을 수행하였을 때 획득한 결과를 설명하기 위한 도면,1B is a view for explaining a result obtained when an electronic device performs pruning on an artificial neural network according to an embodiment of the present disclosure;
도 2a는 본 개시의 일 실시 예에 따른, 전자 장치의 구성을 간략히 도시한 블록도,2A is a block diagram schematically illustrating a configuration of an electronic device according to an embodiment of the present disclosure;
도 2b는 본 개시의 일 실시 예에 따른, 전자 장치의 구성을 상세히 도시한 블록도,2B is a block diagram showing in detail the configuration of an electronic device according to an embodiment of the present disclosure;
도 3은 본 개시의 일 실시 예에 따른, 인공 신경망의 학습 방법을 설명하기 위한 도면,3 is a diagram for explaining a method of learning an artificial neural network, according to an embodiment of the present disclosure;
도 4는 본 개시의 일 실시 예에 따른, 전자 장치의 제2 레이어에 포함된 학습 가능한 함수를 설명하기 위한 도면,4 is a diagram for describing a learnable function included in a second layer of an electronic device, according to an embodiment of the present disclosure;
도 5는 본 개시의 일 실시 예에 따른, 전자 장치와 관련된 실험 결과를 설명하기 위한 도면,5 is a view for explaining an experimental result related to an electronic device, according to an embodiment of the present disclosure;
도 6은 본 개시의 일 실시 예에 따른, 전자 장치의 제어 방법을 설명하기 위한 도면이다.6 is a diagram for describing a control method of an electronic device according to an embodiment of the present disclosure.
이하에서는 도면을 참조하여 본 개시의 다양한 실시 예에 대해 설명하기로 한다.Hereinafter, various embodiments of the present disclosure will be described with reference to the drawings.
도 1a은 본 개시의 일 실시 예에 따른 전자 장치(100)의 제어 방법을 설명하기 위한 도면이다. 도 1a에 도시된 바와 같이 전자 장치(100)는 복수의 레이어를 포함하는 인공 신경망을 저장할 수 있다. 레이어는 인공 신경망의 각 단계를 의미할 수 있다. 인공 신경망에 포함된 복수의 레이어는 복수의 가중치(weight values)을 갖고 있으며, 이전(previous) 레이어의 연산 결과와 복수의 가중치의 연산을 통해 레이어의 연산을 수행할 수 있다. 구체적으로, 인공 신경망은 여러 개의 레이어의 조합으로 구성될 수 있으며, 레이어는 복수개의 가중치로 표현될 수 있다.. 그리고, 커널(kernel)은 하나의 레이어에 포함된 가중치의 집합이다. 일 실시 예로, 커널은 다차원 행렬인 텐서(tensor)로 구현될 수 있다. 그리고, 채널(channel)은 커널이 텐서로 구현되었을 때 마지막 차원을 의미할 수 있다. 따라서, 채널은 특정 레이어의 출력값을 나타내는 텐서의 마지막 차원과도 일치할 수 있다. 1A is a diagram illustrating a control method of an electronic device 100 according to an embodiment of the present disclosure. As illustrated in FIG. 1A, the electronic device 100 may store an artificial neural network including a plurality of layers. Layer may refer to each stage of the artificial neural network. The plurality of layers included in the artificial neural network has a plurality of weight values, and the calculation of the layer may be performed through calculation of a result of the previous layer and a plurality of weights. Specifically, the artificial neural network may be composed of a combination of several layers, and the layer may be represented by a plurality of weights. And, a kernel is a set of weights included in one layer. In one embodiment, the kernel may be implemented as a multidimensional matrix tensor. Also, a channel may mean the last dimension when the kernel is implemented as a tensor. Therefore, the channel can also match the last dimension of the tensor representing the output value of a particular layer.
그리고, 인공 신경망의 예로는, CNN (Convolutional Neural Network), DNN (Deep Neural Network), RNN (Recurrent Neural Network), RBM (Restricted Boltzmann Machine), DBN (Deep Belief Network), BRDNN(Bidirectional Recurrent Deep Neural Network) 및 심층 Q-네트워크 (Deep Q-Networks)이 있으며, 본 개시에서의 신경망은 명시한 경우를 제외하고 전술한 예에 한정되지 않는다. In addition, examples of artificial neural networks include: Convolutional Neural Network (CNN), Deep Neural Network (DNN), Recurrent Neural Network (RNN), Restricted Boltzmann Machine (RBM), Deep Belief Network (DBN), and Bidirectional Recurrent Deep Neural Network (BRDNN). ) And Deep Q-Networks, and the neural network in the present disclosure is not limited to the above-mentioned examples except for the case where specified.
전자 장치(100)는 인공 신경망을 압축하기 위하여 인공 신경망에 포함된 복수의 레이어 중 제1 레이어에 학습 가능한 함수(30)를 포함하는 제2 레이어를 부가할 수 있다. 일 실시 예에 따른, 전자 장치(100)는 인공 신경망에 포함된 모든 레이어에 학습 가능한 함수를 포함하는 레이어를 부가할 수 있다. 또 다른 실시 예로, 사용자 명령에 따라 복수의 레이어 중 제1 레이어가 선택되면, 전자 장치(100)는 선택된 제1 레이어에 제2 레이어를 부가할 수 있다.The electronic device 100 may add a second layer including a learnable function 30 to a first layer among a plurality of layers included in the artificial neural network to compress the artificial neural network. According to an embodiment, the electronic device 100 may add a layer including a learnable function to all layers included in the artificial neural network. As another embodiment, when a first layer is selected from a plurality of layers according to a user command, the electronic device 100 may add a second layer to the selected first layer.
한편, 제2 레이어는 학습 가능한 함수(30) 및 파라미터(Wl,1, Wl,2 … Wl,n)(20)를 포함할 수 있다. 도 1a에 도시된 파라미터 Wl,i는 제1 레이어의 i 번째 채널에 대응되는 함수 값을 도출하는 파라미터를 의미한다. 학습 가능한 함수(30)는 실수 범위로 정의된 파라미터(20) 값이 입력될 때 비 자명한(non-trivial) 미분 값을 가지는 함수 일 수 있다. 구체적으로, 학습 가능한 함수(30)는 0 또는 1을 출력하는 제1 함수에 미분 가능한 제2 함수를 더한 함수이고, 제2 함수는 미분 가능한 함수와 기설정된 기울기(gradient)를 가지는 함수를 곱한 함수일 수 있다. 제1 함수는 단위 계단 함수(Unit Step Function) 일 수 있으며 제2 함수는 톱니파 함수(Sawtooth Function)일 수 있으나 이는 일 실시 예에 불과하며 제2 함수는 출력 값의 범위가 한정된 미분 가능한 함수로 구현될 수 있다.Meanwhile, the second layer may include a learnable function 30 and parameters W l, 1, W l, 2 … W l, n 20. The parameters W 1 and i illustrated in FIG. 1A mean parameters for deriving a function value corresponding to the i-th channel of the first layer. The learnable function 30 may be a function having a non-trivial differential value when a parameter 20 defined as a real range is input. Specifically, the learnable function 30 is a function of adding a second function that is differentiable to a first function that outputs 0 or 1, and the second function is a function of multiplying the function having a preset gradient and a function that is differentiable. Can be. The first function may be a unit step function, and the second function may be a sawtooth function, but this is only an example, and the second function is implemented as a differential function with a limited range of output values. Can be.
그리고, 전자 장치(100)는 임의의 파라미터 값을 학습 가능한 함수(30)에 입력하여 제1 함수의 출력 값과 동일한 0 또는 1을 획득할 수 있다. 일 실시 예로, 전자 장치(100)는 음수의 파라미터 값을 학습 가능한 함수(30)에 입력하여 함수 값 0을 획득할 수 있으며, 양수의 파라미터 값을 학습 가능한 함수(30)에 입력하여 함수 값 1을 획득할 수 있다. 다만, 이는 일 실시 예이며 전자 장치(100)는 음수 또는 양수 파라미터 값을 학습 가능한 함수(30)에 입력하여 각각 0 또는 1과 임계값 범위 내의 차이가 있는 값을 획득할 수 있다. 학습 가능한 함수(30)와 관련된 수학적 특성 및 증명은 추후 도 4를 참조하며 구체적으로 설명하도록 한다.Then, the electronic device 100 may input an arbitrary parameter value into the learnable function 30 to obtain 0 or 1 equal to the output value of the first function. In one embodiment, the electronic device 100 may obtain a function value 0 by inputting a negative parameter value into the learnable function 30, and inputting a positive parameter value into the learnable function 30 to obtain a function value 1. Can be obtained. However, this is an embodiment and the electronic device 100 may input negative or positive parameter values into the learnable function 30 to obtain values having a difference within a range of 0 or 1 and a threshold, respectively. The mathematical characteristics and proofs related to the learnable function 30 will be described in detail with reference to FIG. 4 later.
한편, 전자 장치(100)는 인공 신경망을 학습시켜 제2 레이어에 포함된 파라미터(20)를 갱신시킬 수 있다. 구체적으로, 전자 장치(100)는 제2 레이어의 학습 가능한 함수(30)에 파라미터(20)를 입력했을 때 획득한 함수 값과 제1 레이어의 출력 데이터(10) 와 곱하여 제2 레이어의 출력 데이터(40)를 획득할 수 있다. Meanwhile, the electronic device 100 may learn the artificial neural network to update the parameter 20 included in the second layer. Specifically, the electronic device 100 multiplies the function value obtained when the parameter 20 is input to the learnable function 30 of the second layer and the output data 10 of the first layer to output data of the second layer (40).
일 실시예로, 학습 가능한 함수(30)를 통해 획득한 함수 값이 0인 경우, 전자 장치(100)는 0인 함수 값과 학습 가능한 함수(30)에 입력된 파라미터(20)에 대응되는 제1 레이어의 출력 데이터(10)의 채널과 곱 연산을 수행할 수 있다. 따라서, 도 1a에 도시된 바와 같이, 제2 레이어의 출력 데이터(40)는 제1 레이어의 출력 데이터(10) 중 일부 채널(50-1, 50-2)이 0으로 마스킹(masking)된 데이터일 수 있다.In one embodiment, when the function value obtained through the learnable function 30 is 0, the electronic device 100 is configured to correspond to the function value of 0 and the parameter 20 input to the learnable function 30. The channel and the multiplication operation of the output data 10 of one layer can be performed. Accordingly, as illustrated in FIG. 1A, the output data 40 of the second layer is data in which some channels 50-1 and 50-2 of the output data 10 of the first layer are masked to zero. Can be
한편, 각 레이어의 출력 데이터(10,40)는 다차원 매트릭스 형태의 텐서로 구현될 수 있으나 이는 일 실시예에 불과하며 다양한 형태(예를 들어, 벡터 등)로 구현될 수 있다.Meanwhile, the output data 10 and 40 of each layer may be implemented as a multi-dimensional matrix tensor, but this is only an embodiment and may be implemented in various forms (eg, vectors, etc.).
그리고, 전자 장치(100)는 제2 레이어의 출력 데이터(40)를 바탕으로 인공 신경망의 출력 값과 전자 장치(100)가 획득하고자 하는 출력 값의 차이에 대한 손실 함수(loss function)를 생성하고, 생성한 손실 함수의 최소 함수 값(즉, 최소 손실 값)을 출력하는 파라미터를 획득할 수 있다. 일 실시 예로, 전자 장치(100)는 손실 함수에 확률적 경사 하강법 알고리즘을 적용하여 손실 값이 최소가 되는 파라미터(20) 값을 획득하여 갱신할 수 있다. 확률적 경사 하강법 알고리즘은 손실 함수에서 최소 함수 값(손실 값)을 출력할 수 있는 파라미터 값을 획득할 수 있는 알고리즘이다. 다만, 전자 장치(100)는 확률적 경사 하강법 알고리즘뿐만 아니라 다양한 알고리즘(예를 들어, 모멘텀(Momentum) 알고리즘, adagrad 알고리즘, adam 알고리즘 등)을 손실 함수에 적용하여 최소 함수 값을 출력할 수 있는 파라미터 값을 획득할 수 있다. 그리고, 전자 장치(100)는 제2 레이어에 포함되어 있는 파라미터를 손실 함수의 최소 함수 값을 출력하는 파라미터로 갱신할 수 있다.Then, the electronic device 100 generates a loss function for the difference between the output value of the artificial neural network and the output value that the electronic device 100 wants to acquire based on the output data 40 of the second layer, , It is possible to obtain a parameter that outputs the minimum function value (ie, minimum loss value) of the generated loss function. In one embodiment, the electronic device 100 may obtain and update the parameter 20 value at which the loss value is minimum by applying a stochastic gradient descent algorithm to the loss function. The stochastic gradient descent algorithm is an algorithm that can obtain a parameter value that can output a minimum function value (loss value) in a loss function. However, the electronic device 100 may output a minimum function value by applying various algorithms (for example, a momentum algorithm, adagrad algorithm, adam algorithm, etc.) as well as a stochastic gradient descent algorithm to the loss function. The parameter value can be obtained. Then, the electronic device 100 may update the parameter included in the second layer with a parameter that outputs a minimum function value of the loss function.
한편, 손실 함수(loss function)는 인공 신경망 연산의 정확도를 최대화 하기 위한 손실 함수에 압축 후에 얻게 될 레이어의 크기 혹은 연산 복잡도를 나타내는 추가적인 손실 함수를 더한 함수 일 수 있다. 일 실시 예로, 레이어의 크기를 나타내는 손실 함수는 제 2레이어에 포함되어 있는 학습 가능한 함수(30)의 출력 값의 합으로 계산될 수 있으며, 레이어의 연산 복잡도를 나타내는 손실 함수는 제 2레이어에 포함되어 있는 학습 가능한 함수(30)의 출력 값의 합과 제 1레이어의 입력 값의 크기의 곱으로 계산될 수 있다. 또 다른 실시 예로, 추가적인 손실 함수는 레이어의 크기 혹은 연산 복잡도를 나타내는 손실 함수의 가중치 합으로 구현될 수 있다.Meanwhile, the loss function may be a function of a loss function for maximizing the accuracy of an artificial neural network operation, and an additional loss function indicating the size or computational complexity of a layer to be obtained after compression. In one embodiment, the loss function indicating the size of the layer may be calculated as the sum of the output values of the learnable function 30 included in the second layer, and the loss function indicating the computational complexity of the layer is included in the second layer It can be calculated as the product of the sum of the output values of the learned learnable function 30 and the size of the input value of the first layer. In another embodiment, the additional loss function may be implemented as a sum of weights of the loss function indicating the size or computational complexity of the layer.
한편, 전자 장치(100)는 갱신된 파라미터(20)를 학습 가능한 함수(30)에 입력하여 함수 값을 획득하고, 획득한 함수 값을 바탕으로 제 1레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신할 수 있다. 구체적으로, 파라미터 중 Wl,i를 학습 가능한 함수(30)에 입력하여 함수 값을 획득한 경우, 전자 장치(100)는 획득한 함수 값(0 또는 1)에 따라 제1 레이어의 i번째 채널을 제거할지 여부를 판단할 수 있다. 파라미터 중 Wl,i를 학습 가능한 함수(30)에 입력하여 0인 함수 값을 획득하면, 전자 장치(100)는 제1 레이어(10)의 i번째 채널을 제거할 수 있다. 파라미터 중 Wl,i를 학습 가능한 함수(30)에 입력하여 0이 출력되었다는 것은 제1 레이어의 i번째 채널은 인공 신경망의 전체 계산의 중요하지 않은 채널임을 의미할 수 있으며 전자 장치(100)에 의해 제거될 수 있다. 따라서, 인공 신경망의 전체적인 크기 및 계산량이 감소하는 동시에 계산의 정확도는 유지할 수 있다. 한편, 파라미터 중 Wl,i를 학습 가능한 함수(30)에 입력하여 1인 함수 값을 획득하면, 전자 장치(100)는 제1 레이어의 i번째 채널을 유지할 수 있다. Meanwhile, the electronic device 100 obtains a function value by inputting the updated parameter 20 into the learnable function 30, and based on the obtained function value, at least one of a plurality of channels included in the first layer The channel may be removed to update the third layer. Specifically, when a function value is obtained by inputting W l,i among the parameters to the learnable function 30, the electronic device 100 according to the acquired function value (0 or 1), the i-th channel of the first layer It can be determined whether or not to remove. If W 1, i of the parameters is input to the learnable function 30 to obtain a function value of 0, the electronic device 100 may remove the i-th channel of the first layer 10. The input of W l,i to the learnable function 30 of the parameter to output 0 may mean that the i-th channel of the first layer is an insignificant channel of the entire calculation of the artificial neural network, and the electronic device 100 Can be removed by Therefore, the overall size and calculation amount of the artificial neural network is reduced, while the accuracy of calculation can be maintained. On the other hand, when W 1, i among parameters is input to the learnable function 30 to obtain a function value of 1, the electronic device 100 may maintain the i-th channel of the first layer.
그리고, 전자 장치(100)는 제2 레이어를 제거하고, 함수 값을 바탕으로 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널이 제거된 제3 레이어로 갱신할 수 있다. 다만, 이는 일 실시 예일 뿐, 전자 장치(100)는 먼저 제1 레이어를 제3 레이어로 갱신한 뒤에 제2 레이어를 제거할 수도 있다. Then, the electronic device 100 may remove the second layer and update the third layer from which at least one channel among the plurality of channels included in the first layer is removed based on the function value. However, this is only an example, and the electronic device 100 may first update the first layer to the third layer and then remove the second layer.
일 실시 예로, 도 1b의 (a)에 도시된 바와 같이, 전자 장치(100)는 제1 레이어에 제2 레이어를 부가하여 프루닝을 수행하므로써 제1 레이어를 채널의 수가 감소된 제3 레이어로 갱신할 수 있다. 구체적으로, 전자 장치(100)는 학습 가능한 함수에서 출력된 함수 값을 바탕으로 제1 레이어에 포함된 채널 일부(60-1, 60-2)를 제거하여 제1 레이어를 제3 레이어로 갱신할 수 있다.As an example, as shown in (a) of FIG. 1B, the electronic device 100 adds a second layer to the first layer to perform pruning, thereby turning the first layer into a third layer with a reduced number of channels. It can be renewed. Specifically, the electronic device 100 may update the first layer to the third layer by removing some of the channels 60-1 and 60-2 included in the first layer based on the function value output from the learnable function. Can.
한편, 본 개시의 일 실시 예로, 전자 장치(100)는 학습 가능한 함수(30)에 갱신된 파라미터(20) 값을 입력하여 함수 값을 획득하고, 획득한 함수 값을 바탕으로 제1 커널의 가중치를 변경하고, 제1 레이어의 제1 커널을 변경된 가중치를 포함하는 제2 커널로 갱신할 수 있다. On the other hand, as an embodiment of the present disclosure, the electronic device 100 obtains a function value by inputting the updated parameter 20 value to the learnable function 30, and the weight of the first kernel based on the obtained function value And may update the first kernel of the first layer to a second kernel including the changed weight.
구체적으로, 전자 장치(100)는 제 1레이어의 커널의 가중치의 개수만큼의 학습 가능한 파라미터(50)을 가지는 제 2레이어를 부가하고 인공 신경망을 학습시켜 파라미터를 갱신시킬 수 있다. 그리고, 전자 장치(100)는 학습 가능한 함수(30)에 갱신된 파라미터를 입력하여 획득한 함수 값에 따라 제1 레이어의 제1 커널의 가중치를 0으로 변경할지 여부를 판단할 수 있다. 예를 들어, 제1 레이어의 제1 커널이 3차원 3x3x64(즉, 3X3 형태의 필터가 64 개의 채널로 구현된 형태) 행렬 형태로 구현되어 있는 경우, 전자 장치(100)는 제 1커널에 포함되어 있는 가중치와 1대 1로 대응될 수 있는 3x3x64의 행렬 형태의 학습 가능한 파라미터(20)를 포함하는 제 2레이어를 제 1레이어에 부가할 수 있다. 그리고, 전자 장치(100)는 인공 신경망을 학습시켜 파라미터를 갱신할 수 있다. 그리고, 갱신된 파라미터를 학습가능한 함수(30)에 입력하여 획득한 함수 값이 0인 경우, 전자 장치(100)는 학습 가능한 함수에 입력한 파라미터에 대응되는 제1 레이어의 제1 커널의 가중치를 0으로 변경할 수 있다. 예를 들면, 0인 함수 값을 출력될 때의 파라미터가 제1 커널의 (3,3,20)위치의 가중치와 대응되는 경우, 전자 장치(100)는 제1 커널의 (3,3,20) 위치의 가중치를 0으로 변경할 수 있다. 그리고, 획득한 함수 값이 1인 경우, 전자 장치(100)는 학습 가능한 함수(30)에 입력한 파라미터에 대응되는 제1 레이어의 제 1커널의 가중치는 그대로 유지할 수 있다. 따라서, 전자 장치(100)는 제1 레이어의 제1 커널의 가중치 중 일부를 0으로 변경하여 전체 인공 신경망의 연산량을 감소시킬 수 있다.Specifically, the electronic device 100 may update a parameter by adding a second layer having a learnable parameter 50 corresponding to the number of weights of the kernel of the first layer and learning the artificial neural network. Then, the electronic device 100 may determine whether to change the weight of the first kernel of the first layer to 0 according to the function value obtained by inputting the updated parameter to the learnable function 30. For example, when the first kernel of the first layer is implemented in a 3D 3x3x64 (ie, a 3X3 type filter is implemented in 64 channels) matrix form, the electronic device 100 is included in the first kernel A second layer including a trainable parameter 20 in the form of a matrix of 3x3x64 that can correspond to a weighted one-to-one can be added to the first layer. Then, the electronic device 100 may update the parameters by learning the artificial neural network. Then, when the function value obtained by inputting the updated parameter to the learnable function 30 is 0, the electronic device 100 determines the weight of the first kernel of the first layer corresponding to the parameter input to the learnable function. Can be changed to 0. For example, when the parameter when outputting a function value of 0 corresponds to the weight of the (3,3,20) position of the first kernel, the electronic device 100 displays (3,3,20) of the first kernel ) You can change the weight of the position to 0. Then, when the obtained function value is 1, the electronic device 100 may maintain the weight of the first kernel of the first layer corresponding to the parameter input to the learnable function 30. Accordingly, the electronic device 100 may reduce the computation amount of the entire artificial neural network by changing some of the weights of the first kernel of the first layer to 0.
일 실시 예로, 도 1b의 (b)에 도시된 바와 같이, 전자 장치(100)는 제1 레이어에 제2 레이어를 부가하여 프루닝을 수행하므로써 제1 레이어의 제1 커널에 포함된 가중치 중 일부를 0으로 변경하여, 제1 커널을 변경된 가중치를 포함하는 제2 커널(70)로 갱신할 수 있다.As an example, as shown in (b) of FIG. 1B, the electronic device 100 adds a second layer to the first layer to perform pruning, thereby partially part of the weights included in the first kernel of the first layer. By changing to 0, the first kernel can be updated to the second kernel 70 including the changed weight.
한편, 또 다른 실시 예로, 전자 장치(100)는 학습 가능한 함수에 갱신된 파라미터를 입력하여 획득한 함수 값을 바탕으로 레이어의 일부 채널을 제거하여 인공 신경망을 경량화하거나 레이어의 개별적 커널의 가중치를 0으로 변경하여 연산량을 감소시킬 수 있을 뿐 아니라, 특정 레이어를 제거하여 인공 신경망을 경량화할 수 있다.On the other hand, as another embodiment, the electronic device 100 removes some channels of the layer based on the function value obtained by inputting the updated parameter to the learnable function, thereby reducing the weight of the artificial neural network or weighting the individual kernels of the layer to 0. By changing to, it is possible not only to reduce the amount of computation, but also to remove the specific layer to lighten the artificial neural network.
구체적으로, 전자 장치(100)는 학습 가능한 함수(30)에 갱신된 파라미터(20)를 입력하여 획득한 함수 값을 바탕으로 인공 신경망에 포함되어 있는 복수의 레이어 중 적어도 하나의 레이어를 제거할 수 있다. 예를 들면, 0인 함수 값을 출력했을 때 학습 가능한 함수에 입력하였던 파라미터가 제1 레이어에 대응되는 경우, 전자 장치(100)는 인공 신경망의 제1 레이어를 제거할 수 있다. 그리고, 1인 함수 값을 출력했을 때 학습 가능한 함수에 입력하였던 파라미터가 제1 레이어에 대응되는 경우, 전자 장치(100)는 인공 신경망의 제1 레이어를 그대로 유지할 수 있다.Specifically, the electronic device 100 may remove at least one layer among a plurality of layers included in the artificial neural network based on the function value obtained by inputting the updated parameter 20 into the learnable function 30. have. For example, when the parameter input to the learnable function when the function value of 0 is output corresponds to the first layer, the electronic device 100 may remove the first layer of the artificial neural network. In addition, when the parameter input to the learnable function when the single function value is output corresponds to the first layer, the electronic device 100 may maintain the first layer of the artificial neural network.
일 실시 예로, 도 1b의 (c)에 도시된 바와 같이, 전자 장치(100)는 인공 신경망에 포함된 각 레이어에 학습 가능한 함수(30)를 포함하는 제2 레이어를 부가하여 프루닝을 수행하므로써 복수의 레이어 중 일부를 제거할 수 있다. 예를 들면, 학습 가능한 함수(30)를 통해 획득한 함수 값이 0이고 학습 가능한 함수(30)에 입력된 파라미터가 제1 및 제3 레이어에 대응되는 경우, 전자 장치(100)는 제1 및 제3 레이어를 제거하여 인공 신경망을 경량화할 수 있다.As an example, as shown in FIG. 1B(c), the electronic device 100 performs pruning by adding a second layer including a learnable function 30 to each layer included in the artificial neural network. Some of the multiple layers can be removed. For example, when the function value obtained through the learnable function 30 is 0 and the parameters input to the learnable function 30 correspond to the first and third layers, the electronic device 100 may first and The artificial neural network can be made lighter by removing the third layer.
도 2a는 본 개시의 일 실시 예에 따른, 전자 장치(100)의 구성을 간략히 도시한 도면이다. 도 2a에 도시된 바와 같이, 전자 장치(100)는 메모리(110) 및 프로세서(120)를 포함할 수 있다. 도 2a에 도시된 구성들은 본 개시의 실시 예들을 구현하기 위한 예시도이며, 통상의 기술자에게 자명한 수준의 적절한 하드웨어/소프트웨어 구성들이 전자 장치(100)에 추가로 포함될 수 있다.2A is a diagram schematically illustrating a configuration of an electronic device 100 according to an embodiment of the present disclosure. As illustrated in FIG. 2A, the electronic device 100 may include a memory 110 and a processor 120. 2A are exemplary diagrams for implementing embodiments of the present disclosure, and appropriate hardware/software configurations of a level apparent to those skilled in the art may be additionally included in the electronic device 100.
메모리(110)는 전자 장치(100)의 적어도 하나의 다른 구성요소에 관계된 인스트럭션(Instruction) 또는 데이터를 저장할 수 있다. 특히, 메모리(110-)는 비휘발성 메모리, 휘발성 메모리, 플래시메모리(flash-memory), 하드디스크 드라이브(HDD) 또는 솔리드 스테이트 드라이브(SSD) 등으로 구현될 수 있다. 메모리(110)는 프로세서(120)에 의해 액세스되며, 프로세서(120)에 의한 데이터의 독취/기록/수정/삭제/갱신 등이 수행될 수 있다. 본 개시에서 메모리라는 용어는 메모리(110), 프로세서(120) 내 롬(미도시), 램(미도시) 또는 전자 장치(100)에 장착되는 메모리 카드(미도시)(예를 들어, micro SD 카드, 메모리 스틱)를 포함할 수 있다.The memory 110 may store instructions or data related to at least one other component of the electronic device 100. In particular, the memory 110- may be implemented as a non-volatile memory, a volatile memory, a flash-memory, a hard disk drive (HDD) or a solid state drive (SSD). The memory 110 is accessed by the processor 120, and data read/write/modify/delete/update may be performed by the processor 120. In the present disclosure, the term memory is a memory card (not shown) mounted on a memory 110, a ROM (not shown), a RAM (not shown), or an electronic device 100 in a processor 120 (eg, micro SD) Card, memory stick).
특히, 메모리(110)는 복수의 레이어를 포함하는 인공 신경망을 저장할 수 있으며, 각 레이어에 포함되어 있는 커널 및 파라미터를 저장할 수 있다. 그리고, 메모리(110)는 각 레이어의 출력 데이터 및 전체 인공 신경망의 출력 데이터를 저장할 수 있다.In particular, the memory 110 may store an artificial neural network including a plurality of layers, and may store kernels and parameters included in each layer. In addition, the memory 110 may store output data of each layer and output data of the entire artificial neural network.
프로세서(120)는 메모리(110)와 전기적으로 연결되어 전자 장치(100)의 전반적인 동작 및 기능을 제어할 수 있다. 특히, 프로세서(120)는 메모리(110)에 저장되어 있는 적어도 하나의 인스트럭션을 실행함으로써, 복수의 레이어를 포함하는 인공 신경망중 제1 레이어에 학습 가능한 함수를 포함하는 제2 레이어를 부가하고, 인공 신경망을 학습시켜 제2 레이어에 포함되어 있는 파라미터 값을 갱신하고, 학습 가능한 함수에 갱신된 파라미터 값을 입력하여 함수 값을 획득하고, 획득한 함수 값을 바탕으로 상기 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신할 수 있다.The processor 120 is electrically connected to the memory 110 to control overall operations and functions of the electronic device 100. In particular, the processor 120 adds a second layer including a learnable function to a first layer among artificial neural networks including a plurality of layers by executing at least one instruction stored in the memory 110, and artificial A neural network is trained to update parameter values included in the second layer, input updated parameter values to a learnable function to obtain function values, and a plurality of values included in the first layer based on the acquired function values At least one of the channels may be removed to update the third layer.
특히, 프로세서(120)는 인공 신경망의 크기를 줄이기 위하여 인공 신경망에 포함된 모든 레이어에 학습 가능한 함수를 포함하는 레이어를 부가할 수 있다. 다만, 이는 일 실시 예이며 특정 레이어를 선택한 사용자 명령이 입력부(130)를 통해 입력되면, 프로세서(120)는 선택된 레이어에만 학습 가능한 함수를 부가할 수 있다. 그리고, 학습 가능한 함수는 0 또는 1을 출력하는 제1 함수에 미분 가능한 제2 함수를 더한 함수이고, 제2 함수는 미분 가능한 함수와 기설정된 기울기(gradient)를 가지는 함수를 곱한 함수 일 수 있다. 함수의 수식적 특성 및 증명은 도 4를 참조하여 구체적으로 설명하도록 한다.In particular, the processor 120 may add a layer including a learnable function to all layers included in the artificial neural network in order to reduce the size of the artificial neural network. However, this is an embodiment and when a user command selecting a specific layer is input through the input unit 130, the processor 120 may add a learnable function to only the selected layer. Further, the learnable function may be a function of adding a second function that can be differentiated to a first function that outputs 0 or 1, and the second function may be a function of multiplying a function having a preset gradient and a function that can be differentiated. The mathematical characteristics and proof of the function will be described in detail with reference to FIG. 4.
그리고, 프로세서(120)는 인공 신경망을 학습시켜 제2 레이어에 포함되어 있는 파라미터 값을 갱신할 수 있다. 일 실시 예로, 프로세서(120)는 제2 레이어에 포함된 학습 가능한 함수의 함수 값과 제1 레이어의 출력 데이터를 채널 별로 곱하여 제2 레이어의 출력 데이터를 획득할 수 있다. 예를 들면, 제2 레이어에 포함된 파라미터가 (Wl,1, Wl,2 … Wl,n)인 경우, 프로세서(120)는 학습 가능한 함수에 (Wl,1, Wl,2 … Wl,n)을 입력하여 함수 값을 획득하고, 획득한 함수 값을 제1 레이어의 제1 채널, 제2 채널 … 제n 채널에 곱하여 제2 레이어의 출력 데이터를 획득할 수 있다. 그리고, 프로세서(120)는 획득한 제2 레이어의 출력 데이터를 바탕으로 손실 함수를 생성할 수 있다. 그리고, 프로세서(120)는 손실 함수에 확률적 경사 하강법 알고리즘을 적용하여 함수 값(손실 값)을 최소로 하는 파라미터 값을 획득하고, 기존의 파라미터 값을 획득한 파라미터 값으로 갱신할 수 있다. 다만, 확률적 경사 하강법 알고리즘은 일 실시 예에 불과하며 전자 장치(100)는 다양한 알고리즘(예를 들어, 모멘텀(Momentum) 알고리즘, adagrad 알고리즘, adam 알고리즘 등)을 손실함수에 적용하여 최소 함수 값을 갖도록 하는 파라미터 값을 획득할 수 있다.Also, the processor 120 may update the parameter values included in the second layer by learning the artificial neural network. For example, the processor 120 may obtain output data of the second layer by multiplying the function value of the learnable function included in the second layer and the output data of the first layer for each channel. For example, the parameters included in the second layer (W l, 1, W l, 2, ... W l, n) of the case, the processor 120 may learn the available function (W l, 1, W l, 2 … W l,n ) to obtain the function value, and the obtained function value is the first channel and the second channel of the first layer. The output data of the second layer may be obtained by multiplying the n-th channel. In addition, the processor 120 may generate a loss function based on the obtained output data of the second layer. Then, the processor 120 may apply a stochastic gradient descent algorithm to the loss function to obtain a parameter value that minimizes the function value (loss value), and update the existing parameter value with the acquired parameter value. However, the stochastic gradient descent algorithm is only one embodiment, and the electronic device 100 applies various algorithms (for example, a momentum algorithm, adagrad algorithm, adam algorithm, etc.) to the loss function, and thus a minimum function value. It is possible to obtain a parameter value to have.
그리고, 프로세서(120)는 학습 가능한 함수에 갱신된 파라미터 값을 입력하여 함수 값을 획득할 수 있다. 예를 들면, 갱신된 파라미터 값이 음수인 경우, 프로세서(120)는 학습 가능한 함수에 음수인 파라미터 값을 입력하여 0인 함수 값을 획득할 수 있다. 또한, 갱신된 파라미터 값이 양수인 경우, 프로세서(120)는 학습 가능한 함수에 양수인 파라미터 값을 입력하여 1인 함수 값을 획득할 수 있다. 다만, 이는 일 실시 예이며 프로세서(120)는 음수 또는 양수인 파라미터 값을 학습 가능한 함수에 입력하여 각각 0 또는 1에 임계값 범위 내의 차이가 있는 값을 획득할 수 있다.Then, the processor 120 may obtain the function value by inputting the updated parameter value to the learnable function. For example, when the updated parameter value is negative, the processor 120 may obtain a function value of 0 by inputting a negative parameter value into the learnable function. In addition, when the updated parameter value is a positive number, the processor 120 may obtain a function value of 1 by inputting a positive parameter value into a learnable function. However, this is an embodiment and the processor 120 may input a negative or positive parameter value into a learnable function to obtain a value having a difference in a threshold range of 0 or 1, respectively.
또한, 프로세서(120)는 획득한 함수 값을 바탕으로 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제1 레이어를 제3 레이어로 갱신할 수 있다. 구체적으로, 획득한 함수 값이 0인 경우, 프로세서(120)는 학습 가능한 함수에 입력한 파라미터에 대응되는 제1 레이어의 커널을 제거할 수 있다. 예를 들면, 0인 함수 값을 획득하였을 때 입력한 파라미터가 Wl,1인 경우, 프로세서(120)는 제1 레이어의 제1 채널을 삭제할 수 있다. 그리고, 1인 함수 값을 획득하였을 때 입력한 파라미터가 Wl,2인 경우, 프로세서(120)는 제1 레이어의 제2 채널은 그대로 유지할 수 있다. 그리고, 프로세서(120)는 제1 레이어를 함수 값을 바탕으로 채널을 제거 또는 유지한 제3 레이어로 갱신할 수 있다.Also, the processor 120 may update the first layer to the third layer by removing at least one channel among the plurality of channels included in the first layer based on the acquired function value. Specifically, when the obtained function value is 0, the processor 120 may remove the kernel of the first layer corresponding to the parameter input to the learnable function. For example, when the input parameter is W l,1 when a function value of 0 is obtained, the processor 120 may delete the first channel of the first layer. In addition, when the inputted parameter is W l,2 when a function value of 1 is obtained, the processor 120 may maintain the second channel of the first layer. Then, the processor 120 may update the first layer to the third layer in which the channel is removed or maintained based on the function value.
한편, 프로세서(120)는 제2 레이어를 제거하고, 함수 값을 바탕으로 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신할 수 있으나 이는 일 실시 예이며 제3 레이어로 갱신한 뒤에 제2 레이어를 제거할 수 있다.On the other hand, the processor 120 may remove the second layer and remove at least one channel among a plurality of channels included in the first layer based on the function value to update the third layer, but this is an embodiment. After updating to 3 layers, the second layer can be removed.
한편, 프로세서(120)는 학습 가능한 함수에 갱신된 파라미터 값을 입력하여 함수 값을 획득하고, 획득한 함수 값을 바탕으로 상기 제1 레이어의 제1 커널의 가중치를 변경하고, 제1 레이어의 제1 커널을 변경된 가중치를 포함하는 제2 커널로 갱신할 수 있다. 일 실시 예로, 제1 레이어의 제1 커널이 3X3X64 행렬로 구현될 때 획득한 함수 값이 0인 경우, 프로세서(120)는 학습 가능한 함수에 입력한 파라미터에 대응되는 제1 레이어의 제1 커널의 가중치를 0으로 변경할 수 있다. 예를 들면, 0인 함수 값이 출력될 때의 파라미터가 제1 커널의 (3,3,20)위치의 가중치와 대응되는 경우, 프로세서(120)는 제1 커널의 (3,3,20) 위치의 가중치를 0으로 변경할 수 있다. 그리고, 1인 함수 값이 출력될 때의 파라미터가 제1 커널의 (3,3,20)위치의 가중치와 대응되는 경우, 프로세서(120)는 제1 커널의 (3,3,20)위치의 가중치를 그대로 유지할 수 있다.Meanwhile, the processor 120 obtains a function value by inputting an updated parameter value to the learnable function, changes the weight of the first kernel of the first layer based on the obtained function value, and removes the first layer One kernel may be updated with a second kernel including the changed weight. In one embodiment, when the function value obtained when the first kernel of the first layer is implemented as a 3X3X64 matrix is 0, the processor 120 of the first kernel of the first layer corresponding to the parameter input to the learnable function The weight can be changed to zero. For example, when the parameter when the function value of 0 is output corresponds to the weight of the (3,3,20) position of the first kernel, the processor 120 may (3,3,20) of the first kernel The weight of the position can be changed to zero. In addition, when the parameter when the function value of 1 is output corresponds to the weight of the (3,3,20) position of the first kernel, the processor 120 displays the (3,3,20) position of the first kernel. The weight can be maintained.
한편, 프로세서(120)는 하나 또는 복수의 프로세서로 구성될 수 있다. 이때, 하나 또는 복수의 프로세서(120)는 CPU(Central Processing Unit), AP(Application Processor) 등과 같은 범용 프로세서, GPU(graphics-processing Unit), VPU (Visual Processing Unit) 등과 같은 그래픽 전용 프로세서 또는 NPU(Neural Processing Unit)와 같은 인공지능 전용 프로세서일 수 있다.Meanwhile, the processor 120 may be composed of one or a plurality of processors. At this time, the one or a plurality of processors 120 is a general-purpose processor such as a central processing unit (CPU), an application processor (AP), a graphics-processing unit (GPU), a graphics-only processor such as a VPU (Visual Processing Unit), or an NPU Neural Processing Unit).
하나 또는 복수의 프로세서는, 메모리(110)에 저장된 기정의된 동작 규칙 또는 인공지능 모델에 따라, 입력 데이터를 처리하도록 제어한다. 기정의된 동작 규칙 또는 인공지능 모델은 학습을 통해 만들어진 것을 특징으로 한다. One or a plurality of processors are controlled to process input data according to predefined operation rules or artificial intelligence models stored in the memory 110. The predefined motion rules or artificial intelligence models are characterized by being created through learning.
여기서, 학습을 통해 만들어진다는 것은, 다수의 학습 데이터들에 학습 알고리즘을 적용함으로써, 원하는 특성의 기정의된 동작 규칙 또는 인공지능 모델이 만들어짐을 의미한다. 이러한 학습은 본 개시에 따른 인공지능이 수행되는 기기 자체에서 이루어질 수도 있고, 별도의 서버/시스템을 통해 이루어 질 수도 있다. Here, being made through learning means that by applying a learning algorithm to a plurality of learning data, a predefined action rule or artificial intelligence model of desired characteristics is created. Such learning may be performed on a device on which artificial intelligence according to the present disclosure is performed, or may be performed through a separate server/system.
학습 알고리즘은, 다수의 학습 데이터들을 이용하여 소정의 대상 기기(예컨대, 로봇)을 훈련시켜 소정의 대상 기기 스스로 결정을 내리거나 예측을 할 수 있도록 하는 방법이다. 학습 알고리즘의 예로는, 지도형 학습(supervised learning), 비지도형 학습(unsupervised learning), 준지도형 학습(semi-supervised learning) 또는 강화 학습(reinforcement learning)이 있으며, 본 개시에서의 학습 알고리즘은 명시한 경우를 제외하고 전술한 예에 한정되지 않는다.The learning algorithm is a method of training a predetermined target device (eg, a robot) using a plurality of learning data so that a predetermined target device can make a decision or make a prediction by itself. Examples of learning algorithms include supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning, where learning algorithms in the present disclosure are specified. It is not limited to the above-mentioned example except.
도 2b는 본 개시의 일 실시 예에 따른, 전자 장치(100)의 구성을 상세히 도시한 블록도이다. 도 2b에 도시한 바와 같이, 전자 장치(100)는 메모리(110), 프로세서(120), 입력부(130), 통신부(140), 디스플레이(150) 및 오디오 출력부(160)를 포함할 수 있다. 한편, 메모리(110) 및 프로세서(120)는 도 2a에서 설명하였으므로, 중복되는 설명은 생략하기로 한다.2B is a block diagram illustrating in detail the configuration of the electronic device 100 according to an embodiment of the present disclosure. 2B, the electronic device 100 may include a memory 110, a processor 120, an input unit 130, a communication unit 140, a display 150, and an audio output unit 160. . Meanwhile, since the memory 110 and the processor 120 are described in FIG. 2A, redundant description will be omitted.
입력부(130)는 다양한 사용자 입력을 수신하여 프로세서(120)로 전달할 수 있다. 특히, 입력부(130)는 터치 센서, (디지털) 펜 센서, 압력 센서, 키, 또는 마이크를 포함할 수 있다. 터치 센서는, 예를 들면, 정전식, 감압식, 적외선 방식, 또는 초음파 방식 중 적어도 하나의 방식을 사용할 수 있다. (디지털) 펜 센서는, 예를 들면, 터치 패널의 일부이거나, 별도의 인식용 쉬트를 포함할 수 있다.The input unit 130 may receive various user inputs and transmit them to the processor 120. In particular, the input unit 130 may include a touch sensor, a (digital) pen sensor, a pressure sensor, a key, or a microphone. For the touch sensor, for example, at least one of capacitive, pressure-sensitive, infrared, and ultrasonic methods may be used. The (digital) pen sensor may be, for example, a part of the touch panel or may include a separate recognition sheet.
일 실시 예로, 입력부(130)를 통해 인공 신경망에 포함된 복수의 레이어 중 채널의 수를 줄이고자 하는 제1 레이어를 선택하는 사용자 명령을 수신하여 프로세서(120)로 전달할 수 있다.As an embodiment, a user command for selecting a first layer to reduce the number of channels among a plurality of layers included in the artificial neural network may be received through the input unit 130 and transmitted to the processor 120.
통신부(140)는 다양한 통신 방식을 통해 외부의 장치와 통신을 수행할 수 있다. 통신부(140)가 외부 장치와 통신 연결되는 것은 제3 기기(예로, 중계기, 허브, 엑세스 포인트, 서버 또는 게이트웨이 등)를 거쳐서 통신하는 것을 포함할 수 있다.The communication unit 140 may communicate with an external device through various communication methods. The communication unit 140 may be connected to an external device through communication with a third device (eg, a repeater, a hub, an access point, a server, or a gateway).
한편, 통신부(140)는 외부 장치와 통신을 수행하기 위해 다양한 통신 모듈을 포함할 수 있다. 일 예로, 통신부(140)는 무선 통신 모듈을 포함할 수 있으며, 예를 들면, LTE, LTE-A(LTE Advance), CDMA(code division multiple access), WCDMA(wideband CDMA), UMTS(universal mobile telecommunications system), WiBro(Wireless Broadband), 또는 GSM(Global System for Mobile Communications) 등 중 적어도 하나를 사용하는 셀룰러 통신 모듈을 포함할 수 있다. 또 다른 예로, 무선 통신 모듈은, 예를 들면, WiFi(wireless fidelity), 블루투스, 블루투스 저전력(BLE), 지그비(Zigbee), 중 적어도 하나를 포함할 수 있다.Meanwhile, the communication unit 140 may include various communication modules to perform communication with an external device. For example, the communication unit 140 may include a wireless communication module, for example, LTE, LTE-A (LTE Advance), code division multiple access (CDMA), wideband CDMA (WCDMA), universal mobile telecommunications (UMTS) system), WiBro (Wireless Broadband), or GSM (Global System for Mobile Communications). As another example, the wireless communication module may include, for example, at least one of WiFi (wireless fidelity), Bluetooth, Bluetooth low power (BLE), and Zigbee.
디스플레이(150)는 프로세서(120)의 제어에 따라 다양한 정보를 표시할 수 있다. 특히, 디스플레이(150)는 프로세서(140) 제어에 따라 제1 레이어가 제3 레이어로 갱신되었다는 인디케이터를 표시할 수 있다.The display 150 may display various information under the control of the processor 120. In particular, the display 150 may display an indicator that the first layer has been updated to the third layer under the control of the processor 140.
그리고, 디스플레이(150)는 터치 패널과 함께 터치 스크린으로도 구현될 수 있다. 그러나 상술한 구현으로 한정되는 것은 아니며, 디스플레이(150)는 전자 장치(100)의 유형에 따라 다르게 구현될 수 있다.In addition, the display 150 may be implemented as a touch screen together with a touch panel. However, it is not limited to the above-described implementation, and the display 150 may be implemented differently according to the type of the electronic device 100.
오디오 출력부(160)는 오디오 처리부(미도시)에 의해 디코딩이나 증폭, 노이즈 필터링과 같은 다양한 처리 작업이 수행된 각종 오디오 데이터뿐만 아니라 각종 알림 음이나 음성 메시지를 출력하는 구성이다. 일 실시 예로, 오디오 출력부(160)는 제1 레이어가 제3 레이어로 갱신되었다는 알림음을 출력할 수 있다.The audio output unit 160 is a component that outputs various notification sounds or voice messages as well as various audio data performed by various processing operations such as decoding, amplification, and noise filtering by the audio processing unit (not shown). As an embodiment, the audio output unit 160 may output a notification sound that the first layer has been updated to the third layer.
오디오 출력부(160)는 스피커(160)로 구현될 수 있으나 이는 일 실시 예에 불과할 뿐, 오디오 데이터를 출력할 수 있는 다른 출력 단자로 구현될 수도 있다.The audio output unit 160 may be implemented as a speaker 160, but this is only an example, and may be implemented as another output terminal capable of outputting audio data.
도 3은 본 개시의 일 실시 예에 따른, 전자 장치(100)에 저장된 복수의 레이어를 포함하는 인공 신경망의 학습 방법을 설명하기 위한 도면이다. 3 is a diagram for explaining a method of learning an artificial neural network including a plurality of layers stored in the electronic device 100 according to an embodiment of the present disclosure.
일 실시 예로, 사용자 혹은 외부 장치로부터 훈련용 입력 데이터 (310)를 입력받으면, 전자 장치(100)는 입력 데이터(310)를 제1 레이어(320)에 입력하여 출력 데이터 (330)를 획득할 수 있다. 입력 데이터(310)는 영상 데이터 혹은 음성 데이터 일 수 있으나 이에 한정되는 것은 아니다. 그리고, 출력 데이터(330)는 제1 레이어(320)의 커널과 입력 데이터(310) 간에 합성 곱(convolution) 연산이 수행되어 획득된 특징 맵(feature map)일 수 있다. 한편, 도 3에 도시된 입력 데이터(310) 및 출력 데이터(330)는 다차원 매트릭스 형태의 텐서로 구현될 수 있으나 이는 일 실시예에 불과하며 다양한 형태(예를 들어, 벡터 등)로 구현될 수 있다. As an embodiment, when receiving training input data 310 from a user or an external device, the electronic device 100 may acquire the output data 330 by inputting the input data 310 to the first layer 320. have. The input data 310 may be video data or audio data, but is not limited thereto. In addition, the output data 330 may be a feature map obtained by performing a synthesis convolution operation between the kernel of the first layer 320 and the input data 310. Meanwhile, the input data 310 and the output data 330 illustrated in FIG. 3 may be implemented as a multi-dimensional matrix tensor, but this is only an embodiment and may be implemented in various forms (for example, vectors). have.
전자 장치(100)는 학습 가능한 함수(380)에 학습 가능한 파라미터(370)를 입력하여 획득한 함수 값과 출력 데이터(330)를 채널 별로 곱하여 마스킹된 출력 데이터(340)를 획득할 수 있다. 예를 들어, i번째 출렉 데이터와 곱해질 함수 값의 파라미터(W1,i)가 음수인 경우, 전자 장치(100)는 학습 가능한 함수에 음수인 파라미터 값을 입력하여 0인 함수 값을 획득하고, 획득한 0인 함수 값을 i 번째 출력 데이터와 곱할 수 있다. i번째 출력 데이터와 곱해질 함수 값의 파라미터(W1,i)가 양수인 경우, 전자 장치(100)는 학습 가능한 함수에 양수인 파라미터 값을 입력하여 1인 함수 값을 획득하고, 획득한 1인 함수 값을 i 번째 출력 데이터와 곱할 수 있다. 따라서, 전자 장치(100)는 함수 값인 0 또는 1을 출력 데이터(330)의 채널 별로 곱하여 마스킹된 출력 텐서(340)를 획득할 수 있다. 한편, 학습 가능한 함수(380) 및 학습 가능한 파라미터(370)는 제1 레이어에 부가된 제2 레이어에 포함될 수 있다.The electronic device 100 may obtain the masked output data 340 by multiplying the function value obtained by inputting the learnable parameter 370 into the learnable function 380 and the output data 330 for each channel. For example, when the parameter W 1,i of the function value to be multiplied by the i th eclectic data is negative, the electronic device 100 obtains a function value of 0 by inputting a negative parameter value to the learnable function, , The obtained zero function value can be multiplied with the i-th output data. When the parameter W 1, i of the function value to be multiplied by the i-th output data is positive, the electronic device 100 obtains a function value of 1 by inputting a parameter value that is a positive value to the learnable function, and the acquired 1-function The value can be multiplied by the i-th output data. Accordingly, the electronic device 100 may obtain the masked output tensor 340 by multiplying the function value 0 or 1 for each channel of the output data 330. Meanwhile, the learnable function 380 and the learnable parameter 370 may be included in the second layer added to the first layer.
그리고, 학습 가능한 함수(380)는 예를 들어 0 또는 1을 출력하거나 -1 또는 1을 출력하는 등 이산화 값을 출력하는 제1 함수에 미분 가능한 제2 함수를 더한 함수이고, 제2 함수는 미분 가능한 함수와 기설정된 기울기(gradient)를 가지는 함수를 곱한 함수일 수 있다. 학습 가능한 함수와 관련된 수학적 특성 및 증명은 도 4를 참조하여 구체적으로 설명하도록 한다.In addition, the learnable function 380 is a function of adding a second function that can be differentiated to a first function that outputs a discretization value, such as outputting 0 or 1 or outputting -1 or 1, and the second function is differentiation. It may be a function multiplied by a function having a predetermined gradient and a possible function. The mathematical properties and proofs related to the learnable function will be described in detail with reference to FIG. 4.
그리고, 일 실시 예로 전자 장치(100)는 마스킹된 출력 데이터(340)를 바탕으로 손실 함수를 획득하고, 손실 함수에 확률적 경사 하강법 알고리즘을 적용하여 함수 값(손실 값)이 최소가 되게 하는 파라미터를 획득할 수 있다. 확률적 경사 하강법 알고리즘을 통하여 손실 함수에서 최소 함수 값을 갖게 하는 파라미터를 획득하는 방법은 공지의 기술이므로 자세한 방식은 생략하도록 한다. 그리고, 전자 장치(100)는 기존의 파라미터를 새로 획득한 파라미터로 갱신(360)할 수 있다.Then, as an example, the electronic device 100 obtains a loss function based on the masked output data 340 and applies a stochastic gradient descent algorithm to the loss function to minimize the function value (loss value). The parameters can be obtained. Since a method of obtaining a parameter having a minimum function value in a loss function through a probabilistic gradient descent algorithm is a known technique, a detailed method will be omitted. Then, the electronic device 100 may update the existing parameter with the newly acquired parameter (360).
그리고, 추가적인 입력 데이터(310)가 입력되면, 전자 장치(100)는 제1 레이어에 입력 데이터를 입력하여 출력 데이터를 획득하고, 제2 레이어에 포함된 학습 가능한 함수에 획득하여 갱신된 파라미터(370)를 입력하여 획득한 함수 값을 출력 데이터에 채널 별로 곱하여 마스킹된 출력 데이터를 획득할 수 있다. 그 이후 상술한 바와 같이 마스킹된 출력 데이터를 바탕으로 손실 함수를 획득하고, 손실 함수에 확률적 경사 하강법 알고리즘을 적용하여 손실 함수 값을 최소로 하게 하는 파라미터 값을 획득할 수 있다. 그리고, 전자 장치(100)는 기존의 파라미터를 획득한 파라미터로 갱신할 수 있다. 즉, 전자 장치(100)는 도 3에 도시된 바와 같이 인공 신경망을 학습하고 파라미터 값을 갱신할 수 있다.Then, when the additional input data 310 is input, the electronic device 100 acquires output data by inputting input data to the first layer, and acquires updated data by obtaining the learnable function included in the second layer 370 ) To obtain the masked output data by multiplying the output data obtained by inputting the function value for each channel. Thereafter, a loss function may be obtained based on the output data masked as described above, and a parameter value that minimizes the loss function value may be obtained by applying a stochastic gradient descent algorithm to the loss function. Then, the electronic device 100 may update the existing parameters with the acquired parameters. That is, the electronic device 100 may learn an artificial neural network and update parameter values as illustrated in FIG. 3.
도 4는 본 개시의 일 실시 예에 따른, 전자 장치의 제2 레이어에 포함된 학습 가능한 함수를 설명하기 위한 도면이다.4 is a diagram for describing a learnable function included in a second layer of an electronic device according to an embodiment of the present disclosure.
제2 레이어에 포함된 학습 가능한 함수(450)는 0 또는 1을 출력하는 제1 함수(410)에 미분 가능한 제2 함수(420)를 더한 함수이다. 도 4에 도시된 바와 같이 제1 함수(410)는 음수인 파라미터 값을 입력하면 0을 출력하고, 양수인 파라미터 값을 입력하면 1을 출력하는 단위 계단 함수일 수 있다. 다만, 이는 일 실시 예에 불과하며 제1 함수(410)는 0 또는 1을 출력하는 다른 함수로 구현될 수 있다.The learnable function 450 included in the second layer is a function of adding a second function 420 that can be differentiated to a first function 410 that outputs 0 or 1. As illustrated in FIG. 4, the first function 410 may be a unit staircase function that outputs 0 when a negative parameter value is input and 1 when a positive parameter value is input. However, this is only an example, and the first function 410 may be implemented as another function that outputs 0 or 1.
일 실시 예로, 제1 함수(410)가 단위 계단 함수로 구현된 경우, 임의의 파라미터 값에 대해 미분 값이 0이므로, 전자 장치(100)는 미분을 활용하는 확률적 경사 하강법 알고리즘을 손실 함수에 적용하여 파라미터를 학습시킬 수 없다. 따라서, 단위 계단 함수에 미분 가능한 제2 함수(420)를 더할 수 있다. 제2 함수(420)는 미분 가능한 함수(430)와 기설정된 기울기를 가지는 함수(또는, derivative shape)(440)를 곱한 함수일 수 있다. 미분 가능한 함수(430)는 출력 값의 범위가 한정된 양의 미분값을 가지는 함수로 구현될 수 있으며 일 실시 예로 톱니파 함수를 포함할 수 있다. 일 실시 예로, 미분 가능한 함수(430)가 톱니파 함수로 구현된 미분 가능한 함수인 제2 함수(430)는 수학식 1과 같다.As an example embodiment, when the first function 410 is implemented as a unit step function, since the differential value is 0 for an arbitrary parameter value, the electronic device 100 loses a stochastic gradient descent algorithm utilizing the differential function. It cannot be applied to train parameters. Accordingly, a second function 420 that can be differentiated can be added to the unit step function. The second function 420 may be a function of multiplying the derivative function 430 and a function (or derivative shape) 440 having a predetermined slope. The derivable function 430 may be implemented as a function having a limited amount of derivative values in a range of output values, and may include a sawtooth function as an example. As an example, the second function 430, which is a differential function that the differential function 430 is implemented as a sawtooth function, is expressed by Equation (1).
Figure PCTKR2019016235-appb-M000001
Figure PCTKR2019016235-appb-M000001
수학식 1의 M은 기설정된 양의 정수이며 수학식 1의 임의의 w(파라미터)에 대한 기울기 값은 1이다.M in Equation 1 is a predetermined positive integer, and the slope value for any w (parameter) in Equation 1 is 1.
학습 가능한 함수(450)를
Figure PCTKR2019016235-appb-I000001
라고 정의하고 기설정된 기울기를 가지는 함수(440)를
Figure PCTKR2019016235-appb-I000002
라고 정의할 경우, 학습 가능한 함수는 수학식 2와 같다.
Learnable function (450)
Figure PCTKR2019016235-appb-I000001
And a function 440 having a predetermined slope
Figure PCTKR2019016235-appb-I000002
When defined as, the function that can be learned is equal to Equation 2.
Figure PCTKR2019016235-appb-M000002
Figure PCTKR2019016235-appb-M000002
그리고, 학습 가능한 함수(450)가 수학식 2와 같이 구현 될 때 M의 값이 임계 값(예를 들면, 10^5)을 초과할 경우, 학습 가능한 함수(450)는 임의의 w(파라미터)에 대해 제1 함수와 동일하거나 임계값 범위 내의 오차가 발생하는 함 수값을 출력할 수 있다. 또한, 학습 가능한 함수는 기설정된 기울기를 가지는 함수(440)와 동일 또는 임계값 범위 내의 오차가 발생하는 기울기 값을 출력할 수 있다.In addition, when the value of M exceeds a threshold value (for example, 10^5) when the learnable function 450 is implemented as in Equation 2, the learnable function 450 is an arbitrary w (parameter). With respect to, a function value that is the same as the first function or an error within the threshold range can be output. In addition, the learnable function may output a slope value in which an error occurs within the same or threshold range as the function 440 having a predetermined slope.
M이 임계값을 초과할 경우, 학습 가능한 함수(450)가 임의의 w(파라미터)에 대해 제1 함수와 동일 또는 임계 값 범위 내의 오차가 발생하는 함수 값을 출력할 수 있다는 특성의 증명은 수학식 3과 같다.Proof of the characteristic that if M exceeds a threshold, the learnable function 450 can output a function value equal to or equal to the first function for any w (parameter) or within a threshold range. Equation 3.
Figure PCTKR2019016235-appb-M000003
Figure PCTKR2019016235-appb-M000003
M이 임계값을 초과할 경우, 학습 가능한 함수(450)가 임의의 w(파라미터)에 대해 기설정된 기울기를 가지는 함수와 동일 또는 임계값 범위 내의 오차가 발생하는 기울기 값을 출력한다는 특성의 증명은 수학식 4과 같다. Proof of the characteristic that when M exceeds the threshold, the learnable function 450 outputs a slope value that is equal to a function having a predetermined slope for any w (parameter) or an error within a threshold range. Equation 4.
Figure PCTKR2019016235-appb-M000004
Figure PCTKR2019016235-appb-M000004
본 개시의 일 실시 예에 따른, 제2 함수의 M값은 임계값을 초과하므로, 학습 가능한 함수(450)는 임의의 w(파라미터)에 대해 제1 함수와 동일 또는 임계값 범위 내의 오차가 발생하는 함수 값을 출력하고, 기설정된 기울기를 가지는 함수(440)와 동일 또는 임계값 범위 내의 오차가 발생하는 기울기 값을 출력할 수 있다. 따라서, 음수인 또는 양수인 파라미터를 학습 가능한 함수(450)에 입력할 경우, 전자 장치(100)는 각각 0 또는 1인 함수 값을 출력하거나, 0 또는 1과 임계값 범위 내의 오차가 발생하는 함수 값을 출력할 수 있다. 그리고, 학습 가능한 함수(450)의 미분 값은 0이 아니므로 인공 신경망에 확률적 경사 하강법을 적용하여 학습시켜 제2 레이어에 포함된 파라미터 값을 갱신할 수 있다.According to an embodiment of the present disclosure, since the M value of the second function exceeds a threshold, the learnable function 450 is the same as the first function for any w (parameter) or an error within a threshold range occurs The function value may be output, and a slope value in which an error in the same or threshold range as the function 440 having a predetermined slope occurs. Therefore, when a negative or positive parameter is input to the learnable function 450, the electronic device 100 outputs a function value of 0 or 1, respectively, or a function value in which an error occurs within a range of 0 or 1 and a threshold value. Can output In addition, since the differential value of the learnable function 450 is not 0, it is possible to update the parameter value included in the second layer by learning by applying a stochastic gradient descent method to the artificial neural network.
도 5는 본 개시의 일 실시 예에 따른, 전자 장치(100)와 관련된 실험 결과를 설명하기 위한 도면이다. 구체적으로, 도 5는 본 개시에서 전자 장치(100)가 제1 레이어를 압축하는 방식과 다른 방식의 실험 결과(압축률 및 압축 이후 계산의 정확도)를 비교하기 위한 도면이다. 압축률(FLOPs(Floating Point Operations))는 기존의 인공 신경망의 계산량과 학습 가능한 제2 레이어를 부가하여 압축한 인공 신경망의 계산량을 나눈 비율이다. 따라서, 압축률 값이 클수록 인공 신경망이 많이 압축되었음을 의미한다.5 is a view for explaining an experimental result related to the electronic device 100 according to an embodiment of the present disclosure. Specifically, FIG. 5 is a diagram for comparing an experiment result (compression rate and accuracy of calculation after compression) of a method different from the method in which the electronic device 100 compresses the first layer in the present disclosure. The compression rate (FLOPs (Floating Point Operations)) is a ratio obtained by dividing the calculated amount of the existing artificial neural network and the calculated amount of the compressed artificial neural network by adding a second trainable layer. Therefore, the larger the compression ratio value, the more the artificial neural network is compressed.
도 5는 전자 장치(100)가 CIFAR-10 데이터 셋(Data set)에서 ResNet-56(v2)인 인공 신경망 구조를 다양한 방식으로 압축했을 때의 실험 결과이다. (가) 방식은 인공 신경망에 포함된 레이어의 커널을 채널 별로 가중치의 절대값의 합을 획득하고, 절대값의 합이 작은 채널의 커널부터 제거하여 인공 신경망을 압축하는 방식이다. (나) 방식은 레이어의 각 채널에 0과 1사이의 실수 값을 가지는 학습된 가중치를 곱하고, 작은 값을 가지는 채널을 제거하여 인공 신경망을 압축하는 방식이다. (다) 방식은 상술한 전자 장치(100)의 제어 방법으로 인공 신경망을 압축하는 방식이다.5 is an experimental result when the electronic device 100 compresses the artificial neural network structure of ResNet-56 (v2) in a CIFAR-10 data set in various ways. The method (a) is a method of compressing the artificial neural network by acquiring the sum of the absolute values of weights for each channel of the kernel of the layer included in the artificial neural network, and removing the kernel of the channel having the smallest sum of absolute values. The method (B) is a method of compressing an artificial neural network by multiplying each channel of a layer by a learned weight having a real value between 0 and 1, and removing a channel having a small value. (C) is a method of compressing an artificial neural network using the above-described control method of the electronic device 100.
도 5에 도시된 바와 같이 (가) 방식의 인공 신경망 압축률은 1.21배이나 (다) 방식의 경우 압축률이 2배이다. 그리고, (나) 방식은 인공 신경망 압축률은 2배로 (다) 방식의 압축률과 동일하거나 오차 범위 내이나 인공 신경망 압축 후 계산의 정확도에서 차이가 존재한다. (나) 방식의 경우, 인공 신경망 압축 후 계산의 정확도가 1%만큼 감소하였으나 (다) 방식의 경우 0.46% 정도 감소하였다. 즉, 도 5의 (a)의 실험 결과를 통해 (다) 방식은 (가), (나) 방식에 비해 각각 인공 신경망의 압축률 및 압축 후 계산 정확도가 높다는 것을 알 수 있다.As shown in Fig. 5, the compression ratio of the artificial neural network in (A) is 1.21 times, but in the case of (C), the compression is twice. And, in the (B) method, the compression ratio of the artificial neural network is doubled. In the case of (B) method, the accuracy of calculation after artificial neural network compression decreased by 1%, but in the case of (C) method, it decreased by 0.46%. That is, it can be seen from the experimental results of FIG. 5(a) that the (c) method has a higher compression rate and a calculation accuracy after compression of the artificial neural network than the (a) and (b) methods, respectively.
도 6은 본 개시의 일 실시 예에 따른, 전자 장치(100)의 제어 방법을 설명하기 위한 순서도이다.6 is a flowchart illustrating a control method of the electronic device 100 according to an embodiment of the present disclosure.
우선, 전자 장치(100)는 복수의 레이어를 포함하는 인공 신경망 중 제1 레이어에 학습 가능한 함수를 포함하는 제2 레이어를 연결할 수 있다(S610). 일 실시 예로, 전자 장치(100)는 학습 가능한 함수를 포함하는 레이어를 인공 신경망에 포함된 레이어 모두에 각각 연결할 수 있다. 또 다른 실시 예로, 채널의 크기를 감소하고자 하는 레이어를 선택하는 사용자 명령이 입력되면, 전자 장치(100)는 선택된 레이어에 학습 가능한 함수를 포함하는 레이어를 연결할 수 있다. 학습 가능한 함수는 0 또는 1을 출력하는 제1 함수에 미분 가능한 제2 함수를 더한 함수이고, 제2 함수는 미분 가능한 함수와 기설정된 기울기(gradient)를 가지는 함수를 곱한 함수이다. 함수의 수학적 특성에 대해서는 도 4를 참조하여 설명하였으므로 중복되는 설명은 생략하도록 한다. First, the electronic device 100 may connect a second layer including a learnable function to a first layer of an artificial neural network including a plurality of layers (S610). As an embodiment, the electronic device 100 may connect layers including learnable functions to all layers included in the artificial neural network, respectively. As another embodiment, when a user command for selecting a layer to reduce the size of a channel is input, the electronic device 100 may connect a layer including a learnable function to the selected layer. The learnable function is a function of adding a second function that can be differentiated to a first function that outputs 0 or 1, and the second function is a function of multiplying a function having a preset gradient and a function that can be differentiated. Since the mathematical properties of the function have been described with reference to FIG. 4, redundant description will be omitted.
전자 장치(100)는 인공 신경망을 학습시켜 제2 레이어에 포함되어 있는 파라미터 값을 갱신할 수 있다(S620). 구체적으로, 전자 장치(100)는 제1 레이어의 출력 데이터에 함수 값을 채널 별로 곱하여 제2 레이어의 출력 데이터를 획득하고, 획득한 제2 레이어의 출력 데이터를 바탕으로 손실 함수를 생성하고, 생성된 손실 함수의 최소 함수 값을 출력하는 파라미터를 획득할 수 있다. 예를 들면, 전자 장치(100)는 손실 함수에 확률적 경사 하강법을 적용하여 손실 함수의 최소 함수 값을 출력하는 파라미터를 획득하고, 기존의 파라미터를 획득한 파라미터로 갱신할 수 있다.The electronic device 100 may learn the artificial neural network and update the parameter values included in the second layer (S620). Specifically, the electronic device 100 obtains the output data of the second layer by multiplying the output data of the first layer by the function value for each channel, and generates and generates a loss function based on the obtained output data of the second layer. A parameter that outputs the minimum function value of the lost function can be obtained. For example, the electronic device 100 may obtain a parameter outputting the minimum function value of the loss function by applying a stochastic gradient descent method to the loss function, and update the existing parameter with the acquired parameter.
그리고, 전자 장치(100)는 학습 가능한 함수에 갱신된 파라미터 값을 입력하여 함수 값을 획득할 수 있다(S630). 그리고, 전자 장치(100)는 획득한 함수 값을 바탕으로 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신할 수 있다(S640). 일 실시 예로, 갱신된 파라미터 값이 음수인 경우, 전자 장치(100)는 학습 가능한 함수에 음수인 파라미터 값을 입력하여 함수 값 0을 획득하고, 파라미터에 대응되는 제1 레이어의 커널을 제거할 수 있다. 예를 들면, 학습 가능한 함수에 입력한 음수인 파라미터가 W1,i인 경우, 전자 장치(100)는 함수 값 0을 획득하고 제1 레이어의 i번째 채널을 제거할 수 있다. 만약, 학습 가능한 함수에 입력한 양수인 파라미터가 W1,i인 경우, 전자 장치(100)는 함수 값 1을 획득하고 제1 레이어의 i번째 채널은 그대로 유지할 수 있다. Then, the electronic device 100 may obtain the function value by inputting the updated parameter value to the learnable function (S630). Then, the electronic device 100 may update at the third layer by removing at least one channel among the plurality of channels included in the first layer based on the obtained function value (S640). In an embodiment, when the updated parameter value is negative, the electronic device 100 may obtain a function value 0 by inputting a negative parameter value into the learnable function, and remove the kernel of the first layer corresponding to the parameter. have. For example, when the negative parameter input to the learnable function is W 1,i , the electronic device 100 may acquire the function value 0 and remove the i-th channel of the first layer. If the positive parameter input to the learnable function is W 1,i , the electronic device 100 may acquire the function value 1 and maintain the i-th channel of the first layer.
그리고, 전자 장치(100)는 제1 레이어에 부가된 제2 레이어를 제거하고, 함수 값을 바탕으로 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거함으로써, 제1 레이어로부터 채널 프루닝된 제3 레이어을 획득할 수 있다. 다만, 이는 일 실시 예이며 제1 레이어를 제3 레이어로 갱신한 뒤에 제2 레이어를 제거할 수 있다.Then, the electronic device 100 removes the second layer added to the first layer, and removes at least one channel among the plurality of channels included in the first layer based on the function value, thereby removing the channel layer from the first layer. A third layer can be obtained. However, this is an embodiment and the second layer may be removed after updating the first layer to the third layer.
한편, 본 개시의 다양한 실시 예가 첨부된 도면을 참조하여 기재된다. 그러나, 이는 본 개시에 기재된 기술을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 개시의 실시 예의 다양한 변경(modifications), 균등물(equivalents), 및/또는 대체물(alternatives)을 포함하는 것으로 이해되어야 한다. 도면의 설명과 관련하여, 유사한 구성요소에 대해서는 유사한 참조 부호가 사용될 수 있다.Meanwhile, various embodiments of the present disclosure are described with reference to the accompanying drawings. However, this is not intended to limit the technology described in this disclosure to specific embodiments, and it should be understood that it includes various modifications, equivalents, and/or alternatives of embodiments of the present disclosure. . In connection with the description of the drawings, similar reference numerals may be used for similar elements.
본 개시에서, "가진다," "가질 수 있다," "포함한다," 또는 "포함할 수 있다" 등의 표현은 해당 특징(예: 수치, 기능, 동작, 또는 부품 등의 구성요소)의 존재를 가리키며, 추가적인 특징의 존재를 배제하지 않는다.In the present disclosure, expressions such as “have,” “can have,” “includes,” or “can include,” include the presence of a corresponding feature (eg, a component such as a numerical value, function, operation, or part). And does not exclude the presence of additional features.
본 개시에서, "A 또는 B," "A 또는/및 B 중 적어도 하나," 또는 "A 또는/및 B 중 하나 또는 그 이상"등의 표현은 함께 나열된 항목들의 모든 가능한 조합을 포함할 수 있다. 예를 들면, "A 또는 B," "A 및 B 중 적어도 하나," 또는 "A 또는 B 중 적어도 하나"는, (1) 적어도 하나의 A를 포함, (2) 적어도 하나의 B를 포함, 또는 (3) 적어도 하나의 A 및 적어도 하나의 B 모두를 포함하는 경우를 모두 지칭할 수 있다.In the present disclosure, expressions such as “A or B,” “at least one of A or/and B,” or “one or more of A or/and B”, etc. may include all possible combinations of the items listed together. . For example, “A or B,” “at least one of A and B,” or “at least one of A or B,” (1) includes at least one A, (2) includes at least one B, Or (3) all cases including both at least one A and at least one B.
본 개시에서 사용된 "제1," "제2," "첫째," 또는 "둘째,"등의 표현들은 다양한 구성요소들을, 순서 및/또는 중요도에 상관없이 수식할 수 있고, 한 구성요소를 다른 구성요소와 구분하기 위해 사용될 뿐 해당 구성요소들을 한정하지 않는다. Expressions such as "first," "second," "first," or "second," as used in the present disclosure may modify various components, regardless of order and/or importance, and denote one component. It is used to distinguish from other components, but does not limit the components.
어떤 구성요소(예: 제1 구성요소)가 다른 구성요소(예: 제2 구성요소)에 "(기능적으로 또는 통신적으로) 연결되어((operatively or communicatively) coupled with/to)" 있다거나 "접속되어(connected to)" 있다고 언급된 때에는, 상기 어떤 구성요소가 상기 다른 구성요소에 직접적으로 연결되거나, 다른 구성요소(예: 제3 구성요소)를 통하여 연결될 수 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소(예: 제1 구성요소)가 다른 구성요소(예: 제2 구성요소)에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 상기 어떤 구성요소와 상기 다른 구성요소 사이에 다른 구성요소(예: 제 3 구성요소)가 존재하지 않는 것으로 이해될 수 있다.Some component (eg, first component) is "(functionally or communicatively) coupled with/to" another component (eg, second component), or " When referred to as "connected to", it should be understood that any of the above components may be directly connected to the other component or may be connected through another component (eg, a third component). On the other hand, when it is mentioned that a component (eg, the first component) is “directly connected” or “directly connected” to another component (eg, the second component), the component and the component It can be understood that there are no other components (eg, the third component) between the other components.
본 개시에서 사용된 표현 "~하도록 구성된(또는 설정된)(configured to)"은 상황에 따라, 예를 들면, "~에 적합한(suitable for)," "~하는 능력을 가지는(having the capacity to)," "~하도록 설계된(designed to)," "~하도록 변경된(adapted to)," "~하도록 만들어진(made to)," 또는 "~를 할 수 있는(capable of)"과 바꾸어 사용될 수 있다. 용어 "~하도록 구성된(또는 설정된)"은 하드웨어적으로 "특별히 설계된(specifically designed to)" 것만을 반드시 의미하지 않을 수 있다. 대신, 어떤 상황에서는, "~하도록 구성된 장치"라는 표현은, 그 장치가 다른 장치 또는 부품들과 함께 "~할 수 있는" 것을 의미할 수 있다. 예를 들면, 문구 "A, B, 및 C를 수행하도록 구성된(또는 설정된) 부프로세서"는 해당 동작을 수행하기 위한 전용 프로세서(예: 임베디드 프로세서), 또는 메모리 장치에 저장된 하나 이상의 소프트웨어 프로그램들을 실행함으로써, 해당 동작들을 수행할 수 있는 범용 프로세서(generic-purpose processor)(예: CPU 또는 application processor)를 의미할 수 있다.The expression "configured to" as used in the present disclosure may have, depending on the situation, for example, "having the capacity to" ," "designed to," "adapted to," "made to," or "capable of" can be used interchangeably. The term "configured (or set) to" may not necessarily mean only "specifically designed to" in hardware. Instead, in some situations, the expression "device configured to" may mean that the device "can" with other devices or parts. For example, the phrase “subprocessor configured (or set) to perform A, B, and C” executes a dedicated processor (eg, an embedded processor) to perform the operation, or one or more software programs stored in the memory device. By doing so, it may mean a general-purpose processor (eg, a CPU or application processor) capable of performing the corresponding operations.
본 개시의 다양한 실시 예들에 따른 전자 장치는, 예를 들면, 스마트폰, 태블릿 PC, 데스크탑 PC, 랩탑 PC, 넷북 컴퓨터, 서버, PDA, 의료기기, 또는 웨어러블 장치 중 적어도 하나를 포함할 수 있다. 어떤 실시 예들에서, 전자 장치는, 예를 들면, 텔레비전, 냉장고, 에어컨, 공기 청정기, 셋톱 박스, 미디어 박스(예: 삼성 HomeSyncTM, 애플TVTM, 또는 구글 TVTM) 중 적어도 하나를 포함할 수 있다.An electronic device according to various embodiments of the present disclosure may include, for example, at least one of a smart phone, a tablet PC, a desktop PC, a laptop PC, a netbook computer, a server, a PDA, a medical device, or a wearable device. In some embodiments, the electronic device may include at least one of a television, a refrigerator, an air conditioner, an air purifier, a set top box, a media box (eg, Samsung HomeSyncTM, Apple TVTM, or Google TVTM).
한편, 사용자라는 용어는 전자 장치를 사용하는 사람 또는 전자 장치를 사용하는 장치(예: 인공지능 전자 장치)를 지칭할 수 있다. 이하에서는 도면을 참조하여 본 개시에 대해 더욱 상세히 설명하도록 한다.Meanwhile, the term user may refer to a person using an electronic device or a device using an electronic device (eg, an artificial intelligence electronic device). Hereinafter, the present disclosure will be described in more detail with reference to the drawings.
본 개시의 다양한 실시 예들은 기기(machine)(예: 컴퓨터)로 읽을 수 있는 저장 매체(machine-readable storage media에 저장된 명령어를 포함하는 소프트웨어로 구현될 수 있다. 기기는, 저장 매체로부터 저장된 명령어를 호출하고, 호출된 명령어에 따라 동작이 가능한 장치로서, 개시된 실시 예들에 따른 전자 장치(예: 전자 장치(100))를 포함할 수 있다. 상기 명령이 프로세서에 의해 실행될 경우, 프로세서가 직접, 또는 상기 프로세서의 제어하에 다른 구성요소들을 이용하여 상기 명령에 해당하는 기능을 수행할 수 있다. 명령은 컴파일러 또는 인터프리터에 의해 생성 또는 실행되는 코드를 포함할 수 있다. 기기로 읽을 수 있는 저장매체는, 비일시적(non-transitory) 저장매체의 형태로 제공될 수 있다. 여기서, '비일시적'은 저장매체가 신호(signal)를 포함하지 않으며 실재(tangible)한다는 것을 의미할 뿐 데이터가 저장매체에 반영구적 또는 임시적으로 저장됨을 구분하지 않는다.Various embodiments of the present disclosure may be implemented with software including instructions stored in a machine (eg, computer) readable storage media. As a device that can be called and operated according to the called command, it may include an electronic device (eg, the electronic device 100) according to the disclosed embodiments. When the command is executed by a processor, the processor may directly or Under the control of the processor, other components may be used to perform functions corresponding to the command, which may include code generated or executed by a compiler or interpreter. It can be provided in the form of a non-transitory storage medium, where'non-transitory' means that the storage medium does not contain a signal and is tangible, but the data is semi-permanent. Or, it does not distinguish between temporary storage.
일 실시 예에 따르면, 본 개시에 개시된 다양한 실시 예들에 따른 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다. 컴퓨터 프로그램 제품은 상품으로서 판매자 및 구매자 간에 거래될 수 있다. 컴퓨터 프로그램 제품은 기기로 읽을 수 있는 저장 매체(예: compact disc read only memory (CD-ROM))의 형태로, 또는 어플리케이션 스토어(예: 플레이 스토어TM)를 통해 온라인으로 배포될 수 있다. 온라인 배포의 경우에, 컴퓨터 프로그램 제품의 적어도 일부는 제조사의 서버, 어플리케이션 스토어의 서버, 또는 중계 서버의 메모리와 같은 저장 매체에 적어도 일시 저장되거나, 임시적으로 생성될 수 있다.According to an embodiment, a method according to various embodiments disclosed in the present disclosure may be provided as being included in a computer program product. Computer program products can be traded between sellers and buyers as products. The computer program product may be distributed online in the form of a device-readable storage medium (eg compact disc read only memory (CD-ROM)) or through an application store (eg Play StoreTM). In the case of online distribution, at least a portion of the computer program product may be temporarily stored at least temporarily on a storage medium such as a memory of a manufacturer's server, an application store's server, or a relay server, or may be temporarily generated.
다양한 실시 예들에 따른 구성 요소(예: 모듈 또는 프로그램) 각각은 단수 또는 복수의 개체로 구성될 수 있으며, 전술한 해당 서브 구성 요소들 중 일부 서브 구성 요소가 생략되거나, 또는 다른 서브 구성 요소가 다양한 실시 예에 더 포함될 수 있다. 대체적으로 또는 추가적으로, 일부 구성 요소들(예: 모듈 또는 프로그램)은 하나의 개체로 통합되어, 통합되기 이전의 각각의 해당 구성 요소에 의해 수행되는 기능을 동일 또는 유사하게 수행할 수 있다. 다양한 실시 예들에 따른, 모듈, 프로그램 또는 다른 구성 요소에 의해 수행되는 동작들은 순차적, 병렬적, 반복적 또는 휴리스틱하게 실행되거나, 적어도 일부 동작이 다른 순서로 실행되거나, 생략되거나, 또는 다른 동작이 추가될 수 있다.Each component (eg, module or program) according to various embodiments may be composed of a singular or a plurality of entities, and some of the aforementioned sub-components may be omitted, or other sub-components may be various. It may be further included in the embodiment. Alternatively or additionally, some components (eg, modules or programs) can be integrated into one entity, performing the same or similar functions performed by each corresponding component before being integrated. According to various embodiments, operations performed by a module, program, or other component may be sequentially, parallelly, repeatedly, or heuristically executed, at least some operations may be executed in a different order, omitted, or other operations may be added. Can.

Claims (15)

  1. 전자 장치에 있어서,In the electronic device,
    적어도 하나의 인스트럭션(instruction)을 저장하는 메모리; 및A memory that stores at least one instruction; And
    상기 메모리와 연결되어 상기 전자 장치를 제어하는 프로세서;를 포함하고,And a processor connected to the memory to control the electronic device.
    상기 프로세서는, 상기 적어도 하나의 인스트럭션을 실행함으로써,The processor, by executing the at least one instruction,
    복수의 레이어를 포함하는 인공 신경망(Neural Network) 중 제1 레이어에 학습 가능한 함수를 포함하는 제2 레이어를 부가(append)하고,A second layer including a learnable function is added to a first layer of an artificial neural network including a plurality of layers,
    상기 인공 신경망을 학습시켜 상기 제2 레이어에 포함되어 있는 파라미터 값을 갱신하고,The artificial neural network is trained to update parameter values included in the second layer,
    상기 학습 가능한 함수에 상기 갱신된 파라미터 값을 입력하여 함수 값을 획득하고,Acquire the function value by inputting the updated parameter value into the learnable function,
    상기 획득한 함수 값을 바탕으로 상기 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 상기 제1 레이어를 제3 레이어로 갱신하는 전자 장치.An electronic device that updates the first layer to a third layer by removing at least one channel among a plurality of channels included in the first layer based on the obtained function value.
  2. 제1항에 있어서,According to claim 1,
    상기 학습 가능한 함수는 0 또는 1을 출력하는 제1 함수에 미분 가능한 제2 함수를 더한 함수이고,The learnable function is a function of adding a second function that can be differentiated to a first function that outputs 0 or 1,
    상기 제2 함수는 미분 가능한 함수와 기설정된 기울기(gradient)를 가지는 함수를 곱한 함수인 것을 특징으로 하는 전자 장치.The second function is a function of multiplying a function having a differentiable function and a function having a predetermined gradient.
  3. 제1항에 있어서,According to claim 1,
    상기 프로세서는,The processor,
    상기 제1 레이어의 출력 데이터에 상기 함수 값을 채널 별(channel-wise)로 곱하여 상기 제2 레이어의 출력 데이터를 획득하고,The output data of the second layer is obtained by multiplying the output data of the first layer by the function value channel-wise,
    상기 제1 레이어의 출력 데이터 및 상기 제2 레이어의 출력 데이터를 바탕으로 손실 함수(loss function)을 생성하고,A loss function is generated based on the output data of the first layer and the output data of the second layer,
    상기 손실 함수의 최소 함수 값을 출력하는 파라미터를 획득하는 전자 장치.An electronic device that acquires a parameter outputting a minimum function value of the loss function.
  4. 제3항에 있어서,According to claim 3,
    상기 프로세서는,The processor,
    상기 손실 함수에 확률적 경사 하강법(Stochastic Gradient Descent)을 적용하여 상기 손실 함수의 최소 함수 값을 출력하는 파라미터를 획득하는 전자 장치An electronic device that acquires a parameter outputting a minimum function value of the loss function by applying a stochastic gradient descent method to the loss function
  5. 제3항에 있어서,According to claim 3,
    상기 프로세서는,The processor,
    상기 제2 레이어에 포함되어 있는 파라미터를 상기 손실 함수의 최소 함수 값을 출력하는 파라미터로 갱신하는 전자 장치.An electronic device that updates a parameter included in the second layer with a parameter that outputs a minimum function value of the loss function.
  6. 제5항에 있어서,The method of claim 5,
    상기 프로세서는,The processor,
    상기 갱신된 파라미터 값이 음수인 경우, 상기 학습 가능한 함수에 상기 음수인 파라미터 값을 입력하여 함수 값 0을 획득하고,If the updated parameter value is negative, input the negative parameter value into the learnable function to obtain a function value 0,
    상기 갱신된 파라미터 값이 양수인 경우, 상기 학습 가능한 함수에 상기 양수인 파라미터 값을 입력하여 함수 값 1을 획득하는 전자 장치.If the updated parameter value is a positive number, the electronic device obtains a function value 1 by inputting the positive parameter value to the learnable function.
  7. 제5항에 있어서,The method of claim 5,
    상기 프로세서는,The processor,
    상기 획득한 함수 값이 0인 경우, 상기 학습 가능한 함수에 입력한 파라미터에 대응되는 상기 제1 레이어의 채널은 제거하고,When the acquired function value is 0, the channel of the first layer corresponding to the parameter input to the learnable function is removed,
    상기 획득한 함수 값이 1인 경우, 상기 학습 가능한 함수에 입력한 파라미터에 대응되는 상기 제1 레이어의 채널은 유지하는 전자 장치.When the obtained function value is 1, the electronic device maintaining the channel of the first layer corresponding to the parameter input to the learnable function.
  8. 제1항에 있어서,According to claim 1,
    상기 프로세서는,The processor,
    상기 제2 레이어를 제거하고 상기 획득한 함수 값을 바탕으로 상기 제1 레이어의 채널을 제거하여 제3 레이어로 갱신하는 전자 장치.An electronic device that removes the second layer and removes the channel of the first layer based on the obtained function value, thereby updating the third layer.
  9. 제1항에 있어서,According to claim 1,
    상기 프로세서는,The processor,
    상기 학습 가능한 함수에 상기 갱신된 파라미터 값을 입력하여 함수 값을 획득하고,Acquire the function value by inputting the updated parameter value into the learnable function,
    획득한 함수 값을 바탕으로 상기 제1 레이어의 제1 커널의 가중치를 변경하고,Change the weight of the first kernel of the first layer based on the obtained function value,
    상기 제1 레이어의 제1 커널을 상기 변경된 가중치를 포함하는 제2 커널로 갱신하는 전자 장치.An electronic device that updates the first kernel of the first layer to a second kernel including the changed weight.
  10. 제9항에 있어서,The method of claim 9,
    상기 프로세서는,The processor,
    상기 획득한 함수 값이 0인 경우, 상기 학습 가능한 함수에 입력한 파라미터에 대응되는 상기 제1 레이어의 제1 커널의 가중치를 0으로 변경하고,When the obtained function value is 0, the weight of the first kernel of the first layer corresponding to the parameter input to the learnable function is changed to 0,
    상기 획득한 함수 값이 1인 경우, 상기 학습 가능한 함수에 입력한 파라미터에 대응되는 상기 제1 레이어의 제1 커널의 가중치는 그대로 유지하는 전자 장치.When the obtained function value is 1, the electronic device maintaining the weight of the first kernel of the first layer corresponding to the parameter input to the learnable function.
  11. 전자 장치의 제어 방법에 있어서,In the control method of the electronic device,
    복수의 레이어를 포함하는 인공 신경망(Neural Network) 중 제1 레이어에 학습 가능한 함수를 포함하는 제2 레이어를 부가(append)하는 단계;Adding a second layer including a learnable function to a first layer of an artificial neural network including a plurality of layers;
    상기 인공 신경망을 학습시켜 상기 제2 레이어에 포함되어 있는 파라미터 값을 갱신하는 단계;Updating the parameter values included in the second layer by learning the artificial neural network;
    상기 학습 가능한 함수에 상기 갱신된 파라미터 값을 입력하여 함수 값을 획득하는 단계; 및Obtaining a function value by inputting the updated parameter value into the learnable function; And
    상기 획득한 함수 값을 바탕으로 상기 제1 레이어에 포함된 복수의 채널 중 적어도 하나의 채널을 제거하여 제3 레이어로 갱신하는 단계;를 포함하는 전자 장치의 제어 방법.And removing at least one channel from among a plurality of channels included in the first layer and updating to a third layer based on the acquired function value.
  12. 제11항에 있어서,The method of claim 11,
    상기 학습 가능한 함수는 0 또는 1을 출력하는 제1 함수에 미분 가능한 제2 함수를 더한 함수이고,The learnable function is a function of adding a second function that can be differentiated to a first function that outputs 0 or 1,
    상기 제2 함수는 미분 가능한 함수와 기설정된 기울기(gradient)를 가지는 함수를 곱한 함수인 것을 특징으로 하는 전자 장치.The second function is a function of multiplying a function having a differentiable function and a function having a predetermined gradient.
  13. 제11항에 있어서,The method of claim 11,
    상기 파라미터 값을 갱신하는 단계는,In the step of updating the parameter value,
    상기 제1 레이어의 출력 데이터에 상기 함수 값을 채널 별(channel-wise)로 곱하여 상기 제2 레이어의 출력 데이터를 획득하는 단계;Obtaining output data of the second layer by multiplying the output value of the first layer by a channel-wise function value;
    상기 제1 레이어의 출력 데이터 및 상기 제2 레이어의 출력 데이터를 바탕으로 손실 함수(loss function)을 생성하는 단계; 및Generating a loss function based on the output data of the first layer and the output data of the second layer; And
    상기 손실 함수의 최소 함수 값을 출력하는 파라미터를 획득하는 단계;를 포함하는 전자 장치의 제어 방법.And obtaining a parameter outputting a minimum function value of the loss function.
  14. 제13항에 있어서,The method of claim 13,
    상기 파라미터 값을 갱신하는 단계는,In the step of updating the parameter value,
    상기 손실 함수에 확률적 경사 하강법(Stochastic Gradient Descent)을 적용하여 상기 손실 함수의 최소 함수 값을 출력하는 파라미터를 획득하는 단계;를 포함하는 전자 장치의 제어 방법.And obtaining a parameter outputting a minimum function value of the loss function by applying a stochastic gradient descent method to the loss function.
  15. 제13항에 있어서,The method of claim 13,
    상기 파라미터 값을 갱신하는 단계는,In the step of updating the parameter value,
    상기 제2 레이어에 포함되어 있는 파라미터를 상기 손실 함수의 최소 함수 값을 출력하는 파라미터로 갱신하는 단계;를 포함하는 전자 장치의 제어 방법.And updating a parameter included in the second layer with a parameter outputting a minimum function value of the loss function.
PCT/KR2019/016235 2019-01-17 2019-11-25 Electronic device and control method therefor WO2020149511A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/286,982 US20210383190A1 (en) 2019-01-17 2019-11-25 Electronic device and control method therefor
EP19910158.5A EP3852017A4 (en) 2019-01-17 2019-11-25 Electronic device and control method therefor

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
US201962793497P 2019-01-17 2019-01-17
US62/793,497 2019-01-17
KR10-2019-0118918 2019-09-26
KR1020190118918A KR20200089588A (en) 2019-01-17 2019-09-26 Electronic device and method for controlling the electronic device thereof

Publications (1)

Publication Number Publication Date
WO2020149511A1 true WO2020149511A1 (en) 2020-07-23

Family

ID=71614535

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2019/016235 WO2020149511A1 (en) 2019-01-17 2019-11-25 Electronic device and control method therefor

Country Status (1)

Country Link
WO (1) WO2020149511A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170169326A1 (en) * 2015-12-11 2017-06-15 Baidu Usa Llc Systems and methods for a multi-core optimized recurrent neural network
KR20170092595A (en) * 2014-11-26 2017-08-11 큐리어스 에이아이 오와이 Neural network structure and a method therto
KR20180045635A (en) * 2016-10-26 2018-05-04 삼성전자주식회사 Device and method to reduce neural network
KR20180075368A (en) * 2016-12-26 2018-07-04 한국과학기술원 Dropout method for improving training speed and memory efficiency on artificial neural network and learning method based on the same
KR20180134740A (en) * 2017-06-09 2018-12-19 한국과학기술원 Electronic apparatus and method for optimizing of trained model

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20170092595A (en) * 2014-11-26 2017-08-11 큐리어스 에이아이 오와이 Neural network structure and a method therto
US20170169326A1 (en) * 2015-12-11 2017-06-15 Baidu Usa Llc Systems and methods for a multi-core optimized recurrent neural network
KR20180045635A (en) * 2016-10-26 2018-05-04 삼성전자주식회사 Device and method to reduce neural network
KR20180075368A (en) * 2016-12-26 2018-07-04 한국과학기술원 Dropout method for improving training speed and memory efficiency on artificial neural network and learning method based on the same
KR20180134740A (en) * 2017-06-09 2018-12-19 한국과학기술원 Electronic apparatus and method for optimizing of trained model

Similar Documents

Publication Publication Date Title
WO2019037700A1 (en) Speech emotion detection method and apparatus, computer device, and storage medium
CN111144124B (en) Training method of machine learning model, intention recognition method, and related device and equipment
CN113593611B (en) Voice classification network training method and device, computing equipment and storage medium
CN109961041B (en) Video identification method and device and storage medium
WO2020222384A1 (en) Electronic device and control method therefor
EP3852017A1 (en) Electronic device and control method therefor
WO2021042857A1 (en) Processing method and processing apparatus for image segmentation model
JP7438303B2 (en) Deep learning model training methods, natural language processing methods and devices, electronic devices, storage media and computer programs
CN113505206B (en) Information processing method and device based on natural language reasoning and electronic equipment
JP2022158735A (en) Learning device, learning method, learning program, retrieval device, retrieval method, and retrieval program
EP3620982A1 (en) Sample processing method and device
CN113765928A (en) Internet of things intrusion detection method, system, equipment and medium
CN110827799B (en) Method, apparatus, device and medium for processing voice signal
CN108847251B (en) Voice duplicate removal method, device, server and storage medium
WO2022246986A1 (en) Data processing method, apparatus and device, and computer-readable storage medium
US11366984B1 (en) Verifying a target object based on confidence coefficients generated by trained models
CN111312223B (en) Training method and device of voice segmentation model and electronic equipment
JP2022158736A (en) Learning device, learning method, and learning program
CN111653261A (en) Speech synthesis method, speech synthesis device, readable storage medium and electronic equipment
WO2020149511A1 (en) Electronic device and control method therefor
CN111507218A (en) Matching method and device of voice and face image, storage medium and electronic equipment
CN110570877A (en) Sign language video generation method, electronic device and computer readable storage medium
EP4020327A2 (en) Method and apparatus for training data processing model, electronic device and storage medium
CN116957006A (en) Training method, device, equipment, medium and program product of prediction model
WO2021045434A1 (en) Electronic device and control method therefor

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19910158

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019910158

Country of ref document: EP

Effective date: 20210414

NENP Non-entry into the national phase

Ref country code: DE