Machine learning method for continuous learning and electronic device

By employing a task-aware continuous learning method based on energy scoring and utilizing the parameters of a gate switch-categorized neural network model, the catastrophic forgetting problem in multi-task learning is solved, achieving efficient model updates and accurate identification.

CN117315276BActive Publication Date: 2026-06-02WISTRON CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WISTRON CORP
Filing Date
2022-07-07
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing continuous learning techniques are prone to catastrophic forgetting when faced with multi-task learning, and are difficult to update effectively in cases of privacy concerns or data scarcity, resulting in high computational resource consumption and poor accuracy.

Method used

A task-aware continuous learning method based on energy scoring is adopted. The neural network model is classified by multiple gate switches, and the neural network parameters of the old task are automatically determined to help optimize the new task and avoid catastrophic forgetting.

Benefits of technology

It effectively avoids catastrophic forgetting, improves the reusability of neural network models, and achieves the accuracy of adaptively identifying target tasks from multiple tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117315276B_ABST
    Figure CN117315276B_ABST
Patent Text Reader

Abstract

A machine learning method and an electronic device are disclosed. The machine learning method includes: obtaining an input image; obtaining a plurality of feature maps by performing feature extraction on the input image using a plurality of sub-models, wherein the plurality of sub-models correspond to a plurality of tasks, and the plurality of sub-models are determined by a neural network model and a plurality of gate switches; converting the plurality of feature maps into a plurality of energy scores; selecting a target sub-model corresponding to a target task from the plurality of sub-models according to the plurality of energy scores; and outputting a prediction result corresponding to the target task by using the target sub-model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a machine learning technique, and more particularly to a machine learning method and electronic device for task-aware continuous learning. Background Technology

[0002] The explosive growth of Artificial Intelligence (AI) in recent years has significantly changed human lives. As AI technology continues to evolve, many application areas (such as autonomous drones, mechanical surgery, and medical diagnosis and treatment) require support for continuous or lifelong learning—never-ending learning. Lifelong learning systems focus on the effective transfer and use of learned knowledge in new tasks, enabling the sequential resolution of multiple tasks. Currently, joint learning is used to meet these needs, which involves simultaneously extracting training data from all tasks and jointly optimizing them. However, with the increase in the number of tasks, the data for new tasks becomes diluted by the data from older tasks, and the training time increases with the amount of data. Furthermore, in applications such as facial recognition, facial data from previous tasks is often not easily accessible for retraining due to privacy concerns.

[0003] To enable artificial intelligence to accumulate knowledge like the human brain, continuous learning has been developed to focus on effectively transferring and using learned knowledge to solve multiple tasks sequentially, while avoiding the problem of "catastrophic forgetting" caused by the inability to access old data. Continuous learning methods can be divided into three main categories: memory replay, regularization-based methods, and dynamic network isolation. In past regularization-based continuous learning techniques, without providing old task data, significant catastrophic forgetting of knowledge from the old task still occurs after learning a new task. Conversely, memory replay methods, which provide old task data to assist in learning new tasks, exhibit relatively milder catastrophic forgetting. However, if the old data is difficult to obtain or store due to privacy concerns, it is detrimental to subsequent model updates. Dynamic network isolation methods, on the other hand, cause the number of model parameters to increase proportionally with the number of tasks, consuming significant computational resources and potentially not reducing the burden on users.

[0004] Previous continuous learning techniques were designed with the task in mind, which is impractical in real-world applications. Therefore, task-free continuous learning was developed to address this challenge. Past task-free continuous learning techniques relied on memory replay and depended on confidence scores using the softmax function for comparison. However, due to overfitting in the sample space, neural networks often assign high confidence scores to samples from unlearned categories, leading to poor performance in subsequent cross-task accuracy calculations. Summary of the Invention

[0005] In view of this, the present invention provides a machine learning method and electronic device for continuous learning, which can effectively avoid catastrophic forgetting and simultaneously achieve the effect of adaptively identifying the target task from multiple tasks.

[0006] This invention provides a machine learning method for task-aware continuous learning, comprising: capturing an input image; extracting features from the input image using multiple sub-models to obtain multiple feature maps, wherein the multiple sub-models correspond to multiple tasks, and the multiple sub-models are determined by a neural network model and multiple gate switches; converting the multiple feature maps into multiple energy scores; selecting a target sub-model corresponding to a target task from the multiple sub-models based on the multiple energy scores; and outputting a prediction result corresponding to the target task through the target sub-model.

[0007] In one embodiment of the present invention, the machine learning method further includes: receiving training data associated with multiple tasks, wherein the training data includes a training image and a category label corresponding to the training image; extracting features from the training image according to the neural network model and the multiple gate switches to obtain a training feature map; converting the training feature map into a feature energy score; determining a loss function according to the category label, the multiple gate switches, and the feature energy score; determining a backpropagation gradient according to the loss function; and updating the neural network model and the multiple gate switches according to the backpropagation gradient, wherein the multiple gate switches correspond to the multiple tasks, and a gate switch corresponding to at least one training task of the multiple tasks is updated.

