Optimization methods for image classification models, electronic devices, and storage media.

By performing deep feature extraction and part feature generation on the image classification model, and calculating contrast loss and classification loss, the problem of insufficient category prediction accuracy in existing technologies is solved, and the optimization efficiency and performance of the model are improved.

CN115588104BActive Publication Date: 2025-11-14BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211125156.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-14
Publication Date
2025-11-14
Estimated Expiration
2042-09-14

AI Technical Summary

Technical Problem

In existing technologies, the optimization methods for image classification models mainly rely on global feature extraction, which leads to insufficient accuracy in category prediction. Furthermore, the auxiliary dataset and the target dataset have no overlap in category space dimensions, resulting in reduced optimization capabilities.

Method used

By extracting deep features from the image classification model, generating deep feature images, extracting part features, generating part prototypes, calculating contrast loss and classification loss, and optimizing the image classification model.

Benefits of technology

This improved the accuracy and optimization efficiency of the image classification model, thus enhancing the model's performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115588104B_ABST
    Figure CN115588104B_ABST
Patent Text Reader

Abstract

This application provides an optimization method, electronic device, and storage medium for an image classification model, comprising: acquiring an image classification model; extracting deep features from image data using the image classification model to generate a deep feature image; extracting component features from the deep feature image to obtain at least two component features; generating a component prototype based on the at least two component features; calculating a contrast loss of the deep feature image based on the component prototype; and optimizing the image classification model based on the contrast loss. This application extracts component features from a deep feature image to obtain multiple component features, generates a component prototype using the multiple component features to obtain a contrast loss of the deep feature image, and finally optimizes the image classification model using the contrast loss.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image classification technology, and in particular to an optimization method for an image classification model, an electronic device, and a storage medium. Background Technology

[0002] In recent years, deep learning technology and deep neural networks (DNNs) have achieved remarkable results in the field of image classification. DNNs can be used to train image classification models, which can then be used to classify image data.

[0003] In the process of classifying image data, the accuracy of category prediction significantly impacts the efficiency of image classification models. Therefore, continuous optimization of image classification models is necessary to improve their accuracy. Current techniques typically optimize image classification models based on category loss. However, the calculation of category loss is often obtained through global feature extraction of the image data. Therefore, this method is often insufficient for accurately optimizing the image classification model. Summary of the Invention

[0004] In view of this, the purpose of this application is to propose an optimization method for an image classification model, an electronic device, and a storage medium.

[0005] As one aspect of this application, an optimization method for an image classification model is provided, comprising:

[0006] An image classification model is obtained, and deep features are extracted from the image data using the image classification model to generate a deep feature image;

[0007] Component features are extracted from the depth feature image to obtain at least two component features;

[0008] A component prototype is generated based on at least two of the component features, and the contrast loss of the depth feature image is calculated based on the component prototype.

[0009] The image classification model is optimized based on the contrast loss.

[0010] Optionally, component features are extracted from the depth feature image to obtain at least two component features, including:

[0011] Calculate the similarity between the depth feature image and the preset component features;

[0012] Based on the similarity and the depth feature image, at least two component features are obtained;

[0013] The similarity calculation is expressed as follows:

[0014]

[0015] Where S represents similarity, R represents the real number space, ε represents the representation vector of the preset component features, k indicates that it is the k-th component feature, X represents the convolutional neural network, ij represents a position in the X space dimension, and T represents the matrix transpose operation. This represents the feature vector represented by the k-th component feature in the t-th iteration of the depth feature image, where ||2 represents the L2-Norm value of the vector. and It consists of two modules, each composed of a convolutional layer, a batch normalization layer, and a ReLU activation function layer.

[0016] Optionally, at least two component features are obtained based on the similarity calculation result and the depth feature image, represented as follows:

[0017]

[0018] Among them, This indicates a transformation of the feature dimensions of the matrix. Let X represent a minimum value used to prevent the denominator from being zero, where X represents the convolutional neural network, H represents the height of the depth feature image, W represents the width of the depth feature image, C represents the dimension of the depth feature image, S represents the similarity, and R represents the real number space.

