Machine learning methods and electronic devices for continuous learning
The method addresses catastrophic forgetting and computational inefficiencies in continuous learning by using per-channel masks to update neural network parameters based on energy scores, enhancing model reuse and efficiency in edge devices.
Patent Information
- Application Number
- JP2022201681
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-06-17
- Filing Date
- 2022-12-19
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-12-19
AI Technical Summary
Existing continuous learning methods face challenges such as catastrophic forgetting, computational resource inefficiency, and poor cross-task accuracy due to privacy concerns and data dilution, particularly in real-world applications.
A machine learning method utilizing per-channel masks within a neural network model to selectively update parameters based on energy scores, allowing for task-aware continuous learning without requiring access to previous task data, thereby preventing catastrophic forgetting and optimizing new tasks.
The method enhances the reuse rate of neural network models by retaining important parameters, effectively preventing catastrophic forgetting and improving computational efficiency in edge devices.
Smart Images

Figure 0007577728000042 
Figure 0007577728000043 
Figure 0007577728000044
Abstract
Description
[Technical field]
[0001] The present disclosure relates to machine learning techniques, and more particularly, the present disclosure relates to machine learning methods and electronic devices configured for task-aware continuous learning. [Background technology]
[0002] The explosive growth of artificial intelligence (AI) in recent years has greatly changed human life. As AI technology continues to advance, there is a need to support continuous (or incessant) or lifelong learning, so-called "endless" learning, in various application fields (e.g., autonomous drones, mechanical surgery, medical diagnosis and treatment). Lifelong learning systems focus on the efficient transfer and use of learned knowledge for new tasks and can manage multiple tasks in sequence. In the related art, the method applied to meet the above requirement refers to "collaborative learning", that is, the training data of all tasks are acquired simultaneously and jointly optimized. However, according to the collaborative learning technology, as the number of tasks increases, the data of the new task is diluted by the data of the previous task, and the training time is also extended with the increase in the amount of data. Furthermore, in application scenarios such as face recognition, the human face data in the previous task may no longer be accessible and retrainable due to privacy issues.
[0003] In order to allow AI to accumulate knowledge like the human brain, there is a need to prevent the problem of "catastrophic forgetting" caused by the inability to access previous data, while continuous learning has been developed that focuses on effectively transferring and using learned knowledge in new tasks to process tasks in sequence. Continuous learning methods can be classified into three main categories, namely, experience replay, polarization regularization term, and dynamic network separation. In existing continuous learning techniques based on polarization regularization term, even if the data of the previous task is not provided, the non-negligible problem of catastrophic forgetting of the knowledge of the previous task may still occur after learning a new task. In contrast, the phenomenon of catastrophic forgetting is relatively minor in experience replay, which provides the new task with the previous data of the previous task and assists in learning the new task. However, if it is difficult to preserve the previous data due to privacy issues, it may have a negative impact on subsequent model updates. With regard to dynamic network separation, the number of parameters and the amount of data of the model increase proportionally with the increase in tasks, which may consume a lot of computational resources and not reduce the burden on the user.
[0004] Existing continuous learning often operates in a task-based sequential learning setup, which is rarely encountered in practical applications. Therefore, to solve such problems, task-free continuous learning has begun to be developed. According to related art, task-free continuous learning often requires experience replay, and the learning process relies on the belief of a softmax function for comparison and scoring. However, the neural network may overfit the sample space, thus giving high belief to samples of unlearned classes, thus resulting in poor performance of cross-task accuracy of subsequent calculations. Summary of the Invention [Problem to be solved by the invention]
[0005] The present disclosure provides a machine learning method and electronic device for continuous learning, which can effectively prevent catastrophic forgetting and at the same time achieve the effect of self-adaptively identifying a target task from multiple tasks. [Means for solving the problem]
[0006] An embodiment of the present disclosure provides a machine learning method for continuous learning, which includes the following steps: take an input image; perform feature extraction on the input image by multiple sub-models to obtain multiple feature maps, where the sub-models correspond to multiple tasks and the sub-models are determined by a neural network model and multiple per-channel masks; convert the feature maps into multiple energy scores; select a target sub-model corresponding to a target task among the tasks from the sub-models according to the energy scores; and output a prediction result corresponding to the target task by the target sub-model.
[0007] In one embodiment of the present disclosure, the machine learning method further includes the steps of: receiving training data associated with the task, where the training data includes training images and class labels corresponding to the training images; performing feature extraction on the training images according to the neural network model and the masks for each channel to obtain training feature maps; converting the training feature maps into feature energy scores; determining a loss function according to the class labels, the masks for each channel, and the feature energy scores; determining a backpropagation gradient according to the loss function; propagation Update the neural network model and per-channel masks according to the gradients, where the per-channel masks correspond to tasks, and update one of the per-channel masks corresponding to a training task of at least one of the tasks.
[0008] In another aspect, an embodiment of the present disclosure provides an electronic device configured for task-aware continuous learning, the electronic device including: a storage medium storing a plurality of modules; and a processor coupled to the storage medium and configured to execute the modules, where the modules include: an image capture module for capturing an input image; and an inference module for performing feature extraction on the input image by a plurality of sub-models to obtain a plurality of feature maps, the sub-models corresponding to a plurality of tasks, and the sub-models are determined by a neural network model and a plurality of per-channel masks, the feature maps are converted into a plurality of energy scores, a target sub-model corresponding to a target task of the tasks is selected from the sub-models according to the energy scores, and a prediction result corresponding to the target task is output by the target sub-model.
[0009] In an embodiment of the present disclosure, the module further receives training data associated with the task, where the training data includes training images and class labels corresponding to the training images; performs feature extraction on the training images according to the neural network model and the per-channel mask to obtain training feature maps; converts the training feature maps into feature energy scores; determines a loss function according to the class labels, the per-channel mask, and the feature energy scores; determines backpropagation gradients according to the loss function; propagation and a training module for updating the neural network model and per-channel masks according to the gradients, the per-channel masks corresponding to tasks, and updating one per-channel mask of the per-channel masks corresponding to at least one training task of the tasks. Effect of the Invention
[0010] In view of the above, one or more embodiments of the present disclosure provide a task-validated continuous learning mechanism based on energy scores, in which feature maps corresponding to multiple tasks are classified by a per-channel mask in a neural network model to determine sub-models, and the neural network model together with the per-channel mask corresponding to previously learned tasks can automatically determine whether important neural network parameters are re-applied to other previous tasks according to a loss function, and the neural network parameters are applied to optimize the new task, thereby improving the reuse rate of the neural network model. Thus, the neural network model can retain more neurons to learn the next task, and important parameters in the sub-models can be preserved to more effectively prevent catastrophic forgetting.
[0011] The accompanying drawings are included to provide a further understanding of the present disclosure, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the present disclosure, and together with the description, serve to explain the principles of the disclosure. [Brief description of the drawings]
[0012] [Figure 1] FIG. 1 is a schematic diagram of an electronic device according to one embodiment of the present disclosure. [Diagram 2] 1 is a flowchart of an inference stage in a machine learning method according to one embodiment of the present disclosure. [Diagram 3] 1 is a flowchart of a training phase in a machine learning method according to one embodiment of the present disclosure. [Figure 4] FIG. 2 is a schematic diagram illustrating a training module learning a new task, according to one embodiment of the present disclosure. [Diagram 5] FIG. 2 is a schematic diagram of the operation of an inference module according to one embodiment of the present disclosure. [Figure 6A] FIG. 1 is a schematic diagram of training a neural network model according to one embodiment of the present disclosure. [Figure 6B] FIG. 1 is a schematic diagram of a task-compatible neural network model and per-channel mask update by backpropagation gradients in one embodiment of the present disclosure. [Figure 7] FIG. 13 is a schematic diagram of the operation of a task-compatible neural network model and per-channel masks according to another embodiment of the present disclosure. [Figure 8] FIG. 2 is a schematic diagram of a neural network model according to another embodiment of the present disclosure. [Figure 9] FIG. 2 is a schematic diagram of training data associated with multiple tasks, according to one embodiment of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] Some embodiments provided in the present disclosure will be described in detail with reference to the accompanying drawings. Reference numbers in the following description are considered to refer to the same or similar elements when the same reference numbers appear in different drawings. These embodiments are only a part of the present invention, and not all possible embodiments of the present invention are disclosed. Rather, these embodiments serve as illustrations of methods and apparatuses within the scope provided in the claims. Furthermore, wherever possible, elements / components / steps with the same reference numbers in the drawings and embodiments indicate the same or similar parts. Cross reference may be made to relevant descriptions of elements / components / steps marked by the same reference numbers or the same terms in different embodiments.
[0014] 1 is a schematic diagram of an electronic device according to one embodiment of the present disclosure. The electronic device 10 includes a processor 110 and a storage medium 120.
[0015] The electronic device 10 may be an edge computing device. The electronic device 10 may be an edge computing device implemented on an embedded platform, and the electronic device 10 may be an image recognition device applied to various scenarios such as human face recognition, access control, identity verification, digital surveillance, financial industry, retail industry, unmanned stores, smart factories, drones, mechanical surgery, medical diagnosis, etc. The electronic device 10 may be a desktop computer, a notebook computer, a server, a smartphone, or a tablet computer, and the model number, brand, and operating system of the electronic device 10 should not be construed as being limiting in this disclosure.
[0016] The processor 110 may be, for example, a central processing unit (CPU) or another general-purpose or special-purpose programmable microcontroller unit (MCU), microprocessor, digital signal processor (DSP), programmable controller, application specific integrated circuit (ASIC), graphics processing unit (GPU), tensor processing unit (TPU), image signal processor (ISP), image processing unit (IPU), arithmetic unit (ALU), complex programmable logic device (CPLD), field programmable gate array (FPGA), or other similar element or combination of the above elements. The processor 110 may be coupled to a storage medium 120 and may access and execute a number of modules or various application programs stored in the storage medium 120.
[0017] The storage medium 120 may be, for example, any type of fixed or removable random access memory (RAM), read only memory (ROM), flash memory, hard disk drive (HDD), solid state drive (SSD), or similar components or a combination of the above components, and is configured to store a number of modules, computer programs, or various application programs executable by the processor 110. In this embodiment, the modules stored in the storage medium 120 include an image capture module 1201, an inference module 1203, and a training module 1205, whose roles are described below.
[0018] In one embodiment, the electronic device 10 may further include an image capture device 130. The processor 110 may be coupled to the image capture device 130. The image capture device 130 may be, for example, a digital camera, a camcorder, or a camera lens having a lens and a photosensitive element. The photosensitive element functions to sense the intensity of light incident on the lens, thereby generating an image.
[0019] 2 is a flow chart of an inference stage in a machine learning method according to one embodiment of the present disclosure. The machine learning method illustrated in FIG 2 is applicable to the electronic device 10 illustrated in FIG 1. Please refer to both FIG 1 and FIG 2.
[0020] In step S210, the image capture module 1201 captures an input image. For example, the image capture module 1201 captures the input image via the image capture device 130, captures the input image from a database, or receives the input image from the Internet.
[0021] In step S220, the inference module 1203 performs feature extraction on the input image by the sub-models to obtain a number of feature maps. Specifically, feature extraction refers to the process of converting raw data into numerical features that can be processed while preserving information in the original dataset. For example, feature extraction on image data represents interesting parts of the image as a numerical feature vector or feature matrix, also known as a feature map. Each sub-model extracts input image features from the input image and represents the image features as a feature map. The feature map can be represented as, but is not limited to, a set of numerical data, a data vector, or a data matrix. It is noted that the sub-models correspond to a number of tasks, and the sub-models are determined by a neural network model and a mask for each of a number of channels in the neural network model. In step S230, the inference module 1203 converts the feature map into a number of energy scores. In step S240, the inference module 1203 selects a target sub-model corresponding to a target task from the sub-models according to the energy scores. In step S250, the inference module 1203 outputs a prediction result corresponding to the target task by the target sub-model.
[0022] FIG. 3 is a flowchart of a training stage in a machine learning method according to an embodiment of the present disclosure. The machine learning method shown in FIG. 3 is applicable to the electronic device 10 shown in FIG. 1. Please refer to both FIG. 1 and FIG. 3. In step S310, the training module 1205 receives training data related to a plurality of tasks. The training data includes training images and class labels corresponding to the training images. The class labels can correspond to the training tasks of the tasks. In step S320, the training module 1205 performs feature extraction on the training images according to the neural network model and the plurality of per-channel masks to obtain a training feature map. In step S330, the training module 1205 converts the training feature map into a feature energy score. In step S340, the training module 1205 calculates to obtain a loss function according to the class labels, per-channel masks, and feature energy scores. The value of the loss function can be calculated according to the realization of the class labels, per-channel masks, and feature energy scores from the samples of the training data. In step S350, the training module 1205 determines a backpropagation gradient according to the loss function. For example, the backward propagation gradient is determined by the result of the calculation of the numerical value of the loss function in step S340. Specifically, the backward propagation gradient refers to the gradient of the loss function, which points in the direction of the value that minimizes the loss function. In the case of a neural network, the backward propagation gradient is determined by the result of the calculation of the numerical value of the loss function in step S340. propagation A gradient is an inverse function of the weights in each layer of a neural network. propagation In step S360, the training module 1205 performs a backward propagation Update the neural network model and the per-channel masks according to the gradients, the per-channel masks corresponding to tasks, and one per-channel mask of the per-channel masks corresponding to the training task of at least one of the tasks is updated.
[0023] For example, the electronic device 10 can apply the same neural network model to perform continuous learning for each of a plurality of tasks 1, 2, ..., and t. A per-channel mask may correspond to each of tasks 1, 2, ..., and t. In one embodiment, when the training task is task t, the training module 1205 receives training data associated with task t, where the training data includes training images associated with task t and class labels corresponding to the training images. The class labels may correspond to classes of task t (step S310). The training module 1205 obtains a training feature map according to the neural network model and one per-channel mask of the per-channel masks corresponding to task t by performing feature extraction on the training images (step S320). The training module 1205 converts the training feature map into a feature energy score (step S330). The training module 1205 calculates to obtain a loss function according to the class label, a particular per-channel mask of the per-channel masks corresponding to task t, and the feature energy score (step S340). The numerical value of the loss function can be calculated from the training data samples associated with the task t according to the class label, the per-channel mask corresponding to the task t, and the realization of the feature energy score. The training module 1205 determines the backpropagation gradient of a particular per-channel mask among the per-channel masks corresponding to the task t according to the loss function (step S350). For example, the backpropagation gradient is determined by the calculation result of the numerical value of the loss function in step S340. The training module 1205 updates the neural network model and the particular per-channel mask among the per-channel masks corresponding to the task t according to the backpropagation gradient (step S360). Thus, after the electronic device 10 learns the tasks 1, 2, ..., and t, the neural network model having the same per-channel mask can be classified into multiple sub-models corresponding to the tasks 1, 2, ..., and t.
[0024] It is worth mentioning that the execution order of the inference stage shown in FIG. 2 and the training stage shown in FIG. 3 is not limiting in the present disclosure. In one embodiment, the task includes training data of a new task. The electronic device 10 may first execute the steps of the training stage shown in FIG. 3 to learn the new task. When the electronic device 10 completes the training stage for the new task, the steps of the inference stage shown in FIG. 2 are executed to predict an input image according to the per-channel mask and the neural network model trained in the new task. In one embodiment, the electronic device 10 can execute the steps of the inference stage shown in FIG. 3 according to the pre-stored neural network model that has completed pre-training for the task and the per-channel mask corresponding to the neural network model. When the task has a new task, the electronic device 10 executes training according to the training data of the new task and updates one of the per-channel masks of the neural network model and the per-channel mask corresponding to the new task. Therefore, the electronic device 10 provided in one or more embodiments of the present disclosure achieves the function of incorporating features of multiple tasks by applying one neural network to perform continuous learning for multiple tasks, and achieves the effect of learning new tasks without forgetting previous tasks by performing task-based sequential learning on training data of a specific task, thereby alleviating the limitation of the traditional continuous learning method in which tasks must be assigned manually.
[0025] In one embodiment, the neural network model includes at least one convolutional layer and at least one batch normalization layer. In one embodiment, the neural network model can be a convolutional neural network architecture, for example, a ResNet, VGG, or MobileNet-v2 neural network architecture. The electronic device 10 is, for example, an edge computing device. In general, the memory capacity and computing power of an edge computing device have many limitations, and traditional joint learning is often not allowed. In the machine learning provided in one or more embodiments of the present disclosure, a target task is automatically determined in the input data of the task without changing the neural network architecture, and continuous learning is achieved through continuous training on a small portion of the data. For edge computing devices with less powerful hardware specifications, deep network learning can be performed in a more power-saving and faster manner according to one or more embodiments of the present disclosure.
[0026] Fig. 4 is a schematic diagram showing the training module learning a new task according to an embodiment of the present disclosure. Referring to Fig. 4, in step S410, the electronic device 10 receives training data of the new task. In step S420, the training module 1205 executes the steps shown in Fig. 3 to update the parameters of the neural network model NN and the mask GS for each channel according to the training data of the new task, and completes training. In step S430, after the training for the current task is completed, if training needs to be performed for the next task, learning is performed for the next task.
[0027] Specifically, for the training data of any new task, the per-channel mask GS can restrict a part of the neural network model NN from performing calculations. Thus, according to the neural network model NN and the per-channel mask GS, multiple sub-models are determined, and the sub-models perform feature extraction on the training data through important neurons to obtain a training feature map. The training module 1205 calculates feature energy scores according to the training feature map. Then, the training module 1205 determines a loss function according to the class label, the per-channel mask, and the feature energy score of the training data. A backward propagation gradient is determined by the loss function. The training module 1205 updates the neural network model NN and the per-channel mask GS according to the backward propagation gradient. In one embodiment, in the process of updating parameters according to the backward propagation gradient, the per-channel mask GS corresponds to tasks 1, 2, ..., and t, and the per-channel mask corresponding to at least one training task of tasks 1, 2, ..., and t is updated. Backward propagation The gradient automatically determines the importance of the parameter in the training process. If the importance is high, the corresponding per-channel mask is activated, and the activated per-channel mask self-adaptively updates part of the parameters of the neural network model NN. In other words, after the electronic device 10 learns tasks 1, 2, ..., and t, the per-channel mask GS can classify the same neural network model NN into multiple sub-models corresponding to tasks 1, 2, ..., and t.
[0028] In one embodiment of the present disclosure, the training module 1205 determines a plurality of activation parameters based on a plurality of per-channel masks GS. After the training module 1205 calculates a loss according to the plurality of activation parameters, the training module 1205 adjusts the backpropagation gradient according to the loss. The training module 1205 updates the neural network model NN and the per-channel masks GS according to the adjusted backpropagation gradient. In one embodiment, in the process of updating parameters according to the backpropagation gradient, the per-channel masks GS correspond to tasks 1, 2, ..., and t, and the per-channel masks corresponding to at least one training task among tasks 1, 2, ..., and t are updated.
[0029] In one embodiment of the present disclosure, the loss function includes a cross-entropy error, a per-channel mask polarization regularization term, and an energy loss.
[0030] In one embodiment of the present disclosure, the neural network model NN includes at least one convolution layer and at least one batch normalization layer, and each of the masks GS for each channel includes a scaling factor of at least one batch normalization layer. In one embodiment, the dimension of the scaling factor is the same as the dimension of the convolution layer, and the scaling factor of each batch normalization layer is associated with a corresponding convolution kernel of the convolution layer. In one embodiment of the present disclosure, the mask polarization regularization term for each channel is associated with the scaling factor.
[0031] In one embodiment of the present disclosure, the training module 1205 passes the training image through at least one convolutional layer to obtain an input feature map, and the training module 1205 obtains the training feature map by performing a normalization calculation on the input feature map and corresponding scaling coefficients through at least one batch normalization layer.
[0032] FIG. 5 is a schematic diagram of the operation of the inference module 1203 according to an embodiment of the present disclosure. Referring to FIG. 5, in step S510, the inference module 1203 takes in an input image IMG. Specifically, a neural network model NN that has learned N tasks (N is a positive integer) corresponding to N channel-specific masks GS_1, GS_2, . . . , and GS_N, and the channel-specific masks GS_1, GS_2, . . . , and GS_N are recorded, respectively, to be able to calculate multiple tasks by applying a part of the neural network model NN. Using the channel-specific masks GS_1, GS_2, . . . , GS_N and the neural network model NN, it is determined that feature extraction is performed on the input image IMG by multiple sub-models SUB_1, SUB_2, . . . , and SUB_N to obtain multiple feature maps.
[0033] Note that in one or more embodiments of the present disclosure, the sub-models SUB_1, SUB_2, ..., SUB_N share the same neural network model NN, i.e., the per-channel masks GS_1, GS_2, ..., and GS_N classify the same neural network model NN into sub-models corresponding to tasks.
[0034] In step S520, the inference module 1203 performs feature extraction on the input image IMG by the sub-models SUB_1, SUB_2, ..., and SUB_N to obtain a plurality of feature maps. In step S530, the inference module 1203 converts the feature maps corresponding to the sub-models SUB_1, SUB_2, ..., and SUB_N into a plurality of energy scores E_1, E_2, ..., and E_N, respectively. The energy scores E_1, E_2, ..., and E_N are scalars representing the stability of the sub-models SUB_1, SUB_2, ..., and SUB_N. In terms of energy, the lower the scalar, the more stable the sub-model is. The energy scores E_1, E_2, ..., and E_N measure the degree of correlation between the input image IMG and the sub-models, so as to achieve the effect of task recognition. The sub-models SUB_1, SUB_2, ..., and SUB_N correspond to tasks.
[0035] In step S540, the inference module 1203 selects a target sub-model corresponding to a target task from the sub-models SUB_1, SUB_2, and SUB_N according to the energy scores E_1, E_2, and E_N. The target task is one of the tasks for which training has been completed, and the target task is a task of relatively processing an input image IMG. The target sub-model is one of the sub-models determined to be most relevant to the target task according to the energy scores E_1, E_2, and E_N.
[0036] In one embodiment of the present disclosure, the inference module 1203 selects one of the sub-models corresponding to the minimum of the energy scores E_1, E_2, ..., and E_N as the target sub-model. In some embodiments, the task may include a first task and a second task, and the target sub-model may be the sub-model corresponding to the first task or the sub-model corresponding to the second task. In some embodiments, the target sub-model may also be one of the sub-models corresponding to the task.
[0037] In step S550, the inference module 1203 outputs a prediction result corresponding to the target task through the target sub-model. In one embodiment, the inference module 1203 converts the feature map corresponding to the target sub-model into a confidence score corresponding to the predicted class of the target task through a softmax function to obtain the corresponding prediction result.
[0038] JPEG0007577728000001.jpg83162
[0039]
number
[0040] JPEG0007577728000004.jpg84162
[0041] JPEG0007577728000005.jpg72162
[0042] JPEG0007577728000006.jpg96162
[0043] JPEG0007577728000007.jpg44162
[0044] JPEG0007577728000008.jpg59162
[0045] JPEG0007577728000009.jpg53162
[0046] The energy score E is calculated by the following formula (2).
[0047]
number
[0048] JPEG0007577728000012.jpg42162
[0049] JPEG0007577728000013.jpg11162
[0050]
number
[0051] JPEG0007577728000016.jpg19162
[0052] The energy loss is calculated by the following formula (4):
[0053]
number
[0054] JPEG0007577728000019.jpg10162
[0055]
number
[0056] JPEG0007577728000022.jpg89163
[0057] JPEG0007577728000023.jpg59169
[0058] The adjusted backpropagation gradient is calculated by the following equation (6):
[0059]
number
[0060] JPEG0007577728000026.jpg46169
[0061] JPEG0007577728000027.jpg63169
[0062] The embodiment described in Figures 6A and 6B is a preferred embodiment provided in the present disclosure, which can achieve the effect of self-adaptively identifying a target task from a task by a per-channel mask corresponding to the task through a scaling factor of a batch normalization layer. However, without departing from the spirit and scope of the present disclosure, the per-channel mask GS is not limited to being implemented through a batch normalization layer. In some embodiments, the per-channel mask GS may be implemented by performing element-wise multiplication on the feature map through multiple importance factors.
[0063] FIG. 7 is a schematic diagram of the operation of a neural network model and a mask for each channel corresponding to a task according to another embodiment of the present disclosure. In one embodiment of the present disclosure, each mask for each channel GS includes a plurality of importance coefficients. The inference module 1203 passes an input image through the neural network model NN to obtain an output feature map. In step S70, the inference module 1203 performs element-wise multiplication on the output feature map and the importance coefficients to obtain a feature map. In step S71, the inference module 1203 applies an activation function to the feature map to obtain a prediction result.
[0064] The importance coefficient is calculated by the following formula (7).
[0065]
number
[0066] In one embodiment of the present disclosure, the loss function includes an importance factor regularization term, the importance factor regularization term being associated with the importance factor.
[0067] In another embodiment of the present disclosure, the adjusted backpropagation gradient is calculated according to the following equation (8):
[0068]
number
[0069] FIG. 8 is a schematic diagram of a neural network model NN according to another embodiment of the present disclosure. The neural network model NN includes a convolution layer 810 and a batch normalization layer 820. With reference to FIG. 7 as well, the importance coefficient is associated with a plurality of convolution kernels of the convolution layer 810. In one embodiment, the neural network model NN may be a convolution neural network architecture, for example, a ResNet, VGG, or MobileNet-v2 neural network architecture. It should be noted that in the embodiment shown in FIG. 7 and FIG. 8, the mask GS per channel can achieve important parameter screening of the neurons of the convolution layer 810, which is limited to the batch normalization layer 820 of the neural network model NN, by performing element-wise multiplication by a plurality of importance coefficients.
[0070] FIG. 9 is a schematic diagram of training data associated with multiple tasks, according to an embodiment of the present disclosure. In an embodiment of the present disclosure, machine learning methods can be applied to improve the ability to recognize human faces wearing masks in response to access control management. For example, an image 910 of a human face wearing a mask and corresponding class labels can serve as an initial task for training. Then, in step S90, another image 920 of a human face wearing a mask serves as a new task for training. In this example, the machine learning method provided in one or more embodiments of the present disclosure can treat the new dataset of images 920 of human faces wearing masks as a new task without accessing or storing data of the previous task. The updated per-channel mask in the new task can select convolutional neurons important to the new task through training, and the new task can use the parameters of the previous task, so that the task of learning to recognize images of human faces wearing masks can apply the features learned in the previous task in relation to the eyes, eyebrows, and forehead that are not covered by the mask. For parameters that are not important in the new task, such as the mouth and nose, the associated convolutional neurons in the first task are not activated in the new task. Furthermore, the non-important convolutional neurons are applied to the previous task model to learn detailed features of the human face wearing a mask, such as the shadow area of the protruding nose after wearing the mask and the contour or profile of the projected surface of the human face occluded by the mask.
[0071] In one embodiment of the present disclosure, the machine learning method can be configured to search for similar products. For example, the first task of learning is to identify clothes and accessories for spring. In that case, by the time of seasonal clothing change, the new learning task is to identify clothes and accessories for winter, and training of the new task is performed using images and data of winter clothes and accessories because the training of the previous task model already includes general features of clothes. The updated channel-by-channel mask in the new task can select convolutional neurons that are important for the new task through training, and the new task allows the use of parameters of the previous task, so that the task of learning to identify images of winter clothes and accessories can improve the reuse rate and improve the computing performance of the electronic device by applying detailed features (e.g., collars, sleeves, buttons, etc.) learned in the previous task.
[0072] In one embodiment of the present disclosure, the machine learning method can be configured to detect defects of elements installed on the surface of a printed circuit board manufactured by a smart factory. For example, the first task of learning is to distinguish defects of a first model resistor, which includes images of two classes, i.e., normal and abnormal. If a second model resistor needs to be additionally installed on the printed circuit board, the training of the neural network model corresponding to the first task includes features of the resistor, such as appearance and defects, so that the channel-by-channel mask including the images and data of the second model resistor updated in the second task can select convolution neurons from the first task that are important for the second task, such as the appearance of the element and some common offset defects. In other words, in the new task, the convolution kernels that are important for the previous task can be repeatedly used, and the convolution kernels that are not important for the previous task can be applied to learn the features missing in the first task. In this way, the previous parameters can be effectively used, and the features of defects that are important for the new task can be learned.
[0073] In summary, one or more embodiments of the present disclosure provide a task-aware continuous learning mechanism based on energy scores, in which feature maps corresponding to multiple tasks are classified by a channel-wise mask of a neural network model to determine sub-models, and the channel-wise mask corresponding to the tasks allows the neural network model to automatically select important convolution parameters for another previous task in a cross-task manner, and apply the convolution parameters not used by the previous task to learn new tasks and knowledge. Finally, a loss function is applied to determine a backpropagation gradient to optimize the new task, thereby improving the reuse rate of the neural network model. Thus, the neural network model can retain more neurons to learn the next task, and important parameters in the sub-models can be preserved to more effectively prevent catastrophic forgetting.
[0074] It will be apparent to one skilled in the art that various modifications and variations can be made to the disclosed embodiments without departing from the scope or spirit of the disclosure. In view of the above, it is intended that the present disclosure cover modifications and variations, provided they come within the scope of the following claims and their equivalents. [Industrial Applicability]
[0075] The machine learning methods and electronic devices for continuous learning disclosed herein are applicable, for example, to human face recognition, access control, identity verification, digital surveillance, the financial industry, retail, unmanned stores, smart factories, drones, mechanical surgery, medical diagnosis, and the like. [Explanation of symbols]
[0076] 10:Electronic equipment 110: Processor 120:Storage medium 1201: Image capture module 1203: Inference module 1205: Training Module 130: Image capture device IMG:Image NN: Neural network model GS, GS_1, GS_2, GS_N: Per-channel masks SUB_1, SUB_2, SUB_N: Submodels JPEG0007577728000032.jpg11162S210, S220, S230, S240, S250, S310, S320, S330, S340, S350, S360, S410, S420, S430, S510, S520, S530, S540, S550, S60, S61, S62, S63, S70, S71, S90: Step 610, 630, 650, 610´, 630´, 650´, 820: batch normalization layer 620, 640, 620´, 640´, 810: Convolutional layers 910, 920: Images H: Height W: Width JPEG0007577728000033.jpg240163
Claims
1. 1. A machine learning method for continuous learning, comprising: In the training phase, the steps to be executed using a processor include: performing continuous learning on a plurality of sub-models respectively corresponding to a plurality of tasks; classifying a neural network model into the plurality of sub-models using a plurality of per-channel masks corresponding to the plurality of tasks; each of the per-channel masks includes a scaling coefficient for each batch normalization layer of the neural network model, and each of the scaling coefficients is used to determine whether or not an input feature map obtained through each of at least one convolutional layer of the neural network model is placed in a next layer; In the inference stage, the steps to be taken are: capturing an input image; performing feature extraction on the input image by the plurality of sub-models trained in the training phase to obtain a plurality of feature maps; converting the feature map into a number of energy scores, each of the energy scores being used to measure a degree of correlation between the input image and each of the sub-models; selecting, according to the energy scores, one of the sub-models corresponding to a minimum value of the energy scores as a target sub-model corresponding to a target task of the tasks; outputting a prediction result corresponding to the target task by the target sub-model; Including, The energy score is calculated according to the following formula: [0010] 【number】
2. The scaling coefficients are associated with a plurality of convolution kernels of the at least one convolution layer, and the step of performing feature extraction on an input image by the sub-model trained in the training phase to obtain a feature map includes: passing the input image through the at least one convolutional layer to obtain an input feature map; performing a normalization calculation on the scaling coefficients of the input feature map and each of the per-channel masks through at least one batch normalization layer to obtain a feature map; Including, each of the masks for each channel includes a plurality of importance coefficients; performing feature extraction on the input image by the sub-models trained in the training phase to obtain a feature map; passing the input image through the neural network model to obtain an output feature map; performing an element-wise multiplication on the importance coefficients of the output feature map and each of the channel-by-channel masks to obtain a feature map; The machine learning method of claim 1 , comprising:
3. The machine learning method further comprising: receiving training data associated with the task, the training data including training images and class labels corresponding to the training images; performing feature extraction on the training images according to the neural network model and the per-channel mask to obtain a training feature map; converting the training feature maps into feature energy scores; determining a loss function according to the class labels, the channel-by-channel masks, and the feature energy scores; determining a backpropagation gradient according to the loss function; updating the neural network model and the per-channel masks according to the backpropagation gradients, the per-channel masks corresponding to the tasks, and updating one per-channel mask among the per-channel masks corresponding to at least one training task of the tasks; wherein the scaling coefficients are associated with a plurality of convolution kernels of the at least one convolution layer; and performing feature extraction on the training images according to the neural network model and the per-channel mask to obtain a training feature map; passing the training images through the at least one convolutional layer to obtain an input feature map; performing a normalization calculation on the input feature maps and the scaling factors through the at least one batch normalization layer to obtain the training feature maps; and the loss function is Cross entropy error, a polarization regularization term for the mask for each said channel; and Energy Loss It includes a linear combination of the polarization regularization term is related to the scaling factor; and the energy loss is associated with the feature energy score; The polarization regularization term is calculated according to the following formula: [0025] 【number】 updating the neural network model and per-channel masks according to the backpropagation gradients; determining a plurality of activation parameters according to the per-channel mask; adjusting the backpropagation gradients as adjusted backpropagation gradients according to the activation parameters; updating the neural network model and the per-channel mask according to the adjusted backpropagation gradients; wherein each of the per-channel masks comprises a plurality of importance coefficients, the loss function comprises an importance coefficient regularization term, the importance coefficient regularization term being associated with the importance coefficients; updating the neural network model and the per-channel mask according to the backpropagation gradients; determining a plurality of activation parameters according to the per-channel mask; adjusting the backpropagated gradients according to the activation parameters as adjusted backpropagated gradients; updating the neural network model and the per-channel mask according to the adjusted backpropagation gradients; and the adjusted backpropagation gradients are expressed as: [0030] 【number】
4. An electronic device for continuous learning, A storage medium that stores a plurality of modules; a processor, coupled to the storage medium, for executing the modules; and wherein the module includes: a training module for performing continuous learning on a plurality of sub-models corresponding to a plurality of tasks in a training stage, classifying a neural network model into the plurality of sub-models using a plurality of channel-wise masks corresponding to the plurality of tasks, each of the channel-wise masks including a scaling coefficient for each batch normalization layer of the neural network model, each of the scaling coefficients being used to determine whether an input feature map obtained through each of at least one convolutional layer of the neural network model is to be placed in a next layer; an image capture module for capturing an input image; an inference module that performs feature extraction on the input image by the plurality of sub-models trained in the training stage to obtain a plurality of feature maps; converting the feature map into a number of energy scores, each of the energy scores being used to measure a correlation between the input image and each of the sub-models; selecting one of the sub-models corresponding to a minimum value of the energy scores according to the energy scores as a target sub-model corresponding to a target task among the tasks; and outputting a prediction result corresponding to the target task by the target sub-model; The energy score is calculated according to the following formula: [0045] 【number】
5. The training module includes:
5. The electronic device of claim 4, further comprising: receiving training data associated with the task, the training data including training images and class labels corresponding to the training images; performing feature extraction on the training images according to the neural network model and the per-channel mask to obtain training feature maps; converting the training feature maps into feature energy scores; determining a loss function according to the class labels, the per-channel mask, and the feature energy scores; determining backpropagation gradients according to the loss function; updating the neural network model and the per-channel mask according to the backpropagation gradients, the per-channel mask corresponding to the task, and updating one of the per-channel masks corresponding to at least one training task of the tasks.
Citation Information
Patent Citations
Semi-Supervised Learning for Training an Ensemble of Deep Convolutional Neural Networks
US20190114544A1
Adaptive search method and apparatus for neural network
WO2021143883A1