[0008] On the other hand, embodiments of the present invention provide an electronic device for task-aware continuous learning, comprising: an image capturing device; a storage medium storing a plurality of modules; and a processor coupled to the storage medium, the processor being configured to execute the plurality of modules, wherein the plurality of modules include: an image capturing module for capturing an input image; an inference module for extracting features from the input image through a plurality of sub-models to obtain a plurality of feature maps, wherein the plurality of sub-models correspond to a plurality of tasks, and the plurality of sub-models are determined by a neural network model and a plurality of gate switches, converting the plurality of feature maps into a plurality of energy scores, selecting a target sub-model corresponding to a target task from the plurality of sub-models based on the plurality of energy scores, and outputting a prediction result corresponding to the target task through the target sub-model.

[0009] In one embodiment of the present invention, the plurality of modules further include: a training module, which receives training data associated with a plurality of tasks, wherein the training data includes a training image and a category label corresponding to the training image, performs feature extraction on the training image according to the neural network model and the plurality of gate switches to obtain a training feature map, converts the training feature map into a feature energy score, determines a loss function according to the category label, the plurality of gate switches and the feature energy score, determines a backpropagation gradient according to the loss function, and updates the neural network model and the plurality of gate switches according to the backpropagation gradient, wherein the plurality of gate switches correspond to the plurality of tasks, and a gate switch corresponding to at least one training task of the plurality of tasks is updated.

[0010] Based on the above, this invention proposes a task-aware continuous learning architecture based on energy scoring. This architecture uses multiple gate switches to categorize feature maps of a single neural network model corresponding to multiple tasks, thus determining multiple sub-models. It also allows a neural network model, combined with the gate switches of learned tasks, to automatically decide whether to reuse neural network parameters important to other old tasks based on the loss function. These parameters are then used to assist in the optimization of new tasks, resulting in better reusability of the neural network model. This allows the neural network model to retain more neurons to learn the next task and preserve important parameters from multiple sub-models, effectively avoiding catastrophic forgetting. Attached Figure Description

[0011] Figure 1 This is a schematic diagram of an electronic device according to an embodiment of the present invention;

[0012] Figure 2 This is a flowchart of the inference phase of a machine learning method according to an embodiment of the present invention;

[0013] Figure 3This is a flowchart of the training phase of a machine learning method according to an embodiment of the present invention;

[0014] Figure 4 This is a schematic diagram of the training module learning a new task in one embodiment of the present invention;

[0015] Figure 5 This is a schematic diagram illustrating the operation of the inference module in one embodiment of the present invention;

[0016] Figure 6A This is a schematic diagram of training a neural network model in one embodiment of the present invention;

[0017] Figure 6B This is a schematic diagram of a backpropagation gradient update neural network model and a corresponding task gate switch in one embodiment of the present invention.

[0018] Figure 7 This is a schematic diagram of the operation of a neural network model and a corresponding task gate switch in another embodiment of the present invention.

[0019] Figure 8 This is a schematic diagram of a neural network model in another embodiment of the present invention;

[0020] Figure 9 This is a schematic diagram of training data associated with multiple tasks in one embodiment of the present invention.

[0021] Symbol Explanation

[0022] 10: Electronic devices

[0023] 110: Processor

[0024] 120: Storage medium

[0025] 1201: Image Capture Module

[0026] 1203: Inference Module

[0027] 1205: Training Module

[0028] 130: Image capturing device

[0029] IMG: Images

[0030] NN: Neural Network Model

[0031] GS, GS_1, GS_2, GS_N: Gate switch

[0032] SUB_1, SUB_2, SUB_N: Sub-models

[0033] E, E_1, E_2, E_N, E same Ediff Energy fraction

[0034] S210, 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: Steps

[0035] 610, 630, 650, 610', 630', 650', 820: Batch Standardization Layer

[0036] 620, 640, 620', 640', 810: Convolutional layers

[0037] 910, 920: Images

[0038] H: Height

[0039] W: Width

[0040] C, C l Number of channels

[0041] C′: Number of categories

[0042] c: Category

[0043] N, L: positive integers

[0044] t, l: variables

[0045] X, X * f(X), Feature map

[0046] scaling factor

[0047] Cumulative maximum value of scaling factor

[0048] average value

[0049] Standard deviation

[0050] Translation factor

[0051] loss function

[0052] L CE Cross-entropy loss

[0053] R s (r): Gate switch regularization term

[0054] Loss E Energy loss

[0055] λ1, λ2, EL same EL diff k: parameter

[0056] Average scaling factor

[0057] g, g′, g l , g′ l :gradient

[0058] Activation parameters

[0059] y1, y2, y3, z1, z2: neurons

[0060] Importance factor

[0061] Cumulative maximum value of importance factor Detailed Implementation

[0062] Some embodiments of the present invention will now be described in detail with reference to the accompanying drawings. Components referred to in the following description, when appearing in different drawings, are considered to be the same or similar components. These embodiments are only a part of the present invention and do not disclose all possible implementations of the invention. More precisely, these embodiments are merely examples of methods and apparatuses within the scope of the present invention's patent application. Wherever possible, components / workpieces / steps using the same reference numerals in the drawings and embodiments represent the same or similar parts. Components / workpieces / steps using the same reference numerals or the same terminology in different embodiments can be referred to mutually in the relevant descriptions.

[0063] Figure 1 This is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device 10 includes a processor 110 and a storage medium 120.

[0064] Electronic device 10 can be an edge computing device implemented on an embedded platform. Electronic device 10 can be an image recognition device applied to various scenarios such as facial recognition, access control, identity verification, digital surveillance, finance, retail, unmanned stores, smart factories, drones, surgical procedures, or medical diagnostics. Electronic device 10 can also be a desktop computer, laptop computer, server, smartphone, or tablet computer; electronic device 10 is not limited by model, brand, or operating system.