[0019] Optionally, the component prototype representation can be calculated based on at least two of the component features as follows:

[0020]

[0021] in, Let W represent the component prototype, B represent the number of categories in the target dataset, B represent the number of samples in the target dataset, N represent the number of component features, C represent the dimension of the component features, i and j represent a position in the X space dimension, X represents the convolutional neural network, F represents the component features, and R represents the real number space.

[0022] Optionally, the contrast loss of the depth feature image is calculated based on the component prototype, including:

[0023] Calculate the distances from at least two of the component features to the component prototype;

[0024] Calculate the contrast loss of the depth feature image based on the distance;

[0025] The distance from at least two of the component features to the component prototype is expressed as:

[0026]

[0027] in, Indicates the distance from a component feature to the component prototype. This represents the prototype of the component, and ||2 represents taking the L2-norm value of the vector. This represents any one of the component features. It is a module consisting of convolutional layers, batch normalization layers, and ReLU activation layers.

[0028] Optionally, the contrast loss of the depth feature image is calculated based on the distance, and is expressed as:

[0029]

[0030] Where W, B, and N represent the number of categories, the number of samples per category, and the number of component features in each sample, respectively. Represents the cross-entropy loss function. This represents the calculation process from component features to component prototype, where F represents the component feature and P represents the component prototype.

[0031] Optionally, extracting component features from the depth feature image to obtain at least two component features further includes:

[0032] Predict the category of the depth feature image based on at least two of the component features;

[0033] The classification loss of the depth feature image is calculated based on the predicted category of the depth feature image and the true category of the depth feature image;

[0034] Wherein, determining the category of the depth feature image based on at least two of the component features is expressed as:

[0035]

[0036] in, This is used to determine the category of the depth feature image. Indicates mean square error. Let N be the set of labeled component features, where N represents the number of component features in each sample, W represents the number of categories, and S represents the data in each category. Let R represent the j-th component feature of the depth feature image, and let R represent the real number space.

[0037] Optionally, optimizing the image classification model based on the contrast loss may further include optimizing the image classification model based on the contrast loss and the classification loss.

[0038] As a second aspect of this application, an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the program to implement the optimization method of the image classification model provided in this application.

[0039] As a third aspect of this application, a non-transitory computer-readable storage medium is provided, the non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the optimization method of the image classification model provided in this application. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1A This is a schematic diagram illustrating a method for optimizing an image classification model provided in an embodiment of this application.

[0042] Figure 1B This is a schematic diagram illustrating a method for obtaining depth feature image component features provided in an embodiment of this application.

[0043] Figure 1C This is a schematic diagram of a method for calculating contrast loss provided in an embodiment of this application.

[0044] Figure 1D This is a schematic diagram of a method for calculating classification loss provided in an embodiment of this application.

[0045] Figure 2 This is a schematic diagram of an electronic device structure for an image classification model optimization method provided in an embodiment of this application. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.

[0047] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly. Invention Overview

[0049] In existing technologies, the main method for optimizing image classification models is to first learn prior knowledge from a large-scale auxiliary dataset, where the auxiliary dataset contains a large amount of data. Then, the learned prior knowledge is applied to the target dataset to optimize the image classification model.

[0050] However, the inventors of this disclosure have discovered that when optimizing an image classification model using this method, the prior knowledge learned from the auxiliary dataset may not be applicable to the target dataset because the categories of the auxiliary dataset and the target dataset do not overlap in spatial dimensions, thus reducing the optimization capability of the image classification model.

[0051] To address the aforementioned issues, this disclosure provides an optimization method for an image classification model, comprising: acquiring an image classification model and extracting deep features from image data using the image classification model to generate a deep feature image; extracting component features from the deep feature image to obtain at least two component features; generating a component prototype based on the at least two component features and calculating the contrast loss of the deep feature image based on the component prototype; and optimizing the image classification model based on the contrast loss.

