Image classification method, system and medium integrating dynamic task subspace
By integrating dynamic task subspaces, an image classification model is constructed. The parameters are optimized using cross-entropy and knowledge distillation loss, which solves the problems of task confusion and high storage cost in dynamic structure methods, and achieves image classification with high accuracy and low storage cost.
Patent Information
- Application Number
- CN202311563251.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-11-21
AI Technical Summary
Existing image classification methods based on dynamic structures suffer from inter-task confusion in incremental learning of image categories, resulting in low classification accuracy and high parameter storage costs, especially when dealing with image data with high category similarity and a large number of tasks.
We adopt an integrated dynamic task subspace approach, which constructs shallow and deep image feature extractors, combines cross-entropy and knowledge distillation loss, dynamically adjusts the model structure, builds an image task subspace feature extractor, and uses total loss to optimize parameters, thereby improving classification accuracy and reducing storage costs.
It improves the accuracy of image classification, reduces parameter storage costs, solves the problem of confusion between tasks, and retains skills for old tasks while adapting to new tasks.
Smart Images

Figure CN117475237B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to an image classification method, system, and medium that integrates a dynamic task subspace. Background Technology
[0002] Dynamic structure methods are a major category of methods in incremental image classification, allowing for dynamic adjustment and modification of the classification model's structure during incremental learning. Dynamic structure methods can progressively increase network capacity to adapt to new tasks while retaining previously acquired skills. However, current image classification methods based on dynamic structure suffer from inter-task confusion, leading to low classification accuracy for target categories in incremental image classification scenarios, especially for image data with high similarity between categories. Furthermore, storing classification model parameters consumes significant storage space when dealing with a large number of tasks, placing a considerable burden on edge device applications. In summary, existing image classification methods suffer from low accuracy and high parameter storage costs. Summary of the Invention
[0003] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.
[0004] This invention provides an image classification method, system, and medium that integrates dynamic task subspaces, effectively improving classification accuracy and reducing parameter storage costs.
[0005] On one hand, embodiments of the present invention provide an image classification method integrating dynamic task subspaces, comprising the following steps:
[0006] Obtain the image to be classified;
[0007] The image to be classified is input into the image dynamic task subspace model to obtain the image classification result;
[0008] The image dynamic task subspace model is obtained through the following steps:
[0009] Construct a shallow feature extractor for images based on the sharing coefficients and subspaces;
[0010] Construct a deep feature extractor for images based on several deep convolutional layers;
[0011] Based on the image shallow feature extractor and the image deep feature extractor, an image task subspace feature extractor is constructed;
[0012] Acquire training images;
[0013] Based on the training image and the old image task feature extractor, a first super feature is obtained. The old image task feature extractor is constructed in the same way as the image task subspace feature extractor.
[0014] The second super feature is obtained based on the training image and the image task subspace feature extractor;
[0015] Based on the old task classification layer of the image and the second super feature, the classification loss is calculated using cross-entropy;
[0016] Based on the first super feature and the old task classification layer of the image, calculate the knowledge distillation loss;
[0017] Calculate the total loss based on the classification loss, the knowledge distillation loss, and the image discrimination classification layer;
[0018] The parameters of the image task subspace feature extractor are updated based on the total loss until the total loss meets the preset loss requirement, thus obtaining the image dynamic task subspace model.
[0019] In some embodiments, constructing an image shallow feature extractor based on shared coefficients and subspace includes:
[0020] Based on the shared coefficients and the subspace, shallow convolutional layers are reconstructed using tensor shrinkage.
[0021] The image shallow feature extractor is constructed based on several shallow convolutional layers.
[0022] In some embodiments, obtaining the first super feature based on the training image and the old image task feature extractor includes:
[0023] The training images are respectively input into several image old task feature extractors, and the corresponding first output features are output;
[0024] Multiple first output features are concatenated to obtain the first super feature.
[0025] In some embodiments, obtaining the second super feature based on the training image and the image task subspace feature extractor includes:
[0026] The training image is input into the image task subspace feature extractor, which outputs a second output feature.
[0027] The second super feature is obtained by concatenating multiple first output features and second output features.
[0028] In some embodiments, calculating the classification loss using cross-entropy based on the old image classification layer and the second super feature includes:
[0029] Initialize the parameters of the new task classification layer of the image based on the parameters of the old task classification layer of the image.
[0030] The second super feature is input into the new task classification layer of the image to obtain the first original value;
[0031] The classification loss is calculated using cross-entropy based on the first original value.
[0032] In some embodiments, calculating the knowledge distillation loss based on the first super feature and the image old task classification layer includes:
[0033] The first super feature is input into the old task classification layer of the image to obtain the second original value;
[0034] The knowledge distillation loss is calculated based on the first original value and the second original value.
[0035] In some embodiments, calculating the total loss based on the classification loss, the knowledge distillation loss, and the image discriminative classification layer includes:
[0036] The second output feature is input into the image discrimination and classification layer, and the discrimination loss is calculated using cross-entropy.
[0037] The total loss is calculated based on the classification loss, the knowledge distillation loss, and the discrimination loss.
[0038] On the other hand, embodiments of the present invention provide an image classification system integrating a dynamic task subspace, comprising:
[0039] The first module is used to acquire the image to be classified.
[0040] The second module is used to input the image to be classified into the image dynamic task subspace model to obtain the image classification result;
[0041] The image dynamic task subspace model is obtained through the following steps:
[0042] Construct a shallow feature extractor for images based on the sharing coefficients and subspaces;
[0043] Construct a deep feature extractor for images based on several deep convolutional layers;
[0044] Based on the image shallow feature extractor and the image deep feature extractor, an image task subspace feature extractor is constructed;
[0045] Acquire training images;
[0046] Based on the training image and the old image task feature extractor, a first super feature is obtained. The old image task feature extractor is constructed in the same way as the image task subspace feature extractor.
[0047] The second super feature is obtained based on the training image and the image task subspace feature extractor;
[0048] Based on the old task classification layer of the image and the second super feature, the classification loss is calculated using cross-entropy;
[0049] Based on the first super feature and the old task classification layer of the image, calculate the knowledge distillation loss;
[0050] Calculate the total loss based on the classification loss, the knowledge distillation loss, and the image discrimination classification layer;
[0051] The parameters of the image task subspace feature extractor are updated based on the total loss until the total loss meets the preset loss requirement, thus obtaining the image dynamic task subspace model.
[0052] On the other hand, embodiments of the present invention provide an image classification system integrating a dynamic task subspace, comprising:
[0053] At least one memory for storing programs;
[0054] At least one processor is configured to load the program to execute the image classification method for an integrated dynamic task subspace.
[0055] On the other hand, embodiments of the present invention provide a storage medium storing a computer-executable program, which, when executed by a processor, is used to implement the image classification method for an integrated dynamic task subspace.
[0056] The beneficial effects of this invention are as follows:
[0057] This invention first acquires the image to be classified, then inputs it into an image dynamic task subspace model to obtain the image classification result. The image dynamic task subspace model is obtained through the following steps: first, a shallow image feature extractor is constructed, then a deep image feature extractor is constructed, and finally, an image task subspace feature extractor is constructed. Then, training images are acquired. Based on the training images and the image task subspace feature extractor, a first super feature is obtained. Based on the training images and the image task subspace feature extractor, a second super feature is obtained. Finally, cross-entropy is used to calculate the classification loss, the knowledge distillation loss is calculated, and the total loss is calculated. The parameters of the image task subspace feature extractor are updated based on the total loss to obtain the image dynamic task subspace model, which improves classification accuracy and reduces parameter storage costs.
[0058] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the description, claims, and drawings. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 This is a flowchart illustrating an image classification method integrating dynamic task subspaces according to an embodiment of the present invention;
[0061] Figure 2 This is a flowchart illustrating the training of an image dynamic task subspace model according to an embodiment of the present invention;
[0062] Figure 3 This is a schematic diagram of a dynamic task subspace hybrid network expansion process according to an embodiment of the present invention;
[0063] Figure 4 This is a schematic diagram of a dynamic feature learning and aggregation process according to an embodiment of the present invention. Detailed Implementation
[0064] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0065] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The step numbers in the following embodiments are for ease of explanation only, and the order of the steps is not limited. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0066] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.
[0067] Unless otherwise defined, all technical and scientific terms used in the embodiments of this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in the embodiments of this invention is for descriptive purposes only and is not intended to limit the invention.
[0068] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application are explained as follows:
[0069] Image class-incremental learning is a specific learning method in deep learning designed to solve the incremental learning problem in image classification tasks. It allows existing neural network classification models to continue learning and recognizing new image categories without significantly impacting the classification performance of existing categories. A common setup is as follows: different task data are input at different times; each task may contain one or more categories; and when new task data is input, data from past tasks cannot be retained or can only be partially retained. The classification model must continuously learn to recognize the categories of new tasks while retaining its ability to recognize categories from older tasks, especially when there is no overlap between different task categories. For example, if a goat appears in the first task, subsequent tasks will not include data of that category.
[0070] A Convolutional Neural Network (CNN) is a deep learning model. A CNN consists of multiple layers, including convolutional layers. Convolutional layers use a set of convolutional kernels (convolutional filters) to perform convolution operations on local regions of the input image, thereby extracting image features. This convolution operation can effectively capture the spatial structure and local relationships in an image, enabling the network to automatically learn features such as edges, textures, and shapes. In addition to convolutional layers, CNNs typically include pooling layers and fully connected layers. Pooling layers reduce the spatial dimensionality of feature maps, decrease the number of parameters, and improve the model's translation invariance and robustness. Fully connected layers map the feature maps to class labels for final classification and prediction.
[0071] Data replay is a key technique in incremental image category learning, used to address the problem of forgetting previously learned categories (old task categories, which may contain multiple categories) during incremental learning. In image category incremental learning, when introducing a new image category (new task category, which may contain multiple categories) for training, it's crucial to ensure that learning the new task category doesn't negatively impact the performance of the old task categories. The core idea of data replay is to address the forgetting problem by retaining and reusing training data from the old task categories. When a new task category is introduced for training, in addition to using samples from the new task category, a subset of samples from the old task categories is selected for replay, i.e., re-input into the classification model for training. The purpose of this is to allow the classification model to observe the old task categories again, thus maintaining its ability to recognize them.
[0072] Dynamic-Architecture-Based Methods: These are a major class of methods in incremental image category learning, designed to address the flexibility and scalability issues inherent in the incremental learning process. Based on dynamic architecture, these methods allow for dynamic adjustments and modifications to the classification model's structure during incremental learning. Traditional image category incremental learning typically uses a fixed classification model architecture to handle all categories. This approach can lead to classification models that are either too complex or too simple, failing to adapt well to variations in the features and complexity of different categories. Dynamic-Architecture-Based Methods, by allowing the classification model's structure to change during incremental learning, enable the model to better adapt to the features and requirements of new categories.
[0073] Inter-Task Confusion: In incremental image category learning, this refers to the inability of a classification model to distinguish categories across different tasks. When using dynamic structured networks for incremental image category learning, due to the existence of multiple sub-networks, the classification model may be able to distinguish categories within a single task, but fail to distinguish categories across different tasks, i.e., it cannot distinguish all categories.
[0074] Task subspace modeling methods are a class of lightweight, dynamically structured methods that demonstrate the ability of a low-dimensional subspace within the parameters of the entire neural network model to represent different tasks, allowing tasks to be represented as underlying base tasks and linear combinations thereof. These methods save memory because they only require extending a small number of parameters to construct a new subnetwork that dynamically extends the original classification model structure.
[0075] The embodiments of this application will be explained in detail below with reference to the accompanying drawings:
[0076] like Figure 1 As shown, this embodiment of the invention provides an image classification method integrating a dynamic task subspace. This method can be applied to the background processor, server, or cloud device corresponding to image classification software. In application, the method includes, but is not limited to, the following steps:
[0077] Step S11: Obtain the image to be classified;
[0078] Step S12: Input the image to be classified into the image dynamic task subspace model to obtain the image classification result.
[0079] In this embodiment, image data is first collected, processed to obtain the image to be classified, and then input into the image dynamic task subspace model to obtain the image classification result. The image classification result includes the classification category corresponding to the image to be classified.
[0080] In this embodiment, as Figure 2 As shown, the specific implementation process for obtaining the image dynamic task subspace model includes, but is not limited to, steps S201-S210:
[0081] Step S201: Construct a shallow feature extractor for the image based on the sharing coefficients and subspace.
[0082] In this embodiment, the image shallow feature extractor is constructed based on the shared coefficients and subspace. This can be achieved by first reconstructing shallow convolutional layers using tensor shrinkage based on the shared coefficients and subspace, and then constructing the image shallow feature extractor based on several shallow convolutional layers.
[0083] In this embodiment, the dynamic task subspace hybrid network expansion process is as follows: Figure 3 As shown, when the t-th task arrives, the network structure of the classification model will be expanded. Figure 3 The module at the bottom represents the construction process of the feature extractor when the t-th task is input; the construction process of the feature extractor network structure for other tasks is the same. When the t-th task arrives, a new subspace can be initialized for task t. (Task-specific subspaces) Based on the shared coefficients and subspaces, shallow convolutional layers are reconstructed using tensor contraction. Specifically, when t=1, the shared coefficients α can be adjusted. s Initialization is performed using (Task-shared coefficients), and a new subspace is initialized for each task. The expression for reconstructing shallow convolutional layers is as follows:
[0084]
[0085] In the formula, It is a shallow convolutional layer, α s For the sharing coefficient, For subspace, This represents tensor contraction operations.
[0086] In this embodiment, after reconstructing the shallow convolutional layers, an image shallow feature extractor can be constructed based on several shallow convolutional layers. Figure 3 The image shallow feature extractor only shows one shallow convolutional layer, while the image shallow feature extractor can include multiple shallow convolutional layers.
[0087] Step S202: Construct a deep image feature extractor based on several deep convolutional layers;
[0088] Step S203: Construct an image task subspace feature extractor based on the image shallow feature extractor and the image deep feature extractor.
[0089] In this embodiment, a deep image feature extractor can be constructed first based on several deep convolutional layers, and then an image task subspace feature extractor can be constructed based on the shallow image feature extractor and the deep image feature extractor.
[0090] In this embodiment, several new deep convolutional layers can be created for each task first. Construct a deep image feature extractor based on multiple deep convolutional layers. Figure 3The image deep feature extractor only shows one deep convolutional layer, while an image deep feature extractor can include multiple deep convolutional layers. Then, the image shallow feature extractor and the image deep feature extractor are combined to construct the image task subspace feature extractor Φ. t . Figure 3 The trapezoid on the right represents the task subspace hybrid network, which is the image task subspace feature extractor. The expression for constructing the image task subspace feature extractor is as follows:
[0091]
[0092] In the formula, Φ t For image task subspace feature extractor, For image deep feature extractor, is a shallow feature extractor for images, and x is an image sample.
[0093] In this embodiment, during the training phase of the first task (t=1), the shallow convolutional layer tasks share coefficients α. s Shallow convolutional layer subspace and deep convolutional layers All of these are trainable parameters. In subsequent tasks t, only the newly added shallow convolutional layer subspace is considered. Parameters and deep convolutional layers The parameters can be optimized to learn new tasks.
[0094] Step S204: Obtain training images.
[0095] In this embodiment, training images can be obtained by collecting image data, labeling or classifying the image data, and each training image has a corresponding preset label or category.
[0096] Step S205: Based on the training image and the old image task feature extractor, obtain the first super feature. The construction process of the old image task feature extractor is the same as that of the image task subspace feature extractor.
[0097] In this embodiment, the first super feature is obtained based on the training image and the old image task feature extractor. This can be achieved by first inputting the training image into several old image task feature extractors, outputting the corresponding first output features, and then concatenating the multiple first output features to obtain the first super feature.
[0098] In this embodiment, the dynamic feature learning and aggregation process is as follows: Figure 4The diagram illustrates the process of incremental image category learning by the classification model when the t-th task arrives. The trapezoidal new task feature extractor can include an image task subspace feature extractor. When new task data is input, a new image task subspace feature extractor Φ can be added. t At the same time, the feature extractors {Φ1, ..., Φ2} built in the old task are retained and frozen. t-1} and old task classification layer H t-1 This preserves old skills learned from previous tasks. In this embodiment, the training image x can be input into several image old task feature extractors, and the corresponding first output features can be output. For example, the training image x is input into the (t-1)th image old task feature extractor Φ. t-1 It can output the corresponding first output feature Φ t-1 (x). Then, multiple first output features are concatenated to obtain the first super feature u. t-1 The expression for concatenating the first super feature is as follows:
[0099] u t-1 =[Φ1(x), ...,Φ t-1 (x)]
[0100] Where u t-1 As the first super feature, Φ t-1 Let x be the old task feature extractor for the (t-1)th image, and let x be the training image.
[0101] Step S206: Obtain the second super feature based on the training image and the image task subspace feature extractor.
[0102] In this embodiment, the second super feature is obtained based on the training image and the image task subspace feature extractor. This can be achieved by first inputting the training image into the image task subspace feature extractor, outputting the second output feature, and then concatenating multiple first output features and second output features to obtain the second super feature.
[0103] In this embodiment, the training image x can be first input into the image task subspace feature extractor, and the second output feature can be output. For example, the training image x is input into the image task subspace feature extractor Φ. t It can output the second output feature Φ t (x). Then, multiple first output features and second output features are concatenated to obtain the second super feature u. t The expression for concatenating the second super feature is as follows:
[0104] u t =[Φ1(x), ...,Φ t-1 (x), Φ t (x)]
[0105] Where u t As the second super feature, Φ t is the subspace feature extractor for the image task, and x is the training image.
[0106] Step S207: Calculate the classification loss using cross-entropy based on the old task classification layer and the second super feature of the image.
[0107] In this embodiment, the classification loss is calculated using cross-entropy based on the old task classification layer and the second super feature. This can be achieved by first initializing the parameters of the new task classification layer based on the parameters of the old task classification layer, then inputting the second super feature into the new task classification layer to obtain the first original value, and finally calculating the classification loss using cross-entropy based on the first original value.
[0108] In this embodiment, the old image task classification layer H can be used first. t-1 Initialize the image new task classification layer H t The parameters of the category of the old task are then used to determine the second super feature u. t The input image is used for a new task classification layer to obtain the first raw value F. t (x). Since the classes of the old and new tasks are highly unbalanced, Logits Alignment can be used to correct the task bias. The expression for obtaining the first original value is as follows:
[0109] F t (x)=γH t (u t )
[0110] In the formula, F t (x) represents the original value before the softmax function, i.e., the first original value, γ is the scaling factor vector hyperparameter of LogitsAlignment, and H t For image classification of new tasks, u t This is the second super feature.
[0111] In this embodiment, after obtaining the first original value, the classification loss L can be calculated using the softmax cross-entropy based on the first original value. CE The formula for calculating the classification loss is as follows:
[0112]
[0113] In the formula, σ(·) is the softmax function, and σ(F t (x)) i For the prediction of class i, |Y t | represents the total number of categories, Dt For a dataset containing some old task categories and all new task categories, δ y=i This is an indicator function that outputs 1 when y = i and 0 when y ≠ i.
[0114] Step S208: Calculate the knowledge distillation loss based on the first super feature and the old task classification layer of the image.
[0115] In this embodiment, the knowledge distillation loss is calculated based on the first super feature and the old task classification layer of the image. This can be achieved by first inputting the first super feature into the old task classification layer of the image to obtain the second original value, and then calculating the knowledge distillation loss based on the first and second original values.
[0116] In this embodiment, the first super feature u can be first... t-1 Input image, old task classification layer H t-1 The second original value F is obtained. t-1 (x). The expression for obtaining the second original value is as follows:
[0117] F t-1 (x)=γH t-1 (u t-1 )
[0118] In the formula, F t-1 (x) represents the second original value, γ is the scaling factor vector hyperparameter of Logits Alignment, and H t-1 For image classification, u t-1 This is the first super feature.
[0119] In this embodiment, after obtaining the second original value, the knowledge distillation loss L can be calculated based on the first and second original values. KD The formula for calculating the knowledge distillation loss is as follows:
[0120]
[0121] In the formula, KD(·,·) is the standard logit distillation loss, and c old Let F be the total number of categories in the old task, σ(·) be the softmax function, and F be the total number of categories in the old task. t-1 (x) is the second original value, F t (x) is the first original value, D t This dataset contains some of the old task categories and all of the new task categories.
[0122] Step S209: Calculate the total loss based on the classification loss, knowledge distillation loss, and image discrimination classification layer.
[0123] In this embodiment, the total loss is calculated based on the classification loss, knowledge distillation loss, and image discriminative classification layer. This can be achieved by first inputting the second output feature into the image discriminative classification layer, calculating the discriminative loss using cross-entropy, and then calculating the total loss based on the classification loss, knowledge distillation loss, and discriminative loss.
[0124] In this embodiment, the second output feature can be first input into the image discrimination and classification layer, and then the output logitf of the image discrimination and classification layer can be used to further refine the classification. t (x) and proper label y∈Y t Between them, the discriminant loss L is calculated using cross-entropy. DIS The formula for calculating the discriminant loss is as follows:
[0125]
[0126] In the formula, f t (x)=H dis (Φ t (x)), H dis To facilitate the differentiation between old and new task categories in the image discrimination classification layer, σ(·) is the softmax function, Φ t (x) is the second output feature, |Y t | represents the total number of categories, D t For a dataset containing some old task categories and all new task categories, δ y=i This is an indicator function that outputs 1 when y = i and 0 when y ≠ i.
[0127] In this embodiment, after calculating the discriminant loss, the total loss L can be calculated based on the classification loss, knowledge distillation loss, and discriminant loss, thereby maximizing the difference between the old and new task categories. The formula for calculating the total loss is as follows:
[0128] L = L CE +L KD +L DIS
[0129] Where, L CE For classification loss, L KD For knowledge distillation loss, L DIS To determine the loss.
[0130] Step S210: Update the parameters of the image task subspace feature extractor according to the total loss until the total loss meets the preset loss requirement, and then obtain the image dynamic task subspace model.
[0131] In this embodiment, the parameters of the image task subspace feature extractor can be updated based on the total loss until the total loss meets a preset loss requirement, thus obtaining the image dynamic task subspace model. The parameters can include subspaces from several shallow convolutional layers. and several deep convolutional layers For example, a loss threshold of 0.3 can be set, and the parameters of the image task subspace feature extractor can be updated according to the total loss until the total loss is less than 0.3, thus obtaining the image dynamic task subspace model.
[0132] The beneficial effects of implementing the embodiments of the present invention include: the embodiments of the present invention first acquire the image to be classified, and then input the image to be classified into the image dynamic task subspace model to obtain the image classification result. The image dynamic task subspace model is obtained through the following steps: first, constructing an image shallow feature extractor, constructing an image deep feature extractor, and constructing an image task subspace feature extractor; then, acquiring training images; obtaining a first super feature based on the training images and the image task subspace feature extractor; obtaining a second super feature based on the training images and the image task subspace feature extractor; finally, calculating the classification loss using cross-entropy, calculating the knowledge distillation loss, calculating the total loss, and updating the parameters of the image task subspace feature extractor based on the total loss to obtain the image dynamic task subspace model, which improves the classification accuracy and reduces the parameter storage cost.
[0133] This invention also provides an image classification system integrating a dynamic task subspace, comprising:
[0134] The first module is used to acquire the image to be classified.
[0135] The second module is used to input the image to be classified into the image dynamic task subspace model to obtain the image classification result.
[0136] The image dynamic task subspace model is obtained through the following steps:
[0137] Construct a shallow feature extractor for images based on the sharing coefficients and subspaces;
[0138] Construct a deep feature extractor for images based on several deep convolutional layers;
[0139] Based on the image shallow feature extractor and the image deep feature extractor, construct an image task subspace feature extractor;
[0140] Acquire training images;
[0141] Based on the training image and the old image task feature extractor, the first super feature is obtained. The construction process of the old image task feature extractor is the same as that of the image task subspace feature extractor.
[0142] The second super feature is obtained based on the training image and the image task subspace feature extractor;
[0143] Based on the old task classification layer and the second super feature of the image, the classification loss is calculated using cross-entropy.
[0144] Based on the first super feature and the old task classification layer of the image, calculate the knowledge distillation loss;
[0145] Calculate the total loss based on the classification loss, knowledge distillation loss, and image discrimination classification layer;
[0146] The parameters of the image task subspace feature extractor are updated based on the total loss until the total loss meets the preset loss requirement, thus obtaining the image dynamic task subspace model.
[0147] The content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0148] This invention also provides an image classification system integrating a dynamic task subspace, comprising:
[0149] At least one memory for storing programs;
[0150] At least one processor is used to load the program for execution. Figure 1 This paper presents an image classification method that integrates dynamic task subspaces.
[0151] The content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0152] This invention also provides a storage medium storing a computer-executable program, which, when executed by a processor, is used to implement... Figure 1 This paper presents an image classification method that integrates dynamic task subspaces.
[0153] The content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0154] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. An image classification method integrating dynamic task subspaces, characterized in that, Includes the following steps: Obtain the image to be classified; The image to be classified is input into the image dynamic task subspace model to obtain the image classification result; The image dynamic task subspace model is obtained through the following steps: Construct a shallow feature extractor for images based on the sharing coefficients and subspaces; Construct a deep feature extractor for images based on several deep convolutional layers; Based on the image shallow feature extractor and the image deep feature extractor, an image task subspace feature extractor is constructed; Acquire training images; Based on the training image and the old image task feature extractor, a first super feature is obtained. The old image task feature extractor is constructed in the same way as the image task subspace feature extractor. The second super feature is obtained based on the training image and the image task subspace feature extractor; Based on the old task classification layer of the image and the second super feature, the classification loss is calculated using cross-entropy; Based on the first super feature and the old task classification layer of the image, calculate the knowledge distillation loss; Calculate the total loss based on the classification loss, the knowledge distillation loss, and the image discrimination classification layer; The parameters of the image task subspace feature extractor are updated according to the total loss until the total loss meets the preset loss requirement, and then the image dynamic task subspace model is obtained. The step of constructing a shallow image feature extractor based on the sharing coefficient and subspace includes: Based on the shared coefficients and the subspace, shallow convolutional layers are reconstructed using tensor shrinkage. The image shallow feature extractor is constructed based on several of the shallow convolutional layers; The dynamic expansion process of the subspace includes: when the t-th task arrives, a new subspace is first initialized for task t. Based on the sharing coefficients and subspace, shallow convolutional layers are reconstructed using tensor shrinkage; where, when t=1, the sharing coefficients α... s Initialize the space, and then initialize a new subspace for each task; The expression for reconstructing shallow convolutional layers is as follows: Where, It is a shallow convolutional layer, α s For the sharing coefficient, For subspace, This represents tensor contraction operations.
2. The image classification method integrating dynamic task subspaces according to claim 1, characterized in that, The step of obtaining the first super feature based on the training image and the old image task feature extractor includes: The training images are respectively input into several image old task feature extractors, and the corresponding first output features are output; Multiple first output features are concatenated to obtain the first super feature.
3. The image classification method integrating dynamic task subspaces according to claim 2, characterized in that, The step of obtaining the second super feature based on the training image and the image task subspace feature extractor includes: The training image is input into the image task subspace feature extractor, which outputs a second output feature. The second super feature is obtained by concatenating multiple first output features and second output features.
4. The image classification method integrating dynamic task subspaces according to claim 1, characterized in that, The step of calculating the classification loss using cross-entropy based on the old image classification layer and the second super feature includes: Initialize the parameters of the new task classification layer of the image based on the parameters of the old task classification layer of the image. The second super feature is input into the new task classification layer of the image to obtain the first original value; The classification loss is calculated using cross-entropy based on the first original value.
5. The image classification method integrating dynamic task subspaces according to claim 4, characterized in that, The step of calculating the knowledge distillation loss based on the first super feature and the old image task classification layer includes: The first super feature is input into the old task classification layer of the image to obtain the second original value; The knowledge distillation loss is calculated based on the first original value and the second original value.
6. The image classification method integrating dynamic task subspaces according to claim 3, characterized in that, The step of calculating the total loss based on the classification loss, the knowledge distillation loss, and the image discrimination classification layer includes: The second output feature is input into the image discrimination and classification layer, and the discrimination loss is calculated using cross-entropy; the total loss is calculated based on the classification loss, the knowledge distillation loss, and the discrimination loss.
7. A system for implementing the image classification method for an integrated dynamic task subspace as described in any one of claims 1-6, characterized in that, include: The first module is used to acquire the image to be classified. The second module is used to input the image to be classified into the image dynamic task subspace model to obtain the image classification result; The image dynamic task subspace model is obtained through the following steps: Construct a shallow feature extractor for images based on the sharing coefficients and subspaces; Construct a deep feature extractor for images based on several deep convolutional layers; Based on the image shallow feature extractor and the image deep feature extractor, an image task subspace feature extractor is constructed; Acquire training images; Based on the training image and the old image task feature extractor, a first super feature is obtained. The old image task feature extractor is constructed in the same way as the image task subspace feature extractor. The second super feature is obtained based on the training image and the image task subspace feature extractor; Based on the old task classification layer of the image and the second super feature, the classification loss is calculated using cross-entropy; Based on the first super feature and the old task classification layer of the image, calculate the knowledge distillation loss; Calculate the total loss based on the classification loss, the knowledge distillation loss, and the image discrimination classification layer; The parameters of the image task subspace feature extractor are updated based on the total loss until the total loss meets the preset loss requirement, thus obtaining the image dynamic task subspace model.
8. An image classification system integrating a dynamic task subspace, characterized in that, include: At least one memory for storing programs; At least one processor is configured to load the program to execute an image classification method for an integrated dynamic task subspace as described in any one of claims 1-6.
9. A storage medium, characterized in that, It contains a computer-executable program, which, when executed by a processor, is used to implement an image classification method with an integrated dynamic task subspace as described in any one of claims 1-6.
Citation Information
Patent Citations
Incremental learning method and device, electronic equipment and machine readable storage medium
CN114298197A
Incremental learning method and system for detecting fake face image video
CN116310754A