[0065] Processor 110 may be, for example, a central processing unit (CPU), or other programmable general-purpose or special-purpose microcontroller (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 logic unit (ALU), complex programmable logic device (CPLD), field-programmable gate array (FPGA), or other similar elements or combinations thereof. Processor 110 may be coupled to storage medium 120 and access and execute multiple modules or various applications stored in storage medium 120.

[0066] Storage medium 120 may be 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 combinations thereof, used to store multiple modules, computer programs, or various application programs executable by processor 110. In this embodiment, the multiple modules stored in storage medium 120 include an image capturing module 1201, an inference module 1203, and a training module 1205, the functions of which will be described later.

[0067] In one embodiment, the electronic device 10 may further include an image capturing device 130. The processor 110 may be coupled to the image capturing device 130. The image capturing device 130 may be, for example, a digital camera, a video camera, or a camera lens having a lens and a photosensitive element. The photosensitive element is used to sense the intensity of light entering the lens, thereby generating an image.

[0068] Figure 2 This is a flowchart of the inference phase of a machine learning method according to an embodiment of the present invention. Figure 2 The machine learning methods shown are applicable to Figure 1 Electronic device 10. Please refer to the above. Figure 1 and Figure 2 .

[0069] In step S210, the image capturing module 1201 captures an input image. For example, the image capturing module 1201 can capture an input image via the image capturing device 130. The image capturing module 1201 can also capture an input image from a database. Alternatively, the image capturing module 1201 can receive an input image via a network.

[0070] In step S220, the inference module 1203 extracts features from the input image using multiple sub-models to obtain multiple feature maps. It should be noted that the multiple sub-models may correspond to multiple tasks, and the multiple sub-models are determined by a neural network model and multiple gate switches within that neural network model. In step S230, the inference module 1203 converts the multiple feature maps into multiple energy scores. In step S240, the inference module 1203 selects a target sub-model from the multiple sub-models based on the multiple energy scores. This target sub-model corresponds to a target task among the multiple tasks. In step S250, the inference module 1203 outputs a prediction result corresponding to the target task using the target sub-model.

[0071] Figure 3 This is a flowchart of the training phase of a machine learning method according to an embodiment of the present invention. Figure 3 The machine learning methods shown are applicable to Figure 1 Electronic device 10. Please refer to the above. Figure 1 and Figure 3In step S310, training module 1205 receives training data associated with multiple tasks. The training data includes a training image and a category label corresponding to the training image. The category label may correspond to a training task among the multiple tasks. In step S320, training module 1205 extracts features from the training image based on a neural network model and multiple gate switches to obtain a training feature map. In step S330, training module 1205 converts the training feature map into a feature energy score. In step S340, training module 1205 calculates a loss function based on the category label, multiple gate switches, and feature energy score. In step S350, training module 1205 determines the backpropagation gradient based on this loss function. In step S360, training module 1205 updates the neural network model and multiple gate switches based on the backpropagation gradient, wherein the multiple gate switches correspond to the multiple tasks, and a gate switch corresponding to at least one training task among the multiple tasks is updated.

[0072] For example, electronic device 10 can use the same neural network model to continuously learn multiple tasks 1, 2, ..., t. Multiple gate switches can each correspond to multiple tasks 1, 2, ..., t. In one embodiment, when a training task is task t, training module 1205 receives training data associated with task t. The training data includes a training image associated with task t and a category label corresponding to this training image. The category label can correspond to the category of task t (step S310). Training module 1205 extracts features from the training image based on the neural network model and the gate switches corresponding to task t among the multiple gate switches to obtain a training feature map (step S320). Training module 1205 converts the training feature map into a feature energy score (step S330). Training module 1205 calculates a loss function based on the category label, the gate switches corresponding to task t among the multiple gate switches, and the feature energy score (step S340). Training module 1205 determines the backpropagation gradient of the gate switch corresponding to task t among the plurality of gate switches based on this loss function (step S350). Training module 1205 updates the neural network model and the gate switch corresponding to task t among the plurality of gate switches based on the backpropagation gradient (step S360). Therefore, after the electronic device 10 has learned multiple tasks 1, 2, ..., t, the multiple gate switches can distinguish multiple sub-models corresponding to multiple tasks 1, 2, ..., t from the same neural network model.

[0073] It is worth mentioning that, Figure 2 The described inference stages and Figure 3 The described training phases do not restrict the order in which they are executed. In one embodiment, training data for a new task is included among multiple tasks. The electronic device 10 may execute the training data first. Figure 3 The training phase shown is used to learn new tasks. Once the electronic device 10 completes the training phase for the new task, it then executes the new task based on the neural network model that has been trained on the new task and the multiple gate switches. Figure 2 The inference phase shown predicts an input image. In one embodiment, the electronic device 10 can execute based on a pre-stored neural network model that has been pre-trained for multiple tasks and a plurality of gate switches corresponding to the neural network model. Figure 3 The inference phase. When a new task emerges from multiple tasks, the electronic device 10 trains and updates the neural network model and the gate switches corresponding to the new task based on the training data of the new task. Therefore, the electronic device 10 of the embodiments of the present invention can use a single neural network to continuously learn multiple tasks, achieving the function of extracting multi-task features. It performs task-based sequential learning on the training data of a specific task, achieving the effect of learning new things without forgetting old ones, overcoming the limitation of existing continuous learning methods that require manual specification of tasks beforehand.

[0074] In one embodiment, the neural network model includes at least one convolutional layer and at least one batch normalization layer. In another embodiment, the neural network model can be a convolutional neural network architecture, such as ResNet, VGG, or MobileNet-v2. The electronic device 10 is, for example, an edge computing device. Generally, edge computing devices have many limitations in memory space and computing power, often prohibiting the use of existing joint learning for training. Through the machine learning method of this invention, the target task is automatically identified from the input data of multiple tasks without changing the neural network architecture, achieving continuous learning by successively training on small portions of data. For edge computing devices with limited hardware specifications, this invention enables more energy-efficient and faster deep network learning.

[0075] Figure 4 This is a schematic diagram illustrating the training module learning a new task in one embodiment of the present invention. Please refer to... Figure 4 In step S410, electronic device 10 receives training data for a new task. In step S420, training module 1205 executes... Figure 3 The process involves updating the parameters of the neural network model NN and multiple gate switches GS based on the training data for the new task to complete the training. In step S430, after the current task has been trained, the next task is trained when the next task needs to be trained.

[0076] Specifically, for training data of any new task, multiple gate switches GS restrict a portion of the neural network model NN from computation. Thus, the neural network model NN, combined with multiple gate switches GS, can determine multiple sub-models. These sub-models extract features from the training data using important neurons to obtain training feature maps. The training module 1205 then calculates feature energy scores based on the training feature maps. Next, the training module 1205 determines a loss function based on the class labels of the training data, the multiple gate switches, and the feature energy scores. This loss function determines the backpropagation gradient. The training module 1205 updates the neural network model NN and the multiple gate switches GS based on the backpropagation gradient. In one embodiment, during the backpropagation gradient parameter update process, the multiple gate switches GS correspond to multiple tasks 1, 2, ..., t, and at least one gate switch corresponding to one of the training tasks 1, 2, ..., t is updated. The backpropagation gradient automatically determines the importance of parameters during the training process; if the importance is high, the corresponding gate switch is activated, and the activated gate switch adaptively updates a portion of the parameters of the neural network model NN. In other words, after the electronic device 10 has learned multiple tasks 1, 2, ..., t, multiple gate switches GS can distinguish multiple sub-models corresponding to multiple tasks 1, 2, ..., t from the same neural network model NN.

[0077] In one embodiment of the present invention, the training module 1205 determines multiple activation parameters based on multiple gate switches GS. After calculating the loss based on the multiple 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 multiple gate switches GS based on the adjusted backpropagation gradient. In one embodiment, during the backpropagation gradient parameter update process, the multiple gate switches GS correspond to multiple tasks 1, 2, ..., t, and at least one gate switch corresponding to one of the training tasks 1, 2, ..., t is updated.

[0078] In one embodiment of the present invention, the loss function includes a cross entropy loss, a polarization regularization term, and an energy loss.

[0079] In one embodiment of the present invention, the neural network model NN includes at least one convolutional layer and at least one batch normalization layer, and each of the plurality of gate switches GS includes scaling factors of at least one batch normalization layer. In one embodiment, the scaling factor has the same dimension as the convolutional layer, and the scaling factor of each batch normalization layer is associated with the convolutional kernel of the corresponding convolutional layer. In one embodiment of the present invention, the gate switch regularization term is associated with multiple scaling factors.

[0080] In one embodiment of the present invention, the training module 1205 passes the training image through at least one convolutional layer to obtain an input feature map. The training module 1205 then passes the input feature map through at least one batch normalization layer to perform a normalization operation with the corresponding scaling factor to obtain a training feature map.

[0081] Figure 5 This is a schematic diagram illustrating the operation of the inference module 1203 in one embodiment of the present invention. Please refer to... Figure 5 In step S510, the inference module 1203 extracts the input image IMG. Specifically, for a neural network model NN that has learned N tasks (N is a positive integer), there are N sets of gate switches GS_1, GS_2, ..., GS_N. Each gate switch GS_1, GS_2, ..., GS_N records the number of neural network models NN that can be used to perform calculations for multiple tasks. The multiple gate switches GS_1, GS_2, ..., GS_N, combined with the neural network model NN, determine multiple sub-models SUB_1, SUB_2, ..., SUB_N that can extract multiple feature maps from the input image IMG.

[0082] It is worth mentioning that, in the embodiments of the present invention, multiple sub-models SUB_1, SUB_2, ..., SUB_N use the same neural network model NN. That is, multiple gate switches GS_1, GS_2, ..., GS_N are distinguished from multiple sub-models corresponding to multiple tasks by the same neural network model NN.

[0083] In step S520, the inference module 1203 extracts features from the input image IMG using multiple sub-models SUB_1, SUB_2, ..., SUB_N to obtain multiple feature maps. In step S530, the inference module 1203 converts the multiple feature maps corresponding to the multiple sub-models SUB_1, SUB_2, ..., SUB_N into multiple energy scores E_1, E_2, ..., E_N. The energy scores E_1, E_2, ..., E_N are scalars representing the stability of the sub-models SUB_1, SUB_2, ..., SUB_N. In terms of energy, the lower the scalar, the more stable the sub-model. The energy scores E_1, E_2, ..., E_N measure the degree of correlation between the input image IMG and the sub-models, thereby achieving the effect of task perception. The multiple sub-models SUB_1, SUB_2, ..., SUB_N correspond to multiple tasks.

[0084] In step S540, the inference module 1203 selects a target sub-model corresponding to a target task from multiple sub-models SUB_1, SUB_2, ..., SUB_N based on multiple energy scores E_1, E_2, ..., E_N. The target task is one of multiple trained tasks, specifically the task of processing the input image IMG. This target sub-model is determined based on the multiple energy scores E_1, E_2, ..., E_N, and is the sub-model most relevant to the target task.

[0085] In one embodiment of the present invention, the inference module 1203 selects the sub-model corresponding to the minimum value of the plurality of energy fractions E_1, E_2, ..., E_N as the target sub-model. In some embodiments, the plurality of tasks may include a first task and a second task, and the target sub-model may be a sub-model corresponding to the first task or a sub-model corresponding to the second task. In some embodiments, the target sub-model may also be one of the plurality of sub-models corresponding to the plurality of tasks.

[0086] 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 of the corresponding target sub-model into a confidence score corresponding to the prediction category of the target task through a normalized exponential function, and obtains the corresponding prediction result.

[0087] Figure 6A This is a schematic diagram illustrating the training of a neural network model in one embodiment of the present invention. Please refer to it. Figure 4 and Figure 6A In one embodiment, the neural network model includes at least one convolutional layer and at least one batch normalization layer. Figure 6A As shown, the neural network model NN includes batch normalization layers 610, 630, and 650, and convolutional layers 620 and 640. For example, the neural network model NN has been trained on t tasks, given input data X∈R. H×W×C (H is height, W is width, C is number of channels), the feature map X is obtained after feature extraction through a 620-layer convolutional layer. * ∈R H×W×C The feature map is then obtained by performing normalization operations through batch normalization layer 630. Taking batch normalization layer 630 as an example, this normalization operation can be calculated by the following formula (1):

[0088]

[0089] in For the standardized feature map, X * The feature map is after passing through the convolutional layer. Scaling factor It is an average value. One standard deviation It is a shifting factor.

[0090] In formula (1), the variables l = 1, ..., L-1 represent convolutional layers, L is a positive integer, and the variable t represents the current task. This represents the average value of the input feature maps from different channels within the same batch. The standard deviation and scaling factor of the input feature maps from different channels in the same batch. Translation factor These are the trainable parameters. In one embodiment, The initial value is set to 0.5. The initial value is set to 0. Scaling factor. It has the function of scaling feature maps transmitted from convolutional layers.

[0091] In one embodiment of the present invention, each of the plurality of gate switches GS includes a plurality of scaling factors of at least one batch normalization layer. And multiple scaling factors Multiple convolutional kernels associated with at least one convolutional layer. Specifically, the scaling factor in the batch normalization layer. This can be used to measure the importance of the corresponding convolutional kernel in a convolutional layer. In embodiments of the present invention, a specific batch normalization layer is provided for each learning task, and each task uses its corresponding batch normalization layer to remember the data distribution of that specific task. and And utilize the scaling factor of the corresponding task. The records correspond to multiple convolution kernel locations that are important for the target task.

[0092] In detail, each convolutional kernel in a convolutional layer has a corresponding scaling factor in the dimension of the number of channels C. This represents the importance of the convolutional kernel in the convolutional layer. In one embodiment, the scaling factor... The number of features corresponds to feature map X * The number of channels. Due to the scaling factor. Feature map X * The scaling characteristic limits the computation of the neural network model NN as a gate switch GS. In one embodiment, when the scaling factor... A non-zero value indicates that the feature map corresponding to this channel needs to participate in the computation, thus allowing the feature map to pass through the batch normalization layer before proceeding to the next layer. Conversely, when the scaling factor is zero... If the value is 0, it means that the feature map corresponding to this channel is not important and does not need to be passed to the next layer.

[0093] In other words, scaling factor It can determine whether to activate neurons in a neural network model (NN) for a specific target task. Figure 6A For example, for the current task t, the scaling factors corresponding to batch normalization layers 610, 630, and 650 are... as well as The neurons are activated, and the feature map corresponding to this channel is passed to the next layer.

[0094] It should be noted that after step S60, for the new task t+1, the given feature map X∈R H×W×C Training module 1205 replaces the batch normalized layers 610', 630', and 650' with new ones. However, convolutional layers 620' and 640' retain their original, identical convolutional layers 620 and 640' for the training phase. Figure 6A As shown, for the new task t+1, the corresponding scaling factors in the new batch normalization layers 610', 630', and 650' are... as well as The neurons are activated, and the feature map corresponding to this channel is passed to the next layer.

[0095] When the training data X∈R for the new task t+1 H×W×C After the training module 1205 performs feature extraction based on the neural network model NN and multiple gate switches GS, a training feature map f(X)∈R can be obtained. 1×C′ , where C′ is the number of output categories. The training module 1205 converts the training feature map f(X) into an energy score E.

[0096] The energy fraction E is calculated using the following formula (2):

[0097]

[0098] Where E is the energy fraction, f(X) c C represents the value of the feature map in category c, and C′ represents the number of categories.

[0099] Next, the training module 1205 determines a loss function based on the category labels of the training data, multiple gate switches GS, and energy fraction E. Training module 1205 uses the loss function Backpropagation gradient updates the neural network model NN and the gate switch GS corresponding to this training task.

[0100] loss function This is expressed by the following formula (3):

[0101]

[0102] Where L cE For cross-entropy loss, R s (r) represents the gate switch regularization term, Loss E Let λ be the energy loss, and λ1 and λ2 be parameters.

[0103] Cross-entropy loss L CE It is determined by the category labels of the training data.

[0104] Energy loss is calculated using the following formula (4):

[0105] Loss E =max(0, E) same -EL same )+max(0,EL diff -E diff (4)

[0106] Where E same E represents the energy score of samples performing the same task. diff For the energy scores of samples from different tasks, EL same and EL diff For parameters.

[0107] Gate switch regularization term R s (r) is calculated by the following formula (5):

[0108]

[0109] in Multiple scaling factors, where L is the number of layers, C l Here, k is the number of channels.

[0110] In formula (5), the gate switch regularization term R s (r) can be used to reduce the number of activated neurons, where This represents the scaling factor for each channel in each batch of the normalized layer. Take the absolute value, this Each scaling factor can be adjusted. After training, it approaches zero. The scaling factor for the entire neural network model The average value, Item drives all scaling factors Increase The difference, i.e., the scaling factor. This will have a polarization effect, causing a significant difference between important and unimportant information. The parameters k, λ1, and λ2 in formulas (2) and (5) can be adjusted according to different training datasets.

[0111] During the backpropagation gradient learning of the new task t+1, the scaling factor You will receive the gradient g from the activated layer. l Training module 1205 is based on the scaling factor Determine whether multiple corresponding convolution parameters are important and activate them, if one of the scaling factors in the t trained tasks is more than one of them. This indicates that convolution parameters at the same location have high importance, so... This indicates that the convolution parameters are activated by at least one scaling factor. Training module 1205 adjusts the backpropagation gradient g based on the activation parameter act(x). l Training module 1205 is based on the adjusted backpropagation gradient g′. l Update the neural network model NN and the gate switch GS (scaling factor) corresponding to the new task t+1. ).