[0052] Based on this, we first extract deep features from the image classification model to generate a deep feature image, then extract component features from the deep feature image to obtain multiple component features, finally generate a component prototype through multiple component features and obtain the contrast loss, and then optimize the image classification model through the contrast loss.

[0053] By applying the method described in this disclosure, multi-part features can be extracted from depth feature images. These multi-part features are then compared with the original part prototypes, and the comparison results are used to optimize the image classification model. This improves the efficiency of image classification model optimization and significantly enhances the performance of the optimized model.

[0054] After introducing the basic principles of this application, the various non-limiting embodiments of this application will be described in detail below.

[0055] Application Scenarios Overview

[0056] Figure 1A This is a schematic diagram illustrating a method for optimizing an image classification model provided in an embodiment of this application.

[0057] Figure 1A The method for optimizing the image classification model shown further includes the following steps:

[0058] Step S10: Obtain an image classification model, and extract deep features from the image data using the image classification model to generate a deep feature image.

[0059] In some embodiments, the image classification model can be a high-performance model with image classification capabilities formed based on deep learning technology and deep neural networks (DNNs). When a user needs to classify image data, the user can call the image classification model to complete the image data segmentation. It is understood that DNNs can be a collection of various networks (e.g., ResNet12 and ConvNetL4), and this application does not limit the specific network used in the DNNs.

[0060] In some embodiments, the image classification model is a highly learned model that can be continuously optimized to improve its performance. Users can continuously train the image classification model to further improve its accuracy in image classification, thereby increasing its efficiency.

[0061] In some embodiments, the user can use an image classification model to extract depth features from the image data to be processed, generate a depth feature image from the extracted depth features, and then record the feature data of the depth feature image (e.g., the dimension C, length H, and width W of the depth feature image). This ensures that the extracted depth feature image X satisfies... .

[0062] Step S20: Extract component features from the depth feature image to obtain at least two component features.

[0063] In some embodiments, a depth feature image may be composed of a large number of component features. An image classification model can learn these component features and use them to classify the image data.

[0064] In some embodiments, when extracting component features from a depth feature image, a fine-grained few-sample method can be used. Since the component features are obtained through fine-grained few-sample extraction, they can extract more accurate detailed component features from the depth feature image compared to general component features extracted based on global features. Furthermore, because the extracted component features are obtained using a fine-grained few-sample method, the accuracy of category prediction for image classification models can be significantly improved.

[0065] In some embodiments, the image classification model can set pre-defined part features and perform comparative learning with the depth feature image to obtain multiple part features with high similarity to the depth feature image. It is understood that the pre-defined part features are multiple part features pre-defined by the image classification model, so their similarity to the multiple part features of the depth feature image may differ significantly. This difference can be reduced through multiple comparative learning processes.

[0066] Figure 1B This is a schematic diagram illustrating a method for obtaining depth feature image component features provided in an embodiment of this application.

[0067] In some embodiments, such as Figure 1B The diagram shows a further explanation of step S20, which specifically includes the following steps:

[0068] S201: Calculate the similarity between the depth feature image and the preset component features.

[0069] In some embodiments, the image classification model can set multiple pre-defined part features and perform similarity calculations between the pre-defined part features and the depth feature image to obtain the degree of similarity between the pre-defined part features and the part features in the depth feature image, and determine the final part features based on the degree of similarity. The similarity calculation table can be shown as follows:

[0070]

[0071] Where S represents similarity, R represents the real number space, ε represents the representation vector of the preset component features, k represents the representation of the k-th component feature element, ij represents a position in the X space dimension, X represents a convolutional neural network, and T represents the matrix transpose operation. This represents the feature vector represented by the k-th component feature in the t-th iteration of the depth feature image, where ||2 represents the L2-Norm value of the vector. and It consists of two modules, each composed of a convolutional layer, a batch normalization layer, and a ReLU activation function layer.

[0072] S202: Based on the similarity and the depth feature image, obtain at least two of the component features.

