Patent Publication Number: US-11663462-B2

Title: Machine learning method and machine learning device

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
     This application claims the priority benefit of Taiwan application serial no. 107123670, filed on Jul. 9, 2018. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification. 
     BACKGROUND OF THE INVENTION 
     Field of the Invention 
     The invention is related to a machine learning method and a machine learning device, and particularly to a machine learning method and a machine learning device based on sparse coding convolution neural network. 
     Description of Related Art 
     Deep learning is popular among the field of machine learning. When continuing voice signal and music signal is processed, the signals may be classified after passing through a convolutional layer of a convolution neural network, a pooling layer and a fully connected layer. However, typical convolution neural network has shortcomings such as high time complexity and low robustness, and therefore more efforts are needed from practitioners of the field to find out how to reduce time complexity required for execution of convolutional neural network and increasing robustness of convolutional neural network. 
     SUMMARY OF THE INVENTION 
     The invention provides a machine learning method and a machine learning device, which are not only capable of comprehending and recognizing abstract concept of target but also capable of associating objects that have been seen through retrieving memory, thereby increasing robustness of network while reducing time complexity required for network execution through projection of the dictionary atom. 
     The invention provides a machine learning method, which integrates convolutional neural network and sparse coding algorithm. The machine learning method includes the following steps: receiving an input signal and performing normalization on the input signal; transmitting the normalized input signal to a convolutional layer; and adding a sparse coding layer after the convolutional layer. The sparse coding layer uses dictionary atoms to reconstruct signals on a projection of the normalized input signal passing through the convolutional layer, and the sparse coding layer receives a mini-batch input to refresh the dictionary atoms. 
     According to an embodiment of the invention, the step of receiving an input signal and performing normalization on the input signal includes converting the input signal into a time-frequency diagram; using polynomial to perform fitting of frequency-wise strength on the time-frequency diagram; and performing normalization on the width of the fitting result and re-sampling. 
     According to an embodiment of the invention, a coefficient corresponding to the dictionary atom is a real number ranging from −1 to 1. 
     According to an embodiment of the invention, the sparse coding layer is located after the fully connected layer. The sparse coding layer performs sparse non-negative coding on the dictionary that is trained through feature vector set, and classifies the type of dictionary atom having a minimum residual or a maximum coefficient. 
     According to an embodiment of the invention, the sparse coding layer is located before the fully connected layer. The sparse coding layer trains the dictionary respectively with respect to a plurality of convolutional charts of a plurality of channels output by the convolutional layer, uses sparse non-negative coding algorithm to obtain the coefficient corresponding to the dictionary atom, and classifies the type of dictionary atom through channel-wise voting. 
     According to an embodiment of the invention, the sparse coding layer uses membership function to calculate truth of different channels with respect to different types of dictionary atom, and performs channel-wise voting according to the truth. 
     According to an embodiment of the invention, the membership function includes a true positive parameter and a true negative parameter. 
     According to an embodiment of the invention, the membership function includes a precision parameter and a recall parameter. 
     According to an embodiment of the invention, the sparse coding layer includes a dictionary learning portion and a reconstruction portion. When the residual of the dictionary learning portion is smaller than a threshold value, the reconstruction portion uses product of the dictionary and the coefficient corresponding to the dictionary atom to output the reconstructed data. 
     According to an embodiment of the invention, the sparse coding layer refreshes the dictionary atom according to the feature of mini-batch. 
     The invention provides a machine learning device, including a processor and a memory. The memory is coupled to the processor. The processor receives an input signal and performs normalization on the input signal; transmits the normalized input signal to a convolutional layer; and adds a sparse coding layer after the convolutional layer. The sparse coding layer uses dictionary atoms to reconstruct signals on a projection of the normalized input signal passing through the convolutional layer, and the sparse coding layer receives a mini-batch input to refresh the dictionary atoms. 
     According to an embodiment of the invention, the processor converts the input signal into a time-frequency diagram; uses polynomial to perform fitting of frequency-wise strength on the time-frequency diagram; and performs normalization on the width of the fitting result and re-samples. 
     According to an embodiment of the invention, a coefficient corresponding to the dictionary atom is a real number ranging from −1 to 1. 
     According to an embodiment of the invention, the sparse coding layer is located after the fully connected layer. The processor performs sparse non-negative coding on the dictionary that is trained through feature vector set in the sparse coding layer, and classifies the type of dictionary atom having a minimum residual or a maximum coefficient. 
     According to an embodiment of the invention, the sparse coding layer is located before the fully connected layer. The processor trains the dictionary respectively with respect to a plurality of convolutional charts of a plurality of channels output by the convolutional layer in the sparse coding layer, uses sparse non-negative coding algorithm to obtain the coefficient corresponding to the dictionary atom, and classifies the type of dictionary atom through channel-wise voting. 
     According to an embodiment of the invention, the processor uses membership function to calculate truth of different channels with respect to different types of dictionary atom in the sparse coding layer, and performs channel-wise voting according to the truth. 
     According to an embodiment of the invention, the membership function includes a true positive parameter and a true negative parameter. 
     According to an embodiment of the invention, the membership function includes a precision parameter and a recall parameter. 
     According to an embodiment of the invention, the sparse coding layer includes a dictionary learning portion and a reconstruction portion. When the residual of the dictionary learning portion is smaller than a threshold value, the processor uses product of the dictionary and the coefficient corresponding to the dictionary atom to output the reconstructed data in the reconstruction portion. 
     According to an embodiment of the invention, the sparse coding layer refreshes the dictionary atom according to the feature of mini-batch. 
     Based on the above, the machine learning method and the machine learning device of the invention perform normalization on the input signal and add the sparse coding layer after the convolutional layer, use the dictionary atoms to reconstruct signals on the projection of the normalized input signal passing through the convolutional layer, thereby reducing the time complexity of network. The invention also uses the sparse coding layer to receive a mini-batch input to refresh dictionary atoms, thereby completing training of dictionary and reconstruction of data. Additionally, the invention further provides multi-channel sparse coding capable of directly taking into consideration of abstract feature learned through convolutional weight of different channels. 
     In order to make the aforementioned features and advantages of the invention more comprehensible, embodiments accompanying figures are described in detail below. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG.  1    is a block diagram of a machine learning device according to an embodiment of the invention. 
         FIG.  2    is a schematic view of performing normalization on signals according to an embodiment of the invention. 
         FIG.  3    is a schematic view of a sparse coding algorithm according to an embodiment of the invention. 
         FIG.  4    is a schematic view of a sparse non-negative coding algorithm according to an embodiment of the invention. 
         FIG.  5    is a schematic view of a sparse binary coding algorithm according to an embodiment of the invention. 
         FIG.  6    is a schematic view of a convolutional neural network according to an embodiment of the invention. 
         FIG.  7    is a schematic view of a sparse coding convolutional neural network according to an embodiment of the invention. 
         FIG.  8    is a schematic view of multi-channel sparse coding convolutional neural network according to an embodiment of the invention. 
         FIG.  9    is a schematic view of a sparse coding layer of multi-channel sparse coding convolutional neural network according to an embodiment of the invention. 
         FIG.  10    is a schematic view of an algorithm of training a sparse coding layer according to an embodiment of the invention. 
         FIG.  11    is a flowchart of a machine learning method according to an embodiment of the invention. 
     
    
    
     DESCRIPTION OF EMBODIMENTS 
       FIG.  1    is a block diagram of a machine learning device according to an embodiment of the invention. 
     Referring to  FIG.  1   , a machine learning device  100  of the invention may include a processor  110  and a memory  120 . The memory  120  is coupled to the processor  110 . The machine learning device  100  may be an electronic device such as a server, a personal computer, a mobile device, a tablet PC and so on. The invention provides no limitation to the type of the machine learning device  100 . 
     The processor  110  may be a central processing unit (CPU), or other programmable general purpose or specific purpose microprocessor, a digital signal processor (DSP), a programmable controller, an application specific integrated circuit (ASIC) or other similar element or a combination of the above. 
     The memory  120  may be a fixed or a movable random access memory (RAM) in any forms, a read-only memory (ROM), a flash memory, a hard disk drive (HDD), a solid state drive (SSD) or other similar element or a combination of the above. The input device  130  may be an input element such as a keyboard, a mouse and so on. 
     According to an embodiment of the invention, the machine learning device  100  may receive an input signal (e.g., voice signal or music signal, etc.) through a communication chip (not shown), and the processor  110  executes the convolutional neural network in the memory  120  to perform learning, recognizing, and searching operations on the input signal. 
       FIG.  2    is a schematic view of performing normalization on signals according to an embodiment of the invention. 
     Referring to  FIG.  2   , in the pre-processing stage of the convolutional neural network, the processor  110  converts the input signal into a time-frequency diagram by using short-time Fourier transform (STFT), and uses the polynomial to perform fitting of frequency-wise strength on the time-frequency diagram as shown in equation (1) below:
 