[0112] The adjusted backpropagation gradient is calculated by the following formula (6):

[0113]

[0114] Where g′ l For the adjusted backpropagation gradient, g l Let be the backpropagation gradient, where This represents the cumulative maximum value of the scaling factor for different tasks with convolution parameters at the same position.

[0115] Figure 6B This is a schematic diagram of a backpropagation gradient update neural network model NN and a corresponding task gate switch GS in one embodiment of the present invention. Please refer to... Figure 6B Taking batch normalization layer 630' as an example, in step S61, batch normalization layer 630' obtains the backpropagation gradient g transmitted back by neuron z1. In step S62, training module 1205 adjusts the batch normalization layer 630' according to multiple scaling factors. Multiple activation parameters act(x) are determined to adjust the backpropagation gradient g′ and multiple scaling factors of the batch normalized layer 610' are applied based on the adjusted backpropagation gradient g′. And update the parameters of neurons y1 and y3.

[0116] It should be noted that when performing backpropagation on the new task t+1, training module 1205 records the activated scaling factors for the t previously trained tasks. The position of the convolutional layer. Since the parameters of the corresponding convolutional layer are highly important to a certain old task, it is undesirable for them to be modified by the gradient of the new task. The backward gradient process for the new task protects important convolutional neurons from being modified by the new task, but does not restrict whether the gate switch GS of the new task activates neurons important to the old task. Therefore, convolutional kernels with high parameter importance can be effectively and repeatedly used for multiple tasks. For example, in Figure 6B The neurons y2 and z2 shown are convolutional neurons that are preserved. Therefore, the parameters of neurons y2 and z2 will not be modified during the backpropagation gradient process in step S63.