[0073] In some embodiments, similarity calculations can determine the degree of resemblance between pre-defined component features and component features in a depth feature image. Pre-defined component features with high similarity can be retained, while those with low similarity can be removed. Multiple pre-defined component features with high similarity are then used as the final multiple (at least two) component features. The image classification model is then fed back based on these multiple component features, and the image data can be classified using the feedback results. The process of obtaining multiple component features can be represented as follows:

[0074]

[0075] Among them, This indicates a transformation of the feature dimensions of the matrix. is a minimum value used to prevent the denominator from being zero. X represents the convolutional neural network, H represents the height of the depth feature image, W represents the width of the depth feature image, C represents the dimension of the depth feature image, S represents the similarity, and R represents the real number space.

[0076] In some embodiments, after similarity calculation, there may be a situation where a large number of pre-defined component features have very low similarity to the component features in the depth feature image. In this case, if these pre-defined component features with very low similarity are used as the final component features, it may greatly affect the accuracy of the image classification model in classifying image data.

[0077] In some embodiments, for this situation, the image classification model can also assign corresponding weights to these pre-part features with very low similarity. For example, pre-part features with high similarity are assigned higher weights, and pre-part features with low similarity are assigned lower weights. These pre-part features with different weights are used as the final multiple part features, and these weighted part features are then fed back to the image classification model, so that the image data can be classified based on the feedback results.

[0078] In some embodiments, the image classification model assigns weights to multiple pre-defined component features, such that component features with higher similarity have a greater impact on the final classification result, while component features with lower similarity have a smaller impact on the final classification result.

[0079] In some embodiments, the process of comparative learning of deep feature images can improve the accuracy of image classification models when classifying images, while also increasing the efficiency of image classification models.

[0080] In some embodiments, based on the above method, when the similarity between the pre-set component features and the component features of the depth feature image is very low, the final classification result may be inaccurate, or even result in an inability to classify. To address this, this disclosure further calculates the loss of the component features and feeds the calculated result back into the image classification model, ultimately optimizing the image classification model using the calculated loss result.

[0081] Step S30: Generate a component prototype based on at least two of the component features, and calculate the contrast loss of the depth feature image based on the component prototype.

[0082] In some embodiments, the image classification model determines multiple component features by calculating the similarity between pre-defined component features and component features of a depth feature image. The image classification model can then classify image data using these multiple component features. However, since the similarity calculation between pre-defined component features and component features of a depth feature image incurs a loss, the accuracy of the image classification model in classifying images cannot be guaranteed. Therefore, the resulting loss can be used to optimize the image classification model, thereby improving the accuracy of the image classification model in predicting categories.

[0083] In some embodiments, when similarity calculation is performed between pre-determined part features and part features in a depth feature image, the resulting loss can be a contrastive loss. A part prototype can be generated using the final determined part features, and the contrastive loss can be calculated based on the part prototype and the depth feature image. Finally, the result of the contrastive loss is fed back into the image classification model to optimize the model and improve the accuracy of the image classification model in predicting categories.

[0084] In some embodiments, a component prototype can be obtained by calculating multiple component features, as follows:

[0085]

[0086] in, Let W represent the component prototype, W represent the category data, B represent the number of each sample in the target dataset, N represent the number of component features, C represent the dimension of the component features, i and j represent a position in the X space dimension, X represents the convolutional neural network, F represents the component features, and R represents the real number space.

[0087] Figure 1C This is a schematic diagram of a method for calculating contrast loss provided in an embodiment of this application.

[0088] In some embodiments, such as Figure 1C The diagram shows a further explanation of step S30, which specifically includes the following steps:

[0089] S301: Calculate the distances from at least two of the component features to the component prototype.

[0090] In some embodiments, after generating a component prototype from multiple component features, the distances from the multiple component features to the component prototype (i.e., the differences between the multiple component features and the component prototype) can be calculated, and then the contrast loss of the depth feature image can be calculated using these distances. The distances from the multiple component features to the component prototype can be expressed as:

[0091]

[0092] in, Indicates the distance from a component feature to the component prototype. This represents the prototype of the component, and ||2 represents taking the L2-norm value of the vector. This represents any one of the component features. It is a module consisting of convolutional layers, batch normalization layers, and ReLU activation layers.