( f   i   ,t )=Σ n=0   N   p   n   t   n   ,i 1,2, . . . , F   (1)
 
     Specifically, f i  is the i-th frequency bin of a spectrogram, t is time of the spectrogram, N is the degree of a polynomial function, p n  is the n-th coefficient of a polynomial function, i is the i-th frequency bin of a spectrogram, and F is the size of the spectrogram. Finally, the processor  110  performs normalization on the width of the fitting result (e.g., normalize the width as one) and fits the polynomial for re-sampling. If M sampling points are to be obtained, the time for re-sampling is as shown in equation (2) below: 
     
       
         
           
             
               
                 
                   
                     
                       T 
                       × 
                       i 
                     
                     M 
                   
                   , 
                   
                     i 
                     = 
                     1 
                   
                   , 
                   2 
                   , 
                   … 
                   ⁢ 
                   
                       
                   
                   , 
                   T 
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
     Specifically, i is the i-th frequency bin of the spectrogram, and the equation (2) denotes the spectrogram of size F by T. According to an embodiment, the invention provides a sparse coding algorithm, capable of finding a set of coefficients with respect to the dictionary such that the reconstructed data has the least error and the coefficient is the sparsest. The sparse coding solution of the embodiment is as shown in equation (3) below: 
     
       
         
           
             
               
                 
                   
                     x 
                     ^ 
                   
                   = 
                   
                     
                       arg 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           min 
                           x 
                         
                         ⁢ 
                         
                           
                              
                             
                               y 
                               - 
                               Dx 
                             
                              
                           
                           2 
                           2 
                         
                       
                     
                     + 
                     
                       γ 
                       ⁢ 
                       
                         
                            
                           x 
                            
                         
                         p 
                       
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
     Specifically, y is an input signal, D is an over-complete dictionary, γ is lagrange multiplier, and x is a coefficient corresponding to dictionary atom and p∈{0,1}. If the equation (3) is solved by adapt search, the time complexity is O(n 2 ). 
     It should be indicated that the sparse coding algorithm of the invention may be executed in the sparse coding layer, and the position of the sparse coding layer varies depending on the use of single-channel sparse coding convolutional neural network or multi-channel sparse coding convolutional neural network. For example, in the single-channel sparse coding convolutional neural network, the sparse coding layer may be disposed after the fully connected layer. In the multi-channel sparse coding convolutional neural network, the sparse coding layer may be disposed after the convolutional layer and before the fully connected layer. 
     According to another embodiment, the invention provides a sparse coding algorithm, which uses normalized dictionary atoms to reconstruct signals on the projection of the normalized input signals, and limits the coefficient as real number ranging from −1 to 1. The advantage of the sparse coding algorithm of the embodiment is that it is guaranteed that the corresponding coefficient of the selected atom set is most sparse, and it requires the least atoms to reconstruct signals. The sparse coding solution of the embodiment is as shown in equation (4) below: 
     
       
         
           
             
               
                 
                   
                     x 
                     ^ 
                   
                   = 
                   
                     
                       arg 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           min 
                           x 
                         
                         ⁢ 
                         
                           
                              
                             
                               y 
                               - 
                               
                                 
                                   proj 
                                   ⁡ 
                                   
                                     ( 
                                     D 
                                     ) 
                                   
                                 
                                 ⁢ 
                                 x 
                               
                             
                              
                           
                           2 
                           2 
                         
                       
                     
                     + 
                     
                       γ 
                       ⁢ 
                       
                         
                            
                           x 
                            
                         
                         p 
                       
                     
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
     Specifically, proj(D) [y y, d 1   , y y,d 2   , . . . , y y, d n   ], ∥y∥=1, ∥d i ∥=1, x i ∈[−1,1], (a, b) is an inner product of vector a and b,  y, d i    may be expressed as ∥y∥∥d i ∥cos(Δθ y,d     i   ) and ∥y∥=1, ∥d i ∥=1. γ is lagrange multiplier. Therefore, proj(D) may be rewritten as the equation (5) below, and the equation (4) may be rewritten as the equation (6) below. 
     
       
         
           
             
               
                 
                   
                     proj 
                     ⁡ 
                     
                       ( 
                       D 
                       ) 
                     
                   
                   = 
                   
                     [ 
                     
                       
                         y 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           cos 
                           ⁡ 
                           
                             ( 
                             
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 θ 
                                 
                                   y 
                                   , 
                                   
                                     d 
                                     1 
                                   
                                 
                               
                             
                             ) 
                           
                         
                       
                       , 
                       
                         y 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           cos 
                           ⁡ 
                           
                             ( 
                             
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 θ 
                                 
                                   y 
                                   , 
                                   
                                     d 
                                     2 
                                   
                                 
                               
                             
                             ) 
                           
                         
                       
                       , 
                       … 
                       ⁢ 
                       
                           
                       
                       , 
                       
                         y 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           cos 
                           ⁡ 
                           
                             ( 
                             
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 θ 
                                 
                                   y 
                                   , 
                                   
                                     d 
                                     n 
                                   
                                 
                               
                             
                             ) 
                           
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
             
               
                 
                   
                     x 
                     ^ 
                   
                   = 
                   
                     
                       arg 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           min 
                           x 
                         
                         ⁢ 
                         
                           
                              
                             
                               1 
                               - 
                               
                                 
                                   Θ 
                                   T 
                                 
                                 ⁢ 
                                 x 
                               
                             
                              
                           
                           2 
                           2 
                         
                       
                     
                     + 
                     
                       γ 
                       ⁢ 
                       
                         
                            
                           x 
                            
                         
                         p 
                       
                     
                   
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
           
         
       
     
     Specifically, θ y  is the angle, Δθ y  is the variation of θ y , γ is lagrange multiplier, Θ T =[cos(Δθ y,d     1   ), cos(Δθ y,d     2   ), . . . , cos(Δθ y,d     n   )], and θ∈[−π, π]. 
     Since the range of coefficient is limited within a range of −1 to 1, the degree of reconstruction of selected atom at every time does not exceed the length of projection. The coefficient of the selected atoms at every time does not exceed the coefficient of the previously selected atom. Therefore, the sparse coding of the embodiment may be solved through a greedy method. Since cosine function is an even function and the range thereof is from −1 to 1, the order of the selected atoms is like |cos(Δθ y,d     i   )| that is sorted, and the time complexity for sorting is O(n log n). However, θ d     i    may be calculated and sorted in advance. Therefore, when input signal is entered, the sorting of Δθ y,d     i   =θ y −θ d     i    may be completed within the time complexity of O(log n) (e.g., by using binary sorting), and the searching operation may be completed within the time complexity of O(n), thereby significantly reducing the time complexity as compared with the sparse coding in the foregoing embodiment. 
       FIG.  3    is a schematic view of a sparse coding algorithm according to an embodiment of the invention.  FIG.  4    is a schematic view of a sparse non-negative coding algorithm according to an embodiment of the invention.  FIG.  5    is a schematic view of a sparse binary coding algorithm according to an embodiment of the invention. 
       FIG.  3    is related to reconstruction of data, in the sparse coding algorithm of  FIG.  3   , input data and sorted dictionary are input and the selected atom and corresponding coefficient are output. 
       FIG.  4    is related to retrieval of data. In the sparse non-negative coding algorithm of  FIG.  4   , if the coefficient is limited as non-negative, x i ∈[0,1], then the order of selected atom is like sorted cos(Δθ y,d     i   ), which is equivalent to finding a cluster that is the most similar to one&#39;s own cluster on norm ball. 
       FIG.  5    is related to classification of type of atoms. In the sparse binary coding algorithm of  FIG.  5   , if the coefficient is limited as binary, x i ∈{0,1}, which is equivalent to overlay dictionary atoms to constitute an input signal. 
       FIG.  6    is a schematic view of a convolutional neural network according to an embodiment of the invention. 
     Referring to  FIG.  6   , the processor  110  receives an input signal  601  first, generates a corresponding spectrogram  602  or referred to as time-frequency diagram, and then generates a normalized input signal  603 . After undergoing through a series of convolutional neural network stage  604  (e.g., convolutional layer, pooling layer), the normalized input signal  603  is transmitted to a fully connected layer  605  and finally classified with a classifier (e.g., softmax). The classifier is as shown in equation (7) below: 
     
       
         
           
             
               
                 
                   
                     
                       loss 
                       softmax 
                     
                     ⁡ 
                     
                       ( 
                       
                         y 
                         , 
                         z 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       e 
                       
                         z 
                         y 
                       
                     
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           1 
                         
                         C 
                       
                       ⁢ 
                       
                         e 
                         
                           z 
                           i 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
           
         
       
     
     Specifically, z is the output vector, y is the label, and C is the total number of classes. The retrieval made through convolutional neural network uses an output layer of the fully connected layer to calculate distance L 2  on normalized neural code L 2  as shown in equation (8) below:
 
distance l2 ( p,q )=√{square root over (Σ i=1   n ( q   i   −p   i ) 2 )}  (8)
 
     Specifically, p and q are any two vectors. Finally, the distance may be used as basis for retrieval. 
       FIG.  7    is a schematic view of a sparse coding convolution neural network (SC-CNN) according to an embodiment of the invention. 
     Referring to  FIG.  7   , the processor  110  receives an input signal  701  first, generates a corresponding spectrogram  702  or referred to as time-frequency diagram, and then generates a normalized input signal  703 . After undergoing a series of convolutional neural network stage  704  (e.g., convolutional layer, pooling layer), the normalized input signal  703  is transmitted to a fully connected layer  705 . Finally, a dictionary  706  is used to perform sparse coding  707 , thereby performing sorting  708  with the minimum residual or maximum coefficient. 
     Specifically, in the sparse coding convolutional neural network of the embodiment, the trained data is used to perform sparse non-negative coding through the dictionary that is trained with the feature sector set obtained from the convolutional neural network, and finally the type of dictionary atoms that generates the minimum residual or obtains the maximum coefficient is classified as shown in equation (9) below: 
     
       
         
           
             
               
                 
                   
                     identity 
                     ⁡ 
                     
                       ( 
                       y 
                       ) 
                     
                   
                   = 
                   
                     arg 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         min 
                         i 
                       
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           r 
                           i 
                         
                         ⁡ 
                         
                           ( 
                           y 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   9 
                   ) 
                 
               
             
           
         
       
     
     Specifically, r represents the residual. If retrieval is to be performed by using the sparse coding convolutional neural network of the embodiment, an exemplar based dictionary of a target database may be retrieved to perform sparse coding, and the minimum residual or maximum coefficient is sorted to serve as a returning order as shown in equation (10) below:
 
score sc ( y,c )= r   c ( y )  (10)
 
     Specifically, r represents the residual, and c represents the class.  FIG.  8    is a schematic view of multi-channel sparse coding convolutional neural network (MSC-CNN) according to an embodiment of the invention. 
     Referring to  FIG.  8   , the processor  110  receives an input signal  801  first, generates a corresponding spectrogram  802  or referred to as time-frequency diagram, and then generates a normalized input signal  803 . After undergoing a series of convolutional neural network stage  804  (e.g., convolutional layer, pooling layer), the normalized input signal  803  is transmitted to a final convolutional layer  805 . The final convolutional layer  805  has a plurality of channels and therefore the final convolutional layer  805  is followed by a channel-wise dictionary  806 , and classification is made through the method of voting  808  after the sparse coding  807  is performed. 
     The convolutional neural network in the embodiment of the  FIG.  6    learns the classifier with a multi-layer sensor with respect to feature maps obtained from the convolutional layer. The sparse coding convolutional neural network in the embodiment of  FIG.  7    uses the feature vector obtained from the fully connected layer to perform sparse coding. However, the two recognizing methods mentioned above do not directly take into consideration the abstract feature learned through convolutional weight of different channels. The equation (11) below is a model of convolutional neural network and (single channel) sparse coding convolution neural network. The equation (12) below is a model of multi-channel sparse coding convolutional neural network: 
     
       
         
           
             
               
                 
                   p 
                   ⁡ 
                   
                     ( 
                     
                       y 
                       , 
                       
                         ∅ 
                         ⁡ 
                         
                           ( 
                           
                             conv 
                             1 
                           
                           ) 
                         
                       
                       , 
                       
                         ∅ 
                         ⁡ 
                         
                           ( 
                           
                             conv 
                             2 
                           
                           ) 
                         
                       
                       , 
                       
                         … 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           ∅ 
                           ⁡ 
                           
                             ( 
                             
                               conv 
                               n 
                             
                             ) 
                           
                         
                       
                     
                     ) 
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
             
               
                 
                   
                     1 
                     n 
                   
                   ⁢ 
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         1 
                       
                       n 
                     
                     ⁢ 
                     
                       p 
                       ⁡ 
                       
                         ( 
                         
                           y 
                           , 
                           
                             conv 
                             i 
                           
                         
                         ) 
                       
                     
                   
                 
               
               
                 
                   ( 
                   12 
                   ) 
                 
               
             
           
         
       
     
     Specifically, Ø represents the convolution operation, and p represents the probability. The above convi represents abstract feature obtained from convolutional filter of different channels. In the multi-channel sparse coding convolutional neural network, the processor  110  trains dictionary respectively with respect to convolutional maps of each of the channels, uses the sparse non-negative coding algorithm to obtain sparse coefficient, and finally makes classification through the means of channel-wise voting as shown in equation (13) below:
 
vote( c )=Σ i=1   n σ( y   i   −c )  (13)
 
     Specifically, σ represents the Heaviside step function. Since each set of the convolutional weight of the convolutional neural network is equivalent to a set of filters that can obtain a specific discriminative feature, the discriminative feature obtained from each set of the filter has different discriminative ability with respect to different category. In the embodiment, it is proposed to use fuzzy membership function to calculate trust of different channel filters with respect to different categories as shown in equation (14) below: 
     
       
         
           
             
               
                 
                   
                     confidence 
                     ⁡ 
                     
                       ( 
                       
                         i 
                         , 
                         c 
                       
                       ) 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               
                                 ψ 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       y 
                                       i 
                                     
                                     , 
                                     target 
                                   
                                   ) 
                                 
                               
                               , 
                               
                                 
                                   if 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     ψ 
                                     ⁡ 
                                     
                                       ( 
                                       
                                         
                                           y 
                                           i 
                                         
                                         , 
                                         target 
                                       
                                       ) 
                                     
                                   
                                 
                                 ≧ 
                                 ϵ 
                               
                             
                             ) 
                           
                         
                       
                       
                         
                           
                             0 
                             , 
                             else 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   14 
                   ) 
                 
               
             
           
         
       
     
     Specifically, c represents the class, and confidence represents level of trust of channel filter with respect to categories, ψ is a membership function. The two membership functions of the embodiment are as shown in equation (15) and equation (16) below:
 