[0117] It should be noted that the above Figure 6A , Figure 6B The described embodiment is a preferred embodiment of the present invention. Multiple scaling factors in the batch normalization layer are used to achieve multiple gate switches (GS) corresponding to multiple tasks, thus adaptively identifying the target task from multiple tasks. However, without departing from the spirit and scope of the present invention, the multiple gate switches (GS) are not limited to being implemented using a batch normalization layer. In some embodiments, the multiple gate switches (GS) can also be implemented by performing element-wise multiplication of the feature map using multiple importance factors.

[0118] Figure 7 This is a schematic diagram illustrating the operation of a neural network model and a corresponding gate switch in another embodiment of the present invention. In one embodiment, each of the multiple gate switches GS includes multiple importance factors. The inference module 1203 passes the 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 of the output feature map with the multiple importance factors to obtain multiple feature maps. In step S71, the inference module 1203 passes the multiple feature maps through an activation function to obtain a prediction result.

[0119] Multiple importance factors are calculated using the following formula (7):

[0120]

[0121] in As an importance factor, The output feature map is denoted by k, which is a parameter.

[0122] In one embodiment of the present invention, the loss function includes an importance factor regularization term, wherein the importance factor regularization term is associated with multiple importance factors.

[0123] In another embodiment of the invention, the adjusted backpropagation gradient is calculated by the following formula (8):