[0093] S302: Calculate the contrast loss of the depth feature image based on the distance.

[0094] In some embodiments, after obtaining the distances between multiple component features and the component prototype, a contrastive loss can be further calculated using these distances. This contrastive loss is then used to optimize the image classification model, thereby improving the accuracy of category prediction. It is understood that the contrastive loss can be calculated in various ways, such as Mean Square Error (MSE), hinge loss, and cross-entropy loss. This disclosure uses cross-entropy loss as an example. The contrastive loss calculated using the distances between multiple component features and the component prototype can be expressed as:

[0095]

[0096] Where W, B, and N represent the number of categories, the number of samples per category, and the number of component features in each sample, respectively. Represents the cross-entropy loss function. This represents the calculation process from component features to component prototype, where F represents the component feature and P represents the component prototype.

[0097] In some embodiments, after the contrast loss is calculated, it can be fed back into the image classification model to optimize the image classification model, thereby improving the accuracy of the image classification model in predicting image categories.

[0098] In some embodiments, the contrast loss can also be a loss calculated based on component features extracted with fine-grained features. Since the component features used to calculate the contrast loss in this disclosure are obtained through fine-grained feature extraction, the contrast loss of this disclosure provides higher accuracy compared to general losses, thereby enabling more specific optimization of the image classification model.

[0099] In some embodiments, this disclosure also calculates a classification loss for the depth feature image based on its category. This classification loss is then used to provide feedback to the image classification model, thereby improving the accuracy of the model's image category prediction. The following sections will further explain how to calculate the classification loss.

[0100] Figure 1D This is a schematic diagram of a method for calculating classification loss provided in an embodiment of this application.

[0101] In some embodiments, such as Figure 1D The diagram shows a further explanation of step S20, which also includes the following steps:

[0102] S203: Predict the category of the depth feature image based on at least two of the component features.

[0103] In some embodiments, based on step S20, after obtaining multiple component features through similarity calculation, the category of the depth feature image can be predicted using these component features, and then the classification loss of the depth feature image can be obtained using the predicted category. The prediction of the depth feature image category can be expressed as:

[0104]

[0105] in, This is used to determine the category of the depth feature image. Indicates mean square error. Let N be the set of labeled component features, where N represents the number of component features in each sample, W represents the number of categories, and S represents the data in each category. This represents the j-th component feature of the depth feature image.

[0106] S204: Calculate the classification loss of the depth feature image based on the predicted category of the depth feature image and the true category of the depth feature image.

[0107] In some embodiments, the true category of the image classification model can be obtained through image classification model and user data collection. Based on the true category of the image classification model and the aforementioned predicted category, the classification loss of the image classification model can be calculated. Furthermore, the image classification model can be optimized using the classification loss, thereby improving the accuracy of the image classification model in predicting image data categories.

[0108] In some embodiments, the classification loss can also be calculated using the aforementioned cross entropy loss, which will not be elaborated upon in this embodiment. It is understood that the classification loss can also be calculated using mean square error (MSE), hinge loss, etc.

[0109] Step S40 includes: optimizing the image classification model based on the contrast loss.

[0110] In some embodiments, this disclosure calculates contrastive loss and classification loss using part loss obtained from depth feature images. These contrastive and classification losses can then be fed back into an image classification model to optimize the model and improve its accuracy in predicting image data categories.

[0111] In some embodiments, the contrastive loss can be the distance from multiple part features to each part prototype, and the classification loss can be the distance between image data categories in each target dataset for each part feature. The image classification model is then optimized using both contrastive and classification losses.

[0112] In summary, this disclosure obtains contrastive loss through contrastive learning and classification loss through category calculation. Then, the contrastive and classification losses are used together to optimize the image classification model. This significantly improves the optimization effect of the image classification model, resulting in a substantial increase in the accuracy of image category prediction under the optimization of multiple losses, while also accelerating the efficiency of the image classification process.