ψ rr =( TP+TN )/( P+N )  (15)
 
ψ fs =2(precision×recall)/(precision+recall)  (16)
 
     Specifically, rr represents recognition rate, fs represents f score, TP represents true positive, TN represents true negative, precision represents accuracy, recall represents recall. After the level of trust is calculated, the decision function is changed as shown in equation (17) below:
 
vote( c )=Σ i=1   n  confidence( i,c )·σ( y   i   −c )  (17)
 
     Specifically, σ represents the Heaviside step function.  FIG.  9    is a schematic view of a sparse coding layer of multi-channel sparse coding convolutional neural network according to an embodiment of the invention.  FIG.  10    is a schematic view of an algorithm of training a sparse coding layer according to an embodiment of the invention. 
     Referring to  FIG.  9   , a sparse coding layer  902  includes a dictionary learning portion  903 , a sparse coding portion  904  and a reconstruction portion  905 . The sparse coding layer  902  is located after a convolutional neural network stage  901  and before a fully connected layer  906 . In the feedforward stage, a mini-batch input enters the sparse coding layer  902  through a series of calculation in the convolutional neural network stage  901 . Through algorithm with dictionary learning batch by batch, it is possible to establish storage of brain memory; through performing the sparse coding on learning dictionary, it is possible to achieve recall function. In the sparse coding layer  902 , the mini-batch feature is used to refresh dictionary atoms. The target function of training dictionary is as shown in equation (18) below: 
     
       
         
           
             
               
                 
                   
                     arg 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         min 
                         
                           D 
                           , 
                           X 
                         
                       
                       ⁢ 
                       
                         
                            
                           
                             Y 
                             - 
                             DX 
                           
                            
                         
                         2 
                         2 
                       
                     
                   
                   + 
                   
                     γ 
                     ⁢ 
                     
                       
                          
                         X 
                          
                       
                       p 
                     
                   
                 
               
               
                 
                   ( 
                   18 
                   ) 
                 
               
             
           
         
       
     
     Specifically, γ is lagrange multiplier, and ∥Y−DX∥ 2   2  is a residual. When the residual is smaller than a threshold value (or referred to as tolerance value), the processor  110  uses DX to transmit the reconstructed data to the next layer. 
     In the feedforward stage, the multi-channel sparse coding convolutional neural network of the embodiment is the same as convolutional neural network which trains bond weight through inverted transmission algorithm. Y estimated through the sparse coding layer is similar to Y, and the sparse coding layer  902  can directly transmit error to the previous layer in the inverted transmission; therefore, the sparse coding layer  902  may be inserted into the network structure of convolutional neural network in any training epoch. The algorithm of training the sparse coding layer according to an embodiment of the invention is as shown in  FIG.  10   . 
       FIG.  11    is a flowchart of a machine learning method according to an embodiment of the invention. 
     Referring to  FIG.  11   , in step S 1101 , an input signal is received and normalized. In step S 1103 , the normalized input signal is transmitted to the convolutional layer. In step S 1105 , the sparse coding layer is added after the convolutional layer, wherein the sparse coding layer uses dictionary atoms to reconstruct signals on projection of the normalized input signal passing through the convolutional layer, and the sparse coding layer receives a mini-batch input to refresh dictionary atoms. 
     In summary, the machine learning method and the machine learning device of the invention perform normalization on the input signal and add the sparse coding layer after the convolutional layer, use the dictionary atoms to reconstruct signals on the projection of the normalized input signal passing through the convolutional layer, thereby reducing the time complexity of network. The invention also uses the sparse coding layer to receive a mini-batch input to refresh dictionary atoms, thereby completing training of dictionary and reconstruction of data. Additionally, the invention further provides multi-channel sparse coding capable of directly taking into consideration of abstract feature learned through convolutional weight of different channels. 
     Although the invention has been disclosed by the above embodiments, the embodiments are not intended to limit the invention. It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the invention without departing from the scope or spirit of the invention. Therefore, the protecting range of the invention falls in the appended claims.