[0124]

[0125] Where g′ l For the adjusted backpropagation gradient, g l Let be the backpropagation gradient, where This is the maximum value of the multiple importance factors.

[0126] Figure 8 This is a schematic diagram of a neural network model NN in another embodiment of the present invention. The neural network model NN includes a convolutional layer 810 and a batch normalization layer 820. (See also...) Figure 7 Multiple importance factors are associated with multiple convolutional kernels in convolutional layer 810. In one embodiment, the neural network model NN can be a convolutional neural network architecture, such as ResNet, VGG, or MobileNet-v2. It should be noted that... Figure 7 , Figure 8 In one embodiment, multiple gate switches GS can be used to screen important parameters of neurons in convolutional layer 810 by performing element-wise multiplication of multiple importance factors, and are not limited to batch normalization layer 820 of neural network model NN.

[0127] Figure 9 This is a schematic diagram illustrating training data associated with multiple tasks in one embodiment of the present invention. In one embodiment, the machine learning method of the present invention can be applied to access control management to enhance the recognition capability of faces wearing masks. For example, a face image 910 with a mask and its corresponding category label can be used as the first task for training. Then, in step S90, a face image 920 with a mask is used as the new task for training. In this example, the machine learning method of this invention does not need to access or save the data of the old task. Instead, it takes the new dataset of 920 face images with masks as the new task. Since the multiple gate switches updated in the new task can be trained to select convolutional neurons that are important to the new task, and since the new task allows the use of parameters from the old task, the task of learning face image recognition with masks can directly utilize the features of the eyes, eyebrows, and forehead that are not covered by the mask, which were learned in the old task. As for parameters that are not important in the new task, such as the mouth and nose, the new task does not activate the relevant convolutional neurons in Task 1, and uses convolutional neurons that are not important to the old task model to learn the detailed features of the face after the mask is worn, such as the shadow area of ​​the nose after the mask is worn or the corner curvature of the face projection surface after the mask is covered.