[0113] Based on the same technical concept, corresponding to the methods of any of the above embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the optimization method of the image classification model described in any of the above embodiments.

[0114] Figure 2 This is a schematic diagram of an electronic device structure for an image classification model optimization method provided in an embodiment of this application. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.

[0115] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0116] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0117] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0118] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0119] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.

[0120] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0121] The electronic devices described above are used to implement the optimization method of the corresponding image classification model in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0122] Based on the same technical concept, corresponding to the methods of any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the optimization method of the image classification model as described in any of the above embodiments.

[0123] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0124] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the optimization method of the image classification model as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0125] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.

[0126] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0127] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0128] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.

Claims

1. An optimization method for an image classification model, characterized in that, include: An image classification model is obtained, and deep features are extracted from the image data using the image classification model to generate a deep feature image; Component features are extracted from the depth feature image to obtain at least two component features; A component prototype is generated based on at least two of the component features; the distance from the at least two component features to the component prototype is calculated; and the contrast loss of the depth feature image is calculated based on the distance. The image classification model is optimized based on the contrast loss. The process of extracting component features from the depth feature image yields at least two component features, including: Calculate the similarity between the depth feature image and the preset component features; Based on the similarity and the depth feature image, at least two component features are obtained; The similarity calculation is expressed as follows: Where S represents similarity, R represents the real number space, ε represents the representation vector of the preset component features, k indicates that it is the k-th component feature, X represents the convolutional neural network, ij represents a position in the X space dimension, and T represents the matrix transpose operation. This represents the feature vector represented by the k-th component feature in the t-th iteration of the depth feature image, where ||2 represents the L2-Norm value of the vector. and It consists of two modules, each composed of a convolutional layer, a batch normalization layer, and a ReLU activation function layer; The step of obtaining at least two component features based on the similarity calculation result and the depth feature image is expressed as follows: ; Among them, This indicates a transformation of the characteristic dimensions of the matrix. Let X represent a minimum value used to prevent the denominator from being zero, where X represents the convolutional neural network, H represents the height of the depth feature image, W represents the width of the depth feature image, C represents the dimension of the depth feature image, S represents the similarity, and R represents the real number space.

2. The method according to claim 1, characterized in that, The calculation of the component prototype based on at least two of the component features is represented as follows: in, Let W represent the component prototype, B represent the number of categories in the target dataset, B represent the number of samples in the target dataset, N represent the number of component features, C represent the dimension of the component features, i and j represent a position in the X space dimension, X represents the convolutional neural network, F represents the component features, and R represents the real number space.

3. The method according to claim 1, characterized in that, The distance from at least two of the component features to the component prototype is expressed as: in, Indicates the distance from a component feature to the component prototype. This represents the prototype of the component, and ||2 represents taking the L2-norm value of the vector. This represents any one of the component features. It is a module consisting of convolutional layers, batch normalization layers, and ReLU activation layers.

4. The method according to claim 3, characterized in that, The contrast loss calculated based on the distance for the depth feature image is expressed as: Where W, B, and N represent the number of categories, the number of samples per category, and the number of component features in each sample, respectively. Represents the cross-entropy loss function. This represents the calculation process from component features to component prototype, where F represents the component feature and P represents the component prototype.

5. The method according to claim 1, characterized in that, The step of extracting component features from the depth feature image to obtain at least two component features also includes: Predict the category of the depth feature image based on at least two of the component features; The classification loss of the depth feature image is calculated based on the predicted category of the depth feature image and the true category of the depth feature image; Wherein, determining the category of the depth feature image based on at least two of the component features is expressed as: in, This is used to determine the category of the depth feature image. Indicates mean square error. Let N be the set of labeled component features, where N represents the number of component features in each sample, W represents the number of categories, and S represents the data in each category. Let R represent the j-th component feature of the depth feature image, and let R represent the real number space.

6. The method according to claim 5, characterized in that, The optimization of the image classification model based on the contrast loss also includes optimizing the image classification model based on the contrast loss and the classification loss.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.

8. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 6.