An image recognition model training method and system, and an image processing method and system
By performing dynamic matching of feature channels and joint optimization of the loss function during the knowledge distillation process, the problem of the lack of discriminativeness in the knowledge representation acquired by existing image recognition models is solved, thereby improving the accuracy of image recognition.
Patent Information
- Application Number
- CN202310401225.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-13
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2043-04-13
AI Technical Summary
Existing knowledge distillation techniques employ a fixed feature channel matching method in image recognition, resulting in a lack of discriminativeness in the knowledge representation acquired by the second model, which hinders further improvement in image recognition accuracy.
By dynamically matching feature channels during knowledge distillation, calculating matching weights using association matrix and semantic similarity fusion, and combining the loss functions of predicted category labels and true labels for end-to-end training, the discriminativeness of the second neural network model is improved.
It significantly improved the accuracy of image recognition, especially the image classification accuracy on the CIFAR100 dataset, which increased from 72.51% to 76.46%.
Smart Images

Figure CN116597245B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computer vision, and in particular to an image recognition model training method and system, and an image processing method and system. BACKGROUND
[0002] At present, neural network models have achieved great success in computer vision tasks such as image classification and target detection. However, the huge parameter quantity and computation quantity cannot be effectively deployed on resource-limited platforms for operation. Knowledge distillation is one of the neural network model compression and acceleration technologies, which can effectively reduce the resource demand of the model while maintaining high recognition accuracy.
[0003] The principle of knowledge distillation is that when training a neural network model (second neural network model), in addition to the task-related loss, the class prediction output and intermediate feature expression of another neural network model (first neural network model) are also imitated. This method can significantly improve the recognition accuracy of the second neural network model and has good application in the field of image recognition. For example, the patent document CN115861771A discloses a key knowledge distillation method for image recognition. In the training process, the semantic importance measurement method is used to calculate the semantic importance between the feature maps of the selected feature layers of the second model and the feature maps of the selected feature layers of the first model. The important knowledge is taken as the key knowledge and a large weight value is assigned. The weight value is added to the feature layer knowledge distillation loss function, and the second model is trained jointly with the image recognition task-related loss function. For another example, the patent document CN115527063A discloses a low-resolution image recognition method and device based on image super-resolution and knowledge distillation. According to the high-resolution image and the low-resolution image, a super-resolution network is trained to obtain a trained super-resolution network, and a super-resolution image is determined. The super-resolution network is used to improve the resolution of the image, and the resolution of the super-resolution image is higher than that of the low-resolution image. According to the high-resolution image and the super-resolution image, a distillation sub-network is trained to obtain a trained distillation sub-network. The distillation sub-network is used for image classification. According to the trained super-resolution network and the trained distillation sub-network, a low-resolution image classification network is determined. According to the low-resolution image classification network, the collected low-resolution real image is classified and recognized to determine the classification and recognition result.
[0004] However, the knowledge distillation technology disclosed in the above two patent documents for image recognition adopts a fixed feature channel matching method when extracting and distilling knowledge from the first model, which makes the knowledge expression obtained by the second model lack discriminability, hindering the further improvement of image recognition accuracy. SUMMARY
[0005] To solve the above technical problems, the first object of the present application is to provide an image recognition model training method and system based on feature channel dynamic matching, which can extract more discriminative feature expressions during knowledge distillation to improve the recognition accuracy of the image recognition model.
[0006] In the first aspect, to achieve the above first object, the present application provides an image recognition model training method, comprising the following steps:
[0007] Obtaining training image samples with real labels;
[0008] After updating the parameters of the selected first neural network model using the training image samples, calculating the first intermediate layer feature expression and the soft label information corresponding to the training image samples using the first neural network model with updated parameters;
[0009] Calculating the second intermediate layer feature expression and the predicted class label information corresponding to the training image samples using the selected second neural network model, dynamically matching the second intermediate layer feature expression and the first intermediate layer feature expression in the channel, obtaining the first loss function based on the knowledge distillation between the matched channels, and jointly updating the parameters of the second neural network model end-to-end using the first loss function, the second loss function constructed based on the predicted class label information and the soft label, and the third loss function constructed based on the predicted class label information and the real label, and the second neural network model after parameter updating is used as the image recognition model.
[0010] Preferably, the second intermediate layer feature expression and the first intermediate layer feature expression are matched in the channel, which comprises:
[0011] Respectively calculating the channel global descriptors of the first intermediate layer feature expression and the second intermediate layer feature expression, and calculating the correlation matrix based on the two channel global descriptors;
[0012] Calculating the first semantic similarity between the channels of the first intermediate layer feature expression;
[0013] Calculating the second semantic similarity between the channels of the second intermediate layer feature expression and the first intermediate layer feature expression;
[0014] Fusing the second semantic similarity and the correlation matrix to obtain the fused feature expression;
[0015] After calculating the matching weight matrix according to the first semantic similarity and the fused feature expression, the matching channels are calculated by sampling and calculating the matching weight matrix using the differentiable Gumbel-Softmax reparameterization method.
[0016] Preferably, a global average pooling operation is used to calculate a channel global descriptor of the first intermediate layer feature representation and the second intermediate layer feature representation, respectively, and the correlation matrix is calculated by point multiplication of the two two-channel global descriptors.
[0017] Preferably, after obtaining the first semantic similarity and the second semantic similarity, a multi-layer fully connected layer is used to perform dimension abstraction on the first semantic similarity and the second semantic similarity to obtain high-dimensional first semantic similarity and second semantic similarity, and then the high-dimensional second semantic similarity is fused with the correlation matrix to obtain a fused feature representation. Similarly, a multi-layer fully connected layer is used to perform dimension abstraction on the fused feature representation to obtain a high-dimensional fused feature representation. Next, a matching weight matrix is calculated according to the high-dimensional first semantic similarity and the high-dimensional fused feature representation.
[0018] Preferably, the first loss function is obtained based on knowledge distillation between matching channels, including:
[0019] The mean square error of the first intermediate layer feature representation and the second intermediate layer feature representation based on the matching channel is taken as the first loss function.
[0020] In a second aspect, to achieve the above-mentioned second invention purpose, the present application further provides an image recognition model training system, comprising:
[0021] A first acquisition module is configured to obtain a training image sample with a real label.
[0022] A first update module is configured to, after performing parameter update on the selected first neural network model using the training image sample, calculate the first intermediate layer feature representation and the soft label information corresponding to the training image sample using the parameter-updated first neural network model.
[0023] A channel matching and updating module is configured to calculate the second intermediate layer feature representation and the predicted class label information corresponding to the training image sample using the selected second neural network model, perform channel dynamic matching between the second intermediate layer feature representation and the first intermediate layer feature representation, obtain a first loss function based on knowledge distillation between matching channels, and perform end-to-end parameter update on the second neural network model using the first loss function, a second loss function constructed based on the predicted class label information and the soft label, and a third loss function constructed based on the predicted class label information and the real label. The parameter-updated second neural network model is used as the image recognition model.
[0024] In a third aspect, the present application further provides an image processing method, comprising the following steps:
[0025] Obtaining a to-be-tested image sample;
[0026] The image recognition model obtained by using the image recognition model training method provided in the first aspect above is used to recognize the image of the test sample to obtain the image recognition result.
[0027] Fourthly, the present invention also provides an image processing system, comprising:
[0028] The second acquisition module is used to obtain the image sample to be tested;
[0029] The image recognition module is used to recognize the image of the test sample image using the image recognition model training method provided in the first aspect above, and to obtain the image recognition result.
[0030] Fifthly, the present invention also provides a computing device, including one or more processors and a memory, wherein the memory stores an executable code program, and when the one or more processors execute the executable code program, they implement the image recognition model training method provided in the first aspect above; and / or implement the image processing method provided in the third aspect above.
[0031] In a sixth aspect, the present invention also provides a computer-readable storage medium having an executable code program stored thereon, wherein the executable code program, when processed and executed, implements the image recognition model training method provided in the first aspect above; and / or implements the image processing method provided in the third aspect above.
[0032] Compared with the prior art, the beneficial effects of the present invention include at least the following:
[0033] Based on the pre-trained first neural network model, dynamic channel matching is performed between the first intermediate layer feature representation and the second intermediate layer feature representation of the training image samples in the intermediate layers of the first and second neural network models. A first loss function is obtained based on knowledge distillation between the matched channels. Simultaneously, a second loss function constructed based on predicted category label information and soft labels, and a third loss function constructed based on predicted category label information and ground truth labels are combined to jointly train the second neural network model. This enables automatic dynamic matching between the channels of the two models, enhancing the discriminative power of the knowledge representation acquired by the second neural network model, thereby improving image recognition accuracy. Image recognition based on this model has significantly improved image recognition accuracy. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart of an image recognition model training method according to an embodiment of the present invention;
[0036] Figure 2 This is a flowchart of feature representation channel matching in an image recognition model training method according to an embodiment of the present invention;
[0037] Figure 3 This is a schematic diagram of the structure of an image recognition model training system according to an embodiment of the present invention.
[0038] Figure 4 This is a flowchart of an image processing method according to an embodiment of the present invention;
[0039] Figure 5 This is a schematic diagram of the structure of an image processing system according to an embodiment of the present invention;
[0040] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0041] 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 embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.
[0042] The inventive concept of this invention is to address the technical problem that existing knowledge distillation methods, which use fixed feature channel matching, result in a lack of discriminative knowledge representation acquired by the model, thereby hindering the accuracy of image recognition. This invention provides an image recognition model training method and system that, through dynamic feature channel matching, can extract and distill more discriminative feature representations during knowledge distillation, thereby improving the recognition accuracy of the image recognition model.
[0043] Example 1
[0044] Figure 1 This is a flowchart of an image recognition model training method provided in one embodiment. For example... Figure 1 As shown, the image recognition model training method provided in this embodiment includes the following steps:
[0045] S110, Obtain training image samples with real labels.
[0046] In the embodiment of the present application, the labeled image samples to be processed are collected and cleaned, divided into a first number of training image samples and a second number of test image samples, and saved to a data storage device. Cleaning refers to deleting images that are irrelevant to the task or blurred or data damaged from the collected image samples to be processed, so as to avoid affecting the training of the neural network model and image recognition. Labeling refers to manually identifying the categories of images or pixels in images according to task requirements, such as marking the main object category in the image in the image classification task, marking the number of pixels and categories of objects in the image in the target detection task, etc. The collected images include but are not limited to face images, natural scene images, etc.
[0047] In S120, after the selected first neural network model is updated in parameters using the training image samples, the first intermediate layer feature expression and soft label information corresponding to the training image samples are calculated using the first neural network model updated in parameters.
[0048] In the embodiment of the present application, the first neural network model is selected and trained using the first number of training image samples in step S1, and the structure file and parameter value of the trained first neural network model are saved to the data storage device. The first neural network model can adopt any existing neural network model including but not limited to ResNet, VGGnet, etc., or a newly designed convolutional neural network model.
[0049] In the embodiment of the present application, the first intermediate layer feature expression and soft label information are obtained by processing the training image samples using the first neural network model. Specifically, the obtained first intermediate layer feature expression is formalized as and the soft label information is formalized as wherein C t represents the number of channels of the feature expression, H t represents the height of the feature expression, W t represents the width of the feature expression, and C represents the number of categories of the image samples to be processed.
[0050] In S130, the second intermediate layer feature expression and predicted category label information corresponding to the training image samples are calculated using the selected second neural network model.
[0051] In the embodiment of the present application, the selected second neural network model can adopt any existing neural network model including but not limited to MobileNet, ShuffleNet, etc., or a newly designed convolutional neural network model.
[0052] In an embodiment of the present invention, optionally, an intermediate convolutional layer of the second neural network model is selected, and training image samples are input to obtain the feature representation of the second intermediate layer of the second neural network model. Specifically, the obtained feature representation of the second intermediate layer samples is formalized as follows: Among them, C s H represents the number of channels for feature representation. s W represents the height of feature representation. s Indicates the width of the feature representation.
[0053] In embodiments of the present invention, training image samples are input into a second neural network model for image processing to obtain predicted category label information. Where C represents the number of categories of the image samples to be processed.
[0054] S140, Perform channel dynamic matching between the feature representation of the second intermediate layer and the feature representation of the first intermediate layer.
[0055] like Figure 2 As shown, channel matching is performed between the feature representations of the second intermediate layer and the feature representations of the first intermediate layer. The first loss function is obtained based on knowledge distillation between the matched channels, specifically including:
[0056] S141, calculate the feature representation F of the first intermediate layer respectively. s Second intermediate layer feature representation F t Channel global descriptor d s and d t This can be formally represented as:
[0057]
[0058] in, This represents the global average pooling operation, which calculates the sub-d using the global average pooling operation. s and d t .
[0059] S142, based on the two-channel global descriptor d s and d t The correlation matrix R between the feature representations of the two intermediate layers can be formally expressed as:
[0060]
[0061] S143, Calculate the feature representation F of the first intermediate layer. t The first semantic similarity S between the channels tt This can be formally represented as:
[0062]
[0063] in, denotes a dimension transformation function, ||·||2 denotes a binary norm, and a superscript T denotes a transpose.
[0064] In the embodiment of the present application, the first semantic similarity S tt is further abstracted to obtain a higher-dimensional first semantic similarity, which is formally represented as:
[0065]
[0066] In the formula, denotes a multi-layer fully connected layer.
[0067] S144, the second semantic similarity S st between the second intermediate layer feature representation and the first intermediate layer feature representation is calculated.
[0068]
[0069] In the embodiment of the present application, the second semantic similarity S st is further abstracted to obtain a higher-dimensional second semantic similarity, which is formally represented as:
[0070]
[0071] S145, the second semantic similarity S st is fused with the association matrix R to obtain a fused feature representation A, which can be formally represented as:
[0072]
[0073] wherein, denotes a feature fusion operation, including but not limited to element-wise addition, multiplication, channel-wise concatenation, etc.
[0074] In the embodiment of the present application, the fused feature representation A is further abstracted to obtain a higher-dimensional fused feature representation using a multi-layer fully connected layer, which can be formally represented as:
[0075]
[0076] S146, according to the first semantic similarity S tt and the fused feature representation A, a matching weight matrix a is calculated, and then a differentiable Gumbel-Softmax reparameterization method is used to sample and calculate the matching weight matrix to obtain a matching channel, which can be formally represented as:
[0077]
[0078] M i =Gumbel-Softmax(α i ≥0.5),i∈[1,C s ]
[0079]
[0080] wherein sigmoid represents a sigmoid activation function, i represents a channel index value of the intermediate layer feature expression in the second neural network model, alpha i ≥0.5 represents that only the correlation values greater than or equal to 0.5 are selected for calculation, g it represents a random variable subject to Gumbel distribution, tau represents a temperature variable controlling the difference between Softmax and Argmax, M i represents a set of intermediate layer channel index values of the first neural network model associated with the i-th channel of the intermediate layer of the second neural network model.
[0081] S150, obtaining a first loss function based on knowledge distillation between matching channels.
[0082] In the embodiment of the application, after obtaining the matching channels, knowledge distillation is performed based on the matching channels to obtain a first loss function which is formally represented as:
[0083]
[0084] wherein, represents a mean square error value, that is, the mean square error based on the first intermediate layer feature expression and the second intermediate layer feature expression between the matching channels is taken as the first loss function, c represents the intermediate layer feature channel index value of the second neural network model, M c represents a set of intermediate layer channel index values of the first neural network model associated with the c-th channel of the intermediate layer of the second neural network model, F s [c] represents the feature expression of the c-th channel of the intermediate layer of the second neural network model, and F t [M c ] represents a set of intermediate layer channel index values of the first neural network model associated with the c-th channel of the intermediate layer of the second neural network model. c corresponding feature expression.
[0085] S160, performing end-to-end parameter update on the second neural network model by using the first loss function, a second loss function constructed based on the predicted class label information and the soft label, and a third loss function constructed based on the predicted class label information and the real label, and taking the second neural network model after parameter update as the image recognition model.
[0086] In the embodiment of the present application, the class label information P of the training image sample in the second neural network model is obtained s On this basis, the soft label information P output by the first neural network model is used to calculate the second loss function t The second loss function is constructed which can be formally expressed as:
[0087]
[0088] The second loss function is which represents the Kullback-Leibler divergence used to measure the difference between P s and P t .
[0089] In the embodiment of the present application, the third loss function is also constructed based on the predicted class label information and the real label which can be formally expressed as:
[0090]
[0091] wherein y represents the real label of the training image sample, such as the image class information in the image classification task, and the object class, position and size information in the object detection task, represents the task loss function, such as the cross-entropy loss function in the image classification task, and the cross-entropy loss and position and size regression loss function in the object detection task.
[0092] In the embodiment of the present application, the sum of the first loss function, the second loss function and the third loss function is used as the overall loss function for updating the parameters of the second neural network model which is formally expressed as:
[0093]
[0094] The way of updating the parameters of the second neural network model using the overall loss function includes but is not limited to the random gradient descent method, the adaptive gradient descent method, etc. In each round of iteration, the parameter updating can be performed by single backward gradient propagation, without fixing certain parameters for alternating parameter updating, and the second neural network model after parameter updating is used as the image recognition model.
[0095] The image recognition model method provided by the application is simple and intuitive, easy to operate, not limited to a specific teacher-student model combination, can be easily deployed in an existing neural network model to recognize images, can significantly improve the image recognition accuracy of the second neural network model compared with existing knowledge distillation image recognition technology, and can be more quickly and end-to-end trained compared with an existing channel automatic association method. When ResNet32x4 is used as the first neural network model and ResNet8x4 is used as the second neural network model, the image classification accuracy of the second neural network model can be improved from 72.51% to 76.46% on the CIFAR100 dataset.
[0096] Embodiment 2
[0097] Figure 3 is a structural schematic diagram of an image recognition model training system in an embodiment of the application. As shown in the figure, Figure 3 the image recognition model training system 300 provided by the embodiment includes:
[0098] The first obtaining module 310 is configured to obtain a training image sample with a real label.
[0099] The first updating module 320 is configured to, after updating the parameters of the selected first neural network model by using the training image sample, calculate the first intermediate layer feature expression and the soft label information corresponding to the training image sample by using the first neural network model with the updated parameters.
[0100] The channel matching and updating module 330 is configured to calculate the second intermediate layer feature expression and the predicted class label information corresponding to the training image sample by using the selected second neural network model, perform dynamic channel matching between the second intermediate layer feature expression and the first intermediate layer feature expression, obtain the first loss function based on the knowledge distillation between the matched channels, and jointly update the parameters of the second neural network model end to end by using the first loss function, the second loss function constructed based on the predicted class label information and the soft label, and the third loss function constructed based on the predicted class label information and the real label. The second neural network model with the updated parameters serves as the image recognition model.
[0101] It should be noted that the image recognition model training system provided by the above embodiment should be illustrated based on the division of the above functional modules, and the above functions can be completed by different functional modules according to needs, that is, the internal structure of the terminal or server is divided into different functional modules to complete all or part of the above described functions. In addition, the image recognition model training system and the image recognition model training generation method provided by the above embodiment belong to the same concept, and the specific implementation process is described in detail in the image recognition model training method embodiment, which will not be described here.
[0102] Embodiment 3
[0103] Figure 4 is a flowchart of an image processing method in an embodiment of the present application. As shown in the figure, the image processing method provided by the embodiment can be executed by software and / or a hardware device, for example, the hardware device can be an electronic device, and includes the following steps. Figure 4
[0104] S410, obtaining a to-be-tested image sample.
[0105] The to-be-tested image sample can be understood as an image that needs to be processed in actual application, such as a natural landscape image, a face image, etc.
[0106] S420, identifying the to-be-tested sample image by using the image recognition model obtained by the image recognition model training method provided in Embodiment 1, to obtain an image recognition result.
[0107] Specifically, the to-be-tested image sample is input into the parameter-optimized image recognition model, and image recognition is performed through forward propagation calculation, to obtain a recognition result. The recognition result can be a category of the image, or a category of an object in the image and a position and size of the object on the image.
[0108] Embodiment 4
[0109] Figure 5 is a structural schematic diagram of an image processing system in an embodiment of the present application. As shown in the figure, the image processing system 500 provided by the embodiment includes; Figure 5
[0110] The second acquisition module 510 is configured to obtain a to-be-tested image sample.
[0111] The image recognition module 520 is configured to identify the to-be-tested sample image by using the image recognition model obtained by the image recognition model training method provided in Embodiment 1, to obtain an image recognition result.
[0112] It should be noted that the image processing system provided in the above embodiments should be illustrated by the division of the above functional modules, and the above functions can be completed by different functional modules according to needs, that is, the internal structure of the terminal or server is divided into different functional modules to complete all or part of the above-described functions. In addition, the image processing system and the image processing method provided in the above embodiments belong to the same concept, and the specific implementation process is described in the image processing method embodiment, which will not be described here.
[0113] Embodiment 5
[0114] Figure 6 is a structural schematic diagram of an electronic device in an embodiment of the present application. As shown in Figure 6 The package includes one or more processors and memories, and further includes an image collector and an external output device, wherein the image collector is configured to collect training image samples and to-be-tested image samples, the memories store executable code programs, the one or more processors implement the image recognition model training method provided in Embodiment 1 and / or the image processing method provided in Embodiment 3 when executing the executable code programs, and the external output device is configured to output an image recognition result obtained by the image processing method.
[0115] Embodiments of the image recognition model training method and the image processing method can be applied to any device with data processing capability, which can be a device such as a computer or the like. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. For example, in the case of software implementation, as a logical device, the corresponding computer program instructions in the non-volatile memory are read into the memory by the processor of the device where the device is located and executed to form. From the hardware point of view, as shown in Figure 6 is a hardware structure diagram of any device with data processing capability where the electronic device for image recognition training and processing is located. In addition to the processor, the memory, the network interface, and the non-volatile memory shown in Figure 6 , the device where the embodiment is located can also include other hardware according to the actual functions of the device with data processing capability, and details are not described herein.
[0116] Embodiment 6
[0117] The embodiment also provides a computer readable storage medium, which stores executable code programs, and the executable code programs are executed by a processor to implement the image recognition model training method provided in Embodiment 1 and / or the image processing method provided in Embodiment 3.
[0118] The computer readable storage medium can be an internal storage unit of any of the aforementioned devices with data processing capability, such as a hard disk or a memory. The computer readable storage medium can also be an external storage device of any of the aforementioned devices with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. Further, the computer readable storage medium can include both an internal storage unit and an external storage device of any of the aforementioned devices with data processing capability. The computer readable storage medium is used to store the computer program and other programs and data required by the aforementioned devices with data processing capability, and can also be used to temporarily store data that has been output or is to be output.
[0119] The above detailed description of the technical solutions and beneficial effects of the present application has been described in detail, and it should be understood that the above description is only the most preferred embodiment of the present application and is not intended to limit the present application. Any modification, supplement and equivalent replacement within the principle range of the present application shall be included in the protection scope of the present application.
Claims
1. A method for training an image recognition model, characterized in that, Includes the following steps: Obtain training image samples with real labels; After updating the parameters of the selected first neural network model using training image samples, the first intermediate layer feature representation and soft label information corresponding to the training image samples are calculated using the parameter-updated first neural network model. The selected second neural network model is used to calculate the second intermediate layer feature representation and predicted category label information corresponding to the training image samples; Dynamic channel matching is performed between the second intermediate layer feature representation and the first intermediate layer feature representation, including: calculating the channel global descriptors of the first and second intermediate layer feature representations respectively using global average pooling; calculating the association matrix by multiplying the two channel global descriptors; calculating the first semantic similarity between the channels of the first intermediate layer feature representation; calculating the second semantic similarity between the channels of the second and first intermediate layer feature representations; fusing the second semantic similarity with the association matrix to obtain the fused feature representation; calculating the matching weight matrix based on the first semantic similarity and the fused feature representation, and then sampling the matching weight matrix using the differentiable Gumbel-Softmax reparameterization method to obtain the matching channels. The first loss function is obtained by knowledge distillation between matching channels. The second neural network model is then jointly updated end-to-end using the first loss function, the second loss function constructed based on predicted category label information and soft labels, and the third loss function constructed based on predicted category label information and real labels. The updated second neural network model is then used as the image recognition model.
2. The image recognition model training method according to claim 1, characterized in that, After obtaining the first semantic similarity and the second semantic similarity, multiple fully connected layers are used to abstract the dimensions of the first semantic similarity and the second semantic similarity to obtain high-dimensional first semantic similarity and second semantic similarity. Then, the high-dimensional second semantic similarity is fused with the association matrix to obtain the fused feature expression. Similarly, multiple fully connected layers are used to abstract the dimensions of the fused feature expression to obtain a high-dimensional fused feature expression. Next, the matching weight matrix is calculated based on the high-dimensional first semantic similarity and the high-dimensional fused feature expression.
3. The image recognition model training method according to claim 1, characterized in that, The first loss function is obtained based on knowledge distillation between matching channels, including: The first loss function is based on the mean squared error of the first and second intermediate layer feature representations between the matching channels.
4. An image recognition model training system, implemented using the image recognition model training method according to any one of claims 1-3, characterized in that, include: The first acquisition module is used to obtain training image samples with real labels; The first update module is used to update the parameters of the selected first neural network model using training image samples, and then use the parameter-updated first neural network model to calculate the first intermediate layer feature representation and soft label information corresponding to the training image samples. The channel matching and update module uses the selected second neural network model to calculate the second intermediate layer feature representation and predicted category label information corresponding to the training image samples. It performs dynamic channel matching between the second intermediate layer feature representation and the first intermediate layer feature representation. Based on the knowledge distillation between the matched channels, it obtains the first loss function. It uses the first loss function, the second loss function constructed based on the predicted category label information and soft labels, and the third loss function constructed based on the predicted category label information and real labels to jointly perform end-to-end parameter updates on the second neural network model. The parameter-updated second neural network model serves as the image recognition model.
5. An image processing method, characterized in that, The method includes the following steps: Obtain the image sample to be tested; The image recognition model obtained by the image recognition model training method according to any one of claims 1-3 is used to recognize the test sample image to obtain the image recognition result.
6. An image processing system, characterized in that, include: The second acquisition module is used to obtain the image sample to be tested; An image recognition module is used to recognize a test sample image using an image recognition model obtained by the image recognition model training method according to any one of claims 1-3, and to obtain an image recognition result.
7. A computing device comprising one or more processors and a memory, wherein the memory stores an executable code program, characterized in that, When the one or more processors execute the executable code program, they implement the image recognition model training method according to any one of claims 1-3; And / or, to implement the image processing method of claim 5.
8. A computer-readable storage medium storing an executable code program thereon, characterized in that, When the executable code program is processed and executed, it implements the image recognition model training method according to any one of claims 1-3; And / or, to implement the image processing method of claim 5.
Citation Information
Patent Citations
Low-resolution image recognition method and device based on image super-resolution and knowledge distillation
CN115527063A
Key knowledge distillation method and device for image recognition
CN115861771A
Character recognition model training method and device, storage medium and electronic equipment
CN113609965A
Dynamic expression recognition method and system based on multi-scale feature knowledge distillation
CN115331285A