[0128] In one embodiment, the machine learning method of this invention can be applied to product similarity search. For example, the first task is to identify spring clothing. Then, when the autumn / winter season changes, a new task is learned to identify winter clothing. The model for the new task is trained with images of winter clothing, since the model for the old task has already been trained with the general features of the clothing. Because the multiple gate switches updated for the new task can be selected by training to select convolutional neurons that are important to the new task, and because the new task allows the use of parameters from the old task, the task of learning image recognition of winter clothing can directly utilize the detailed features of the clothing (such as collars, sleeves, and buttons, etc.) already trained in the old task, achieving better reusability and improving the computing performance of the electronic device.

[0129] In one embodiment, the machine learning method of this invention can be applied to defect detection of surface-mount components on printed circuit boards manufactured in a smart factory. For example, the first task is to distinguish defects in a first-type resistor, which includes images categorized as normal and abnormal. When a second-type resistor needs to be added to the printed circuit board, since the neural network model for the first task has already learned features such as the resistor's shape and defects, multiple gate switches are used to update the image data of the second-type resistor for the second task to select convolutional neurons that are important to the second task from the first task, such as component shape and some frequently occurring offset defects. That is, the new task can reuse convolutional kernels important to the old task, and use convolutional kernels unimportant to the old task to learn features lacking in the first task. In this way, existing parameters can be effectively utilized, and defect features that need to be emphasized in the new task can be learned. Thus, embodiments of this invention differentiate different sub-models within a single neural network model to solve different tasks.

[0130] In summary, this invention proposes a task-aware continuous learning architecture based on energy scoring. By using multiple gate switches, it categorizes feature maps from a single neural network model corresponding to multiple tasks, thus determining multiple sub-models. It allows for the automatic selection of convolutional parameters important for other previously used tasks from a single neural network model, combined with the corresponding task's gate switches. Then, it uses these unused convolutional parameters to learn knowledge for new tasks. Finally, the loss function determines the backpropagation gradient to aid in the optimization of new tasks, resulting in better reusability of the neural network model. This allows the neural network model to retain more neurons to learn the next task and preserves important parameters from multiple sub-models, effectively avoiding catastrophic forgetting.

[0131] Although the present invention has been disclosed in conjunction with the above embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications and refinements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention should be defined by the appended claims.

Claims

1. A continuous learning machine learning method, comprising: Capture the input image; Multiple feature maps are obtained by extracting features from the input image through multiple sub-models, wherein the multiple sub-models correspond to multiple tasks, and the multiple sub-models are determined by a neural network model and multiple gate switches; The multiple feature maps are converted into multiple energy fractions; Based on the multiple energy scores, the sub-model corresponding to the minimum value of the multiple energy scores is selected from the multiple sub-models, and this sub-model is used as the target sub-model corresponding to the target task among the multiple tasks; and The target sub-model outputs a prediction result corresponding to the target task. The conversion of the multiple feature maps into the multiple energy fractions is calculated using the following formula: in Energy fraction The value of the feature map in category c. This represents the number of categories.

2. The machine learning method of claim 1, wherein the neural network model includes at least one convolutional layer and at least one batch normalization layer.

3. The machine learning method of claim 2, wherein each of the plurality of gate switches includes a plurality of scaling factors of the at least one batch normalization layer, and the plurality of scaling factors are associated with a plurality of convolutional kernels of the at least one convolutional layer, wherein the step of obtaining the plurality of feature maps by extracting features from the input image through the plurality of sub-models includes: The input image is passed through the at least one convolutional layer to obtain an input feature map; The multiple feature maps are obtained by standardizing the input feature map with the multiple scaling factors of each of the multiple gate switches through the at least one batch standardization layer.

4. The machine learning method as described in claim 3, wherein the normalization operation is calculated by the following formula: in For the multiple feature maps, The input feature map, For the multiple scaling factors, It is an average value. One standard deviation It is a shifting factor.

5. The machine learning method of claim 1, wherein each of the plurality of gate switches includes a plurality of importance factors, wherein the step of obtaining the plurality of feature maps by extracting features from the input image through the plurality of sub-models includes: The input image is passed through the neural network model to obtain the output feature map; The output feature map is obtained by performing element-wise multiplication with the multiple importance factors of each of the multiple gate switches.

6. The machine learning method of claim 5, wherein the plurality of importance factors are calculated by the following formula: in As an importance factor, The output feature map, For parameters.

7. The machine learning method as described in claim 1, further comprising: Receive training data associated with the plurality of tasks, wherein the training data includes training images and category labels corresponding to the training images; A training feature map is obtained by extracting features from the training image based on the neural network model and the multiple gate switches. The training feature map is converted into feature energy scores; The loss function is determined based on the category label, the plurality of gate switches, and the characteristic energy score; The backpropagation gradient is determined based on the loss function. as well as The neural network model and the plurality of gate switches are updated according to the backpropagation gradient, wherein the plurality of gate switches correspond to the plurality of tasks, and the gate switch corresponding to at least one training task of the plurality of tasks is updated.

8. The machine learning method of claim 7, wherein the neural network model includes at least one convolutional layer and at least one batch normalization layer, each of the plurality of gate switches includes a plurality of scaling factors of the at least one batch normalization layer, and the plurality of scaling factors are associated with a plurality of convolutional kernels of the at least one convolutional layer, wherein the step of extracting features from the training image based on the neural network model and the plurality of gate switches to obtain the training feature map includes: The training image is passed through the at least one convolutional layer to obtain the input feature map; The training feature map is obtained by standardizing the input feature map with the plurality of scaling factors through the at least one batch standardization layer.

9. The machine learning method of claim 8, wherein the loss function comprises: Cross-entropy loss; Gate switch regularization term; as well as Energy loss.

10. The machine learning method of claim 9, wherein the gate switch regularization term is associated with the plurality of scaling factors.

11. The machine learning method of claim 10, wherein the gate switch regularization term is calculated by the following formula: , in For the gate switch regularization term, For the multiple scaling factors, For the number of floors, For the number of channels, For parameters.

12. The machine learning method of claim 9, wherein the energy loss is calculated by the following formula: in For the energy loss, The energy score for samples of the same task. Energy scores for samples from different tasks. and For parameters.

13. The machine learning method of claim 8, wherein the step of updating the neural network model and the plurality of gate switches according to the backpropagation gradient includes: Multiple activation parameters are determined based on the multiple gate switches; The backpropagation gradient is adjusted according to the plurality of activation parameters; The neural network model and the plurality of gate switches are updated based on the adjusted backpropagation gradient.

14. The machine learning method of claim 13, wherein the adjusted backpropagation gradient is calculated by the following formula: in For the adjusted backpropagation gradient, Let be the backpropagation gradient, where This represents the cumulative maximum value of the scaling factor for tasks 1 through t, corresponding to the same convolution parameters at the same position.

15. The machine learning method of claim 7, wherein each of the plurality of gate switches includes a plurality of importance factors, wherein the loss function includes an importance factor regularization term, wherein the importance factor regularization term is associated with the plurality of importance factors.

16. The machine learning method of claim 15, wherein the step of updating the neural network model and the plurality of gate switches according to the backpropagation gradient includes: Multiple activation parameters are determined based on the multiple gate switches; The backpropagation gradient is adjusted according to the plurality of activation parameters; The neural network model and the plurality of gate switches are updated based on the adjusted backpropagation gradient, wherein the adjusted backpropagation gradient is calculated by the following formula: in For the adjusted backpropagation gradient, Let be the backpropagation gradient, where This represents the cumulative maximum value of the importance factors for tasks 1 through t corresponding to the same convolution parameters at the same position.

17. An electronic device for task-aware continuous learning, comprising: Storage medium, storing multiple modules; as well as A processor, coupled to the storage medium, configured to execute the plurality of modules, wherein the plurality of modules includes: The image capturing module captures the input image; The inference module extracts features from the input image using multiple sub-models to obtain multiple feature maps. These sub-models correspond to multiple tasks and are determined by a neural network model and multiple gate switches. The feature maps are converted into multiple energy scores. Based on these energy scores, the sub-model corresponding to the minimum energy score is selected as the target sub-model for the target task. Finally, the target sub-model outputs the prediction result corresponding to the target task. The conversion of the multiple feature maps into the multiple energy fractions is calculated using the following formula: in Energy fraction The value of the feature map in category c. This represents the number of categories.

18. The electronic device of claim 17, wherein the plurality of modules further comprises: The training module receives training data associated with the plurality of tasks, wherein the training data includes training images and category labels corresponding to the training images. It extracts features from the training images based on the neural network model and the plurality of gate switches to obtain a training feature map. The training feature map is converted into a feature energy score. A loss function is determined based on the category labels, the plurality of gate switches, and the feature energy score. A backpropagation gradient is determined based on the loss function, and the neural network model and the plurality of gate switches are updated based on the backpropagation gradient. The plurality of gate switches correspond to the plurality of tasks, and the gate switch corresponding to at least one training task of the plurality of tasks is updated.