Classification network training method and device, program product and storage medium
By using the original images and enhanced images in multiple sets of training data to generate feature description matrix, the problem of inaccurate identification in the prior art in the few-sample classification and domain generalization tasks is solved, and more accurate image category recognition is achieved.
Patent Information
- Application Number
- CN202411570136.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-25
AI Technical Summary
Large-scale pre-trained vision-language models in the prior art are susceptible to conditional deviations in small sample classification or domain generalization tasks, resulting in the inability to accurately identify the categories of images.
By acquiring multiple sets of training data, each set of data includes the original image and the image after it is enhanced, the initial classification network is trained to generate a feature description matrix to improve the accuracy of image classification recognition.
By generating a feature description matrix using the difference vector between the original image and the enhanced image, the target classification network can more accurately identify the category of the image, solving the problem of inaccurate identification in the prior art.
Smart Images

Figure CN119693677A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and specifically, to a training method and device for a classification network, a program product, and a storage medium. Background Art
[0002] In the evolution of artificial intelligence, large-scale pre-trained vision-language models (VLMs) have become a key technology to promote zero-shot learning (ZSL) tasks. These models have achieved breakthrough progress in effectively classifying unseen categories by deeply integrating visual perception and language understanding capabilities.
[0003] However, the models in related technologies create category-specific classification weights by integrating contextual information generated by images, which is easily affected by conditional bias, resulting in unexpected bias in few-sample classification or domain generalization tasks, and unable to accurately identify the category of the image.
[0004] With respect to the above technical problems, no effective solutions have been proposed in the relevant technologies. Summary of the invention
[0005] The embodiments of the present application provide a classification network training method and device, a program product, and a storage medium to at least solve the problem in the related art that the category of an image cannot be accurately identified.
[0006] According to one embodiment of the present application, a training method for a classification network is provided, comprising: obtaining multiple groups of training data, wherein each group of training data includes an original image and an enhanced image obtained by enhancing the original image; using the multiple groups of training data to perform training operations on an initial classification network to obtain a target classification network, wherein the initial classification network includes a fusion subnetwork and a classification subnetwork, and for each group of training data, the fusion subnetwork is used to generate a feature description matrix based on a difference vector between the original image and the enhanced image, the difference vector being a vector representation of the difference in image features between the original image and the enhanced image, and the classification subnetwork is used to perform image classification and recognition on the original image based on the feature description matrix.
[0007] In an exemplary embodiment, multiple sets of training data are used to train an initial classification network to obtain a target classification network, including: using multiple sets of training data to iteratively train the initial classification network until the number of times the initial classification network is trained reaches a target number of times, or when the loss value output by the target loss function of the initial classification network meets a preset training end condition, the training is terminated to obtain the target classification network; wherein the initial classification network also includes a preprocessing subnetwork, and the preprocessing subnetwork is used to convert the original image and the enhanced image into a vector representation; the loss value output by the target loss function is a loss value determined based on a first loss value output by a first loss function of a fusion subnetwork and a second loss value output by a second loss function; the first loss function is used to represent the loss between a feature description matrix and a first known feature description matrix corresponding to the original image and the enhanced image input by the preprocessing subnetwork, and the second loss function is used to represent the loss between a feature description matrix and a second known feature description matrix corresponding to the image feature difference between the original image and the enhanced image input by the preprocessing subnetwork.
[0008] In an exemplary embodiment, for each set of training data, the fusion subnetwork is used to generate a feature description matrix through the following steps: determining a first target feature vector of the original image and a second target feature vector of the enhanced image, wherein the first target feature vector is a vector representation of the attribute features of the original image, and the second target feature vector is a vector representation of the attribute features of the enhanced image; determining a difference vector between the original image and the enhanced image based on the first target feature vector and the second target feature vector; and constructing a feature description matrix using the difference vector, the first target feature vector, and the second target feature vector.
[0009] In an exemplary embodiment, determining a first target feature vector of an original image and a second target feature vector of an enhanced image includes: inputting the first feature vector of the original image and the second feature vector of the enhanced image output by a preprocessing subnetwork into a fusion subnetwork to obtain a first target feature vector and a second target feature vector; wherein the first feature vector is a vector representation of the original image, and the second feature vector is a vector representation of the enhanced image, and the fusion subnetwork is used to perform a matrix transformation operation on both the first feature vector and the second feature vector to obtain the first target feature vector and the second target feature vector.
[0010] In an exemplary embodiment, determining a difference vector between an original image and an enhanced image based on a first target feature vector and a second target feature vector includes: inputting both the first target feature vector and the second target feature vector into a fusion subnetwork to obtain a difference vector, wherein the fusion subnetwork is used to calculate the difference between the first target feature vector and the second target feature vector to obtain the difference vector.
[0011] In an exemplary embodiment, a feature description matrix is constructed using a difference vector, a first target feature vector, and a second target feature vector, including: inputting the first image description of the original image and the second image description of the enhanced image into a fusion subnetwork to obtain a third feature vector and a fourth feature vector, wherein the fusion subnetwork is used to convert the first image description and the second image description into a vector representation, the third feature vector is the vector representation of the second image description, and the fourth feature vector is the vector representation of the second image description; and concatenating the difference vector, the first target feature vector, the second target feature vector, the third feature vector, and the fourth feature vector to obtain a feature description matrix.
[0012] In an exemplary embodiment, concatenating a difference vector, a first target feature vector, a second target feature vector, a third feature vector and a fourth feature vector to obtain a feature description matrix includes at least one of the following: arranging the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector in the order in which the fusion sub-network generates the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector to obtain the feature description matrix; arranging the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector according to the set weight coefficient of the difference vector, the weight coefficient of the first target feature vector, the weight coefficient of the second target feature vector, the weight coefficient of the third feature vector and the weight coefficient of the fourth feature vector to obtain the feature description matrix.
[0013] In an exemplary embodiment, the above method also includes determining a first loss function in the following manner: L1=min(distance(p, pa1)+1-distance(pa, pb)+margin); wherein L1 is used to represent the first loss function, p is used to represent the first target feature vector, pa1 is used to represent the second target feature vector, distance(p, pa1) is used to represent the distance between p and pa1, pb is used to represent the first other target feature vector of other original images, and margin is used to represent preset parameters.
[0014] In an exemplary embodiment, the above method also includes determining a second loss function in the following manner: L2=min(distance(Δpa1, Δpb1)+1-distance(Δpb1, Δpb2)+margin); wherein, L2 is used to represent the second loss function, Δpa1=pa1-pa, Δpb1=pb1-pb, Δpb2=pb2-pb, pa1 is used to represent the second target feature vector, distance(Δpa1, Δpb1) is used to represent the distance between Δpa1 and Δpb1, pb1 is used to represent the second other target feature vector, pb2 is used to represent the third other target feature vector, the second other target feature vector corresponds to the first enhanced image of the other original image, the third other target feature vector corresponds to the second enhanced image of the other original image, and margin is used to represent a preset parameter.
[0015] In this embodiment, a classification network is also provided, including: a fusion subnetwork and a classification subnetwork, wherein the fusion subnetwork is used to generate a feature description matrix based on a difference vector between an original image and an enhanced image, wherein the enhanced image is an image obtained after enhancement processing of the original image, and the difference vector is a vector representation of the difference in image features between the original image and the enhanced image; and the classification subnetwork is used to perform image classification and recognition on the original image based on the feature description matrix.
[0016] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0017] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0018] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0019] Through the present application, since the training data for training the initial classification network includes the original image and the enhanced image obtained by enhancing the original image, the fusion subnetwork included in the initial classification network can generate a feature description matrix based on the difference vector between the original image and the enhanced image, and the classification subnetwork can perform image classification and recognition on the original image based on the feature description matrix, so that the trained target classification network can more accurately identify the category of the image based on the image feature difference between the original image and the enhanced image. Therefore, the problem of being unable to accurately identify the category of the image in the related art can be solved, and the effect of accurately identifying the category of the image can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a hardware structure block diagram of a server device of a classification network training method according to an embodiment of the present application;
[0021] Figure 2 is a flow chart of a training method for a classification network according to an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of the overall process of the initial classification network training process according to an embodiment of the present application;
[0023] Figure 4 It is a schematic diagram of the overall process of the model training process according to a specific embodiment of the present application;
[0024] Figure 5 is a structural block diagram of a classification network according to an embodiment of the present application;
[0025] Figure 6 It is a structural block diagram of a training device for a classification network according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0028] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a classification network training method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0029] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the training method of the classification network in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0030] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] In this embodiment, a classification network training method is provided. Figure 2 is a flow chart of a training method for a classification network according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0032] Step S202, obtaining multiple sets of training data, wherein each set of training data includes an original image and an enhanced image obtained by enhancing the original image;
[0033] Optionally, the original image in this embodiment refers to an image that has not been processed or modified in any way, and it is the original data captured from a device such as a camera or scanner. The enhanced image refers to an original image that has been processed to a certain extent to improve its quality and visual effect. This processing can be automatic or manual. The purpose of image enhancement is to improve the readability, visual appeal of the image or facilitate further image analysis. Image enhancement methods include but are not limited to: contrast enhancement, brightness adjustment, color correction, sharpening, denoising, scaling and interpolation, edge detection, filtering. Through these methods, the original image can be converted into an enhanced image to meet the application requirements of model training.
[0034] Step S204, using multiple groups of training data to perform training operations on the initial classification network to obtain a target classification network, wherein the initial classification network includes a fusion subnetwork and a classification subnetwork, and for each group of training data, the fusion subnetwork is used to generate a feature description matrix based on the difference vector between the original image and the enhanced image, the difference vector is a vector representation of the image feature difference between the original image and the enhanced image, and the classification subnetwork is used to perform image classification and recognition on the original image based on the feature description matrix.
[0035] Optionally, the executor of the above steps may be a background processor, or other devices with similar processing capabilities, or a machine that integrates at least an image acquisition device and a data processing device, wherein the image acquisition device may include a graphics acquisition module such as a camera, and the data processing device may include a computer, a mobile phone or other terminal, but is not limited thereto.
[0036] Optionally, the initial classification network is a machine learning algorithm for predicting discrete labels or categories. The initial classification network includes, but is not limited to, a neural network, a deep learning classification model. For example, the initial classification network is a visual-linguistic model (VLM), which focuses on combining visual information (e.g., images, videos) with language information (e.g., text descriptions, questions) to achieve a higher level of understanding and analysis.
[0037] The structure of the initial classification network includes a preprocessing subnetwork, a fusion subnetwork, and a classification subnetwork connected in sequence. The above subnetworks can use different network models based on different functions. For example, the preprocessing subnetwork can be a convolutional neural network, which converts the input image into a format suitable for deep learning processing. Preprocessing operations may include normalization, resizing, color space conversion (for example, from RGB to grayscale), and data enhancement. The fusion subnetwork is used to integrate features from different sources or at different levels. It includes multi-scale feature fusion (for example, using feature maps of different resolutions), superposition of feature maps, or using attention mechanisms to strengthen the model's attention to specific features. Fusion can improve the network's ability to represent complex data and enhance the generalization performance of the model. The purpose of the classification subnetwork is to map the extracted features to the final category. This can be achieved through a fully connected layer or a convolutional layer, and sometimes a pooling layer is used to reduce the spatial dimension of the feature. The classification subnetwork usually uses an activation function to generate category probabilities. The design and structure of each subnetwork can be adjusted according to the specific application scenario and data characteristics. For example, in image classification tasks, specially designed convolutional layers may be needed to extract visual features; while in natural language processing (NLP) tasks, recurrent neural networks (RNNs) or Transformer models may be needed to process text data.
[0038] like Figure 3 FIG. 1 is a schematic diagram of the overall process of the initial classification network training process according to an embodiment of the present invention. In a certain training process, the training steps of the initial classification network include:
[0039] S301, inputting the original image and the enhanced image into an image enhancement module, and performing image enhancement on the original image through the image enhancement module to obtain an enhanced image.
[0040] S302, inputting the original image and the enhanced image into a preprocessing subnetwork, the preprocessing subnetwork converts the original image and the enhanced image into corresponding vector representations to obtain a first eigenvector and a second eigenvector.
[0041] S303, input the first feature vector and the second feature vector into the fusion sub-network to obtain the first target feature vector and the second target feature vector output by the fusion sub-network.
[0042] S304, concatenating the first target feature vector, the second target feature vector, the difference vector, the first feature vector and the second feature vector obtained in S303 to obtain a feature description matrix.
[0043] S305, then input the feature description matrix into the classification sub-network to obtain the feature description matrix to obtain the text encoding vector Ft.
[0044] Through the above steps, since the training data for training the initial classification network includes the original image and the enhanced image obtained by enhancing the original image, the fusion subnetwork included in the initial classification network can generate a feature description matrix based on the difference vector between the original image and the enhanced image, and the classification subnetwork can classify and recognize the original image based on the feature description matrix, so that the trained target classification network can more accurately recognize the category of the image based on the image feature difference between the original image and the enhanced image. Therefore, the problem of being unable to accurately recognize the category of the image in the related art can be solved, and the effect of accurately recognizing the category of the image can be achieved.
[0045] In an exemplary embodiment, the initial classification network is trained using multiple sets of training data to obtain a target classification network, including the following steps:
[0046] Step S301, iteratively training the initial classification network using multiple sets of training data until the number of times the initial classification network is trained reaches a target number of times, or when the loss value output by the target loss function of the initial classification network meets a preset training end condition, the training is terminated to obtain a target classification network;
[0047] The initial classification network also includes a preprocessing subnetwork, which is used to convert the original image and the enhanced image into a vector representation;
[0048] The loss value output by the target loss function is a loss value determined based on a first loss value output by the first loss function of the fusion sub-network and a second loss value output by the second loss function;
[0049] The first loss function is used to represent the loss between the feature description matrix and the first known feature description matrix corresponding to the original image and the enhanced image input by the preprocessing subnetwork, and the second loss function is used to represent the loss between the feature description matrix and the second known feature description matrix corresponding to the image feature difference between the original image and the enhanced image input by the preprocessing subnetwork.
[0050] Optionally, the target number in this embodiment may be a basic parameter for configuring training, and AdamW may be used as a training optimizer, for example, 300 epochs may be trained.
[0051] Optionally, the preprocessing subnetwork example in the present embodiment includes but is not limited to an image encoder (ImageEncoder), which can be a component in a model (Contrastive Language-Image Pre-training, referred to as CLIP), and the image encoder converts the original image and the enhanced image into corresponding vector representations. This process extracts and represents the features learned by pre-training the image. The extracted features are encoded into vectors, which capture the key information of the image. These vectors usually have high-dimensional characteristics, but the dimension can be reduced by specific techniques (such as pooling, normalization, etc.) for subsequent processing.
[0052] For example, Figure 3 As shown, Fa represents the vector representation of the original image Ia after passing through the Image Encoder, Fa1 represents the vector representation of the enhanced image Ia1 after passing through the Image Encoder, and Fa2 represents the vector representation of the enhanced image Ia2 after passing through the Image Encoder.
[0053] Optionally, the method further includes determining the first loss function in the following manner: L1=min(distance(p, pa1)+1-distance(pa, pb)+margin); wherein L1 is used to represent the first loss function, p is used to represent the first target feature vector, pa1 is used to represent the second target feature vector, distance(p, pa1) is used to represent the distance between p and pa1, pb is used to represent the first other target feature vector of the other original image, and margin is used to represent a preset parameter. This embodiment represents the minimum interval between two feature vectors. This ensures that the distance between the first target feature vector and the first other target feature vector of the other original image is greater than the set interval parameter, thereby achieving better feature extraction and classification effects.
[0054] Optionally, the method further includes determining a second loss function in the following manner: L2=min(distance(Δpa1, Δpb1)+1-distance(Δpb1, Δpb2)+margin); wherein L2 is used to represent the second loss function, Δpa1=pa1-pa, Δpb1=pb1-pb, Δpb2=pb2-pb, pa1 is used to represent the second target feature vector, distance(Δpa1, Δpb1) is used to represent the distance between Δpa1 and Δpb1, pb1 is used to represent the second other target feature vector, pb2 is used to represent the third other target feature vector, the second other target feature vector corresponds to the first enhanced image of the other original image, the third other target feature vector corresponds to the second enhanced image of the other original image, and margin is used to represent a preset parameter. In practical applications, the distance between Δpa1 and Δpb1, and the distance between Δpb1 and Δpb2 can be calculated, and then the value of L2 can be calculated according to the formula. According to the value of L2, the fusion sub-network can be trained and optimized to improve the expression and classification performance of the feature vector.
[0055] In an exemplary embodiment, for each set of training data, the fusion sub-network is used to generate a feature description matrix by the following steps:
[0056] Step S401, determining a first target feature vector of the original image and a second target feature vector of the enhanced image, wherein the first target feature vector is a vector representation of the attribute feature of the original image, and the second target feature vector is a vector representation of the attribute feature of the enhanced image;
[0057] Optionally, determining a first target feature vector of the original image and a second target feature vector of the enhanced image includes: inputting the first feature vector of the original image and the second feature vector of the enhanced image output by the preprocessing subnetwork into a fusion subnetwork to obtain a first target feature vector and a second target feature vector; wherein the first feature vector is a vector representation of the original image, and the second feature vector is a vector representation of the enhanced image, and the fusion subnetwork is used to perform a matrix transformation operation on both the first feature vector and the second feature vector to obtain a first target feature vector and a second target feature vector.
[0058] Optionally, after preprocessing by the preprocessing subnetwork, the original image is converted into feature vectors. These feature vectors contain important information of the image, such as texture, color, shape, etc. The enhanced image is also converted into feature vectors, which emphasize certain features that are not highlighted in the original image. The purpose of the fusion subnetwork is to combine the first feature vector and the second feature vector. Fusion can be performed in many ways, such as simple weighted average, feature cascade, multi-scale fusion, etc. The fused output, i.e., the target feature vector, is a combination of the original feature vector and the enhanced feature vector. These target feature vectors can be used for further analysis or processing, such as classification, regression, object detection, etc. The purpose of fusing feature vectors is to utilize two different sources of information to improve the performance of the model. For example, in image processing, the original image may include basic texture and color information, while the enhanced image may highlight edges or specific features. By fusing these two types of information, the classification network can have better performance in recognizing and analyzing images.
[0059] Step S402, determining a difference vector between the original image and the enhanced image based on the first target feature vector and the second target feature vector;
[0060] Optionally, determining a difference vector between the original image and the enhanced image based on the first target feature vector and the second target feature vector includes: inputting both the first target feature vector and the second target feature vector into a fusion subnetwork to obtain a difference vector, wherein the fusion subnetwork is used to calculate the difference between the first target feature vector and the second target feature vector to obtain the difference vector.
[0061] Optionally, the following is a step of inputting the first target feature vector and the second target feature vector into the fusion sub-network to obtain a difference vector:
[0062] In step S4021, you need to ensure that the two target feature vectors have the same dimensions. If they have different dimensions, you may need to adjust or normalize them.
[0063] Step S4022, design a neural network structure that can accept two input feature vectors and output the difference between them. This network can be composed of multiple layers, such as dense layers, convolutional layers, or recurrent layers, depending on your application scenario. For example, the fusion sub-network is a Meta-Net network, which is a neural network that can learn and use metadata (i.e., descriptive information of the data) to improve performance.
[0064] Step S4023, calculate the difference. In the fusion subnetwork, different methods can be used to calculate the difference between two feature vectors. For example, direct subtraction: simply subtract the two feature vectors to get the difference vector. Element-by-element operation: perform element-by-element weighted sum or other operations on the corresponding elements of the two feature vectors. Use distance metrics: for example, Euclidean distance, Manhattan distance or cosine similarity to evaluate the similarity or difference between two feature vectors.
[0065] This embodiment can more accurately identify the difference between the original image and the enhanced image by calculating the difference vector between the first target feature vector and the second target feature vector, which helps to achieve more objective and consistent processing results.
[0066] Step S403: construct a feature description matrix using the difference vector, the first target feature vector and the second target feature vector.
[0067] Optionally, a feature description matrix is constructed using the difference vector, the first target feature vector, and the second target feature vector, including: inputting the first image description of the original image and the second image description of the enhanced image into a fusion subnetwork to obtain a third feature vector and a fourth feature vector, wherein the fusion subnetwork is used to convert the first image description and the second image description into a vector representation, the third feature vector is the vector representation of the second image description, and the fourth feature vector is the vector representation of the second image description; and concatenating the difference vector, the first target feature vector, the second target feature vector, the third feature vector, and the fourth feature vector to obtain a feature description matrix.
[0068] Optionally, the first image description of the original image and the second image description of the enhanced image are both input into the fusion sub-network to obtain the third feature vector and the fourth feature vector, including but not limited to the following steps:
[0069] S1, requires the original image and the image after some processing or enhancement.
[0070] S2, generate image description: For the original image and the enhanced image, it is necessary to use natural language processing (NLP) technology to generate image descriptions. This usually involves using a pre-trained language model (such as BERT, GPT, etc.) to generate a text description of the image. For the original image, generate a first image description; for the enhanced image, generate a second image description.
[0071] S3, input of the fusion sub-network: the first image description and the second image description are used as input data and passed into the fusion sub-network. The goal of the fusion sub-network is to combine the two descriptions to extract key features that help understand the image content and structure.
[0072] S4, extract feature vectors: The fusion sub-network processes the input description and extracts the third feature vector and the fourth feature vector. These two feature vectors represent the key information of the original image and the enhanced image respectively.
[0073] In this embodiment, the third eigenvector and the fourth eigenvector can be quickly obtained by inputting the first image description of the original image and the second image description of the enhanced image into the fusion sub-network.
[0074] Optionally, the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector are concatenated to obtain a feature description matrix, including at least one of the following:
[0075] Arrange the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector in the order in which the fusion sub-network generates the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector to obtain a feature description matrix;
[0076] According to the set weight coefficient of the difference vector, the weight coefficient of the first target feature vector, the weight coefficient of the second target feature vector, the weight coefficient of the third feature vector and the weight coefficient of the fourth feature vector, the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector are arranged to obtain a feature description matrix.
[0077] Optionally, the weight coefficients in this embodiment can be set based on the importance of the features, their contribution to the model, or other criteria. For example, if the weight coefficients are wd, w1, w2, w3, w4 corresponding to the difference vector and the four target feature vectors, respectively, then the weighted feature vectors Vd, V1, V2, V3, V4 can be expressed as: difference vector Vd = wd·difference vector, first target feature vector V1 = w1, second target feature vector V2 = w2, third feature vector V43 = w3, fourth feature vector V4 = w4. Arrange the weighted feature vectors in the specified order. For example, the order is: difference vector, first target feature vector, second target feature vector, third feature vector, fourth feature vector.
[0078] Construct the feature description matrix: Arrange the weighted feature vectors as rows or columns of the matrix. If the vectors are one-dimensional, you can arrange them as rows to form a 5×n feature description matrix, where n is the dimension of each vector. If the vectors are multidimensional and you want to arrange them as columns, then M will be an n×5 matrix.
[0079] This embodiment obtains a feature description matrix by splicing the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector, which can effectively integrate the feature deviations of the image and achieve effective separation of low-level visual features and high-level category information, which helps to achieve more accurate recognition and classification of unknown category data.
[0080] The present application is described below in conjunction with specific embodiments:
[0081] Since the related art uses attribute annotation to identify image categories, which is costly and inaccurate, this specific embodiment provides an image category recognition method based on a visual-language model (VLM). Figure 4 As shown, the VLM model in this specific embodiment includes a preprocessing subnetwork Image Encoder, a fusion subnetwork Meta-Net, and a classification subnetwork Text Encoder. The Meta-Net network model refers to a neural network designed specifically for image processing. Meta-Net has some meta-learning features, that is, it can quickly learn from a small amount of data and adapt to new tasks.
[0082] The implementation steps of this specific embodiment include:
[0083] S401, obtain any two original images Ia and Ib, input Ia and Ib into an image enhancement module (e.g., Albumentations library), and perform image enhancement on Ia and Ib through the image enhancement module, for example, perform HorizontalFlip, i.e., horizontal mirroring, on Ia to obtain Ia1, perform OpticalDistortion, i.e., optical distortion, on Ia to obtain Ia2, perform HueSaturationValue, i.e., hue saturation adjustment, on Ib to obtain Ib1, perform RandomBrightness, i.e., brightness and contrast adjustment, on Ib to obtain Ib2. This embodiment may select other enhancement technologies according to actual applications.
[0084] S402, after image enhancement, all images, including original images and enhanced images, will be input into the pre-trained image encoder Image Encoder, where the image encoder of CLIP is used. The image encoder converts the original image and the enhanced image into corresponding vector representations, for example, Fa represents the vector representation of the original image Ia after passing through the Image Encoder, Fa1 represents the vector representation of the enhanced image Ia1 after passing through the Image Encoder, Fa2 represents the vector representation of the enhanced image Ia2 after passing through the Image Encoder, Fb represents the vector representation of the original image Ib after passing through the Image Encoder, Fb1 represents the vector representation of the enhanced image Ib1 after passing through the Image Encoder, Fb2 represents the vector representation of the enhanced image Ib2 after passing through the Image Encoder, and so on.
[0085] S403, input the vector representation obtained in S402 into the Meta-Net network, and obtain the output of the Meta-Net network, Pa corresponding to Fa, Pa1 corresponding to Fa1, Pa2 corresponding to Fa2, Pb corresponding to Fb, Pb1 corresponding to Fb1, Pb2 corresponding to Fb2, and the vector represented by p here is called meta token. Among them, the Meta-Net network is a network with a multi-layer perceptron (e.g., MLP) structure, which is used to dynamically generate feature vectors that can capture image attributes. The introduction of Meta-Net is to make up for the possible lack of bias information when the vector representation is obtained directly using the Image Encoder. Among them, the multi-layer perceptron (MLP) structure is a feedforward neural network structure, which consists of multiple layers, and each layer includes multiple neurons. Each neuron receives the output of the neurons in the previous layer as input, and converts these inputs through an activation function to generate output. This structure enables MLP to learn and simulate complex function mappings.
[0086] S404, adjust the vector representation meta token obtained in S403 to the feature description matrix input tokens. The feature description matrix consists of three parts, including: w1, w2, w3..., which represent the metatoken of the original image, that is, Pa or Pb obtained in S403, and its function is to retain the feature information of the original image. v1, v2, v3..., represent the difference between the meta token of the enhanced image and the original image. The specific calculation method includes but is not limited to: Pa1-Pa, or Pb1-Pb, which is used to embed image information of specific attribute deviation. If there is no meta token of the enhanced image here, it is set to 0. Class, which is the encoding of the image description of the original image and the enhanced image. The three parts w1, w2, w3..., v1, v2, v3..., and Class are spliced together to obtain the final input tokens. The input tokens retain the feature information of the original image and introduce attribute deviation information.
[0087] S405, the input tokens are then passed through a text encoder to obtain a text encoding vector Ft.
[0088] Optionally, this embodiment is directed to Figure 4 The network architecture shown in the figure defines the loss function of the meta token, which consists of two parts: L1 and L2. L1 is used to retain the feature information of the original image, while L2 introduces attribute deviation information. Specifically, as shown in formulas (1) to (4), the relationship between the original image and the enhanced image is described, and formulas (5) and (6) define the specific optimization function.
[0089] L1=L(Pa, Pa1), formula (1);
[0090] Δpa1=pa1-pa, formula (2);
[0091] Δpb1=pb1-pb, formula (3);
[0092] L2=L(Δpa1, Δpb1, Δpb2), formula (4);
[0093] L1=min(distance(p,pa1)+1-distance(pa,pb)+margin), formula (5);
[0094] L2=min(distance(Δpa1,Δpb1)+1-distance(Δpb1,Δpb2)+margin), formula (6);
[0095] Among them, formula (2) represents the image attribute deviation of the original image Ia under the image enhancement method, and formula (3) represents the image attribute deviation of the original image Ib under the image enhancement method. The meaning of formula (5) is that the distance between a certain image and its enhanced image should be close, and the distance from other images (enhanced images) should be far. The meaning of formula (6) is that the deviation information vectors of different images under the same enhancement method should be close, and the deviation information vectors of the same (or different) images under different enhancement methods should be far. L1 is used to represent the first loss function, p is used to represent the first target feature vector, pa1 is used to represent the second target feature vector, distance(p, pa1) is used to represent the distance between p and pa1, pb is used to represent the first other target feature vector of other original images, and margin is used to represent the preset parameters. L2 is used to represent the second loss function, Δpa1=pa1-pa, Δpb1=pb1-pb, Δpb2=pb2-pb, pa1 is used to represent the second target feature vector, distance(Δpa1, Δpb1) is used to represent the distance between Δpa1 and Δpb1, pb1 is used to represent the second other target feature vector, pb2 is used to represent the third other target feature vector, the second other target feature vector corresponds to the first enhanced image of the other original image, and the third other target feature vector corresponds to the second enhanced image of the other original image. The overall optimization goal is to minimize L1+L2.
[0096] This specific embodiment introduces image feature deviation through image enhancement technology, combines the features of the original image with the feature deviation, and designs a dual loss function, so that the visual-language model can learn more effective prompts, thereby significantly improving the generalization ability of the visual-language model, enhancing the model's adaptability to different samples, and improving the stability and interpretability of the visual-language model.
[0097] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0098] In this embodiment, a classification network is also provided. Figure 5 is a structural block diagram of a classification network according to an embodiment of the present application, such as Figure 5As shown, the network includes: a fusion subnetwork 52 and a classification subnetwork 54, wherein:
[0099] A fusion subnetwork 52, configured to generate a feature description matrix based on a difference vector between an original image and an enhanced image, wherein the enhanced image is an image obtained after the original image is enhanced, and the difference vector is a vector representation of the difference in image features between the original image and the enhanced image;
[0100] The classification subnetwork 54 is used to perform image classification and recognition on the original image based on the feature description matrix.
[0101] Optionally, the classification network in this embodiment is a machine learning algorithm for predicting discrete labels or categories. The classification network includes but is not limited to a neural network, a deep learning classification model. For example, the classification network is a VLM, which focuses on combining visual information (e.g., images, videos) with language information (e.g., text descriptions, questions) to achieve a higher level of understanding and analysis.
[0102] like Figure 5 As shown, the structure of the classification network also includes a preprocessing subnetwork 56, which is connected to the fusion subnetwork 52. The above subnetworks can select different network models based on different functions. For example, the preprocessing subnetwork 56 can be a convolutional neural network, which converts the input image into a format suitable for deep learning processing. Preprocessing operations may include normalization, resizing, color space conversion (for example, from RGB to grayscale), and data enhancement. The fusion subnetwork 52 is used to integrate features from different sources or at different levels. Including multi-scale feature fusion (for example, using feature maps of different resolutions), superposition of feature maps, or using attention mechanisms to strengthen the model's attention to specific features. Fusion can improve the network's ability to represent complex data and enhance the generalization performance of the model. The purpose of the classification subnetwork 54 is to map the extracted features to the final category. It can be achieved through a fully connected layer or a convolutional layer, and sometimes a pooling layer is used to reduce the spatial dimension of the feature. The classification subnetwork 54 usually uses an activation function to generate category probabilities. The design and structure of each subnetwork can be adjusted according to the specific application scenario and data characteristics. For example, in image classification tasks, specially designed convolutional layers may be needed to extract visual features; while in natural language processing (NLP) tasks, recurrent neural networks (RNNs) or Transformer models may be needed to process text data.
[0103] Alternatively, if Figure 3 As shown, the classification network training process of the embodiment of the present invention includes the following steps:
[0104] S301, inputting the original image and the enhanced image into an image enhancement module, and performing image enhancement on the original image through the image enhancement module to obtain an enhanced image.
[0105] S302, inputting the original image and the enhanced image into a preprocessing subnetwork, the preprocessing subnetwork converts the original image and the enhanced image into corresponding vector representations to obtain a first eigenvector and a second eigenvector.
[0106] S303, input the first feature vector and the second feature vector into the fusion sub-network to obtain the first target feature vector and the second target feature vector output by the fusion sub-network.
[0107] S304, concatenating the first target feature vector, the second target feature vector, the difference vector, the first feature vector and the second feature vector obtained in S303 to obtain a feature description matrix.
[0108] S305, then input the feature description matrix into the classification sub-network to obtain the feature description matrix to obtain the text encoding vector Ft.
[0109] Through the above steps, since the training data of the training classification network includes the original image and the enhanced image obtained by enhancing the original image, the fusion sub-network included in the classification network can generate a feature description matrix based on the difference vector between the original image and the enhanced image, and the classification sub-network can perform image classification recognition on the original image based on the feature description matrix, so that the trained target classification network can more accurately recognize the category of the image based on the image feature difference between the original image and the enhanced image. Therefore, the problem that the category of the image cannot be accurately recognized in the related art can be solved, and the effect of accurately recognizing the category of the image can be achieved.
[0110] In this embodiment, a training device for a classification network is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0111] Figure 6 is a structural block diagram of a training device for a classification network according to an embodiment of the present application, such as Figure 6 As shown, the device comprises:
[0112] A first acquisition module 62 is used to acquire multiple sets of training data, wherein each set of training data includes an original image and an enhanced image obtained by enhancing the original image;
[0113] The first training module 64 is used to perform training operations on the initial classification network using multiple sets of training data to obtain a target classification network, wherein the initial classification network includes a fusion subnetwork and a classification subnetwork. For each set of training data, the fusion subnetwork is used to generate a feature description matrix based on a difference vector between the original image and the enhanced image, and the difference vector is a vector representation of the difference in image features between the original image and the enhanced image. The classification subnetwork is used to perform image classification and recognition on the original image based on the feature description matrix.
[0114] In an exemplary embodiment, the first training module 64 includes: a first training unit, which is used to iteratively train the initial classification network using multiple sets of training data until the number of times the initial classification network is trained reaches the target number of times, or when the loss value output by the target loss function of the initial classification network meets the preset training end condition, the training is terminated to obtain the target classification network; wherein the initial classification network also includes a preprocessing subnetwork, and the preprocessing subnetwork is used to convert the original image and the enhanced image into a vector representation; the loss value output by the target loss function is a loss value determined based on the first loss value output by the first loss function of the fusion subnetwork and the second loss value output by the second loss function; the first loss function is used to represent the loss between the feature description matrix and the first known feature description matrix corresponding to the original image and the enhanced image input by the preprocessing subnetwork, and the second loss function is used to represent the loss between the feature description matrix and the second known feature description matrix corresponding to the image feature difference between the original image and the enhanced image input by the preprocessing subnetwork.
[0115] In an exemplary embodiment, for each set of training data, the fusion subnetwork is used to generate a feature description matrix through the following modules: a first determination module, used to determine a first target feature vector of the original image and a second target feature vector of the enhanced image, wherein the first target feature vector is a vector representation of the attribute features of the original image, and the second target feature vector is a vector representation of the attribute features of the enhanced image; a second determination module, used to determine a difference vector between the original image and the enhanced image based on the first target feature vector and the second target feature vector; a first construction module, used to construct a feature description matrix using the difference vector, the first target feature vector and the second target feature vector.
[0116] In an exemplary embodiment, the above-mentioned first determination module includes: a first input unit, used to input the first eigenvector of the original image and the second eigenvector of the enhanced image output by the preprocessing subnetwork into the fusion subnetwork to obtain a first target feature vector and a second target feature vector; wherein the first eigenvector is a vector representation of the original image, and the second eigenvector is a vector representation of the enhanced image, and the fusion subnetwork is used to perform matrix transformation operations on both the first eigenvector and the second eigenvector to obtain the first target feature vector and the second target feature vector.
[0117] In an exemplary embodiment, the above-mentioned first determination module includes: a second input unit, used to input both the first target feature vector and the second target feature vector into a fusion sub-network to obtain a difference vector, wherein the fusion sub-network is used to calculate the difference between the first target feature vector and the second target feature vector to obtain a difference vector.
[0118] In an exemplary embodiment, the above-mentioned first construction module includes: a third input unit, used to input the first image description of the original image and the second image description of the enhanced image into a fusion subnetwork to obtain a third eigenvector and a fourth eigenvector, wherein the fusion subnetwork is used to convert the first image description and the second image description into a vector representation, the third eigenvector is the vector representation of the second image description, and the fourth eigenvector is the vector representation of the second image description; a first splicing unit, used to splice the difference vector, the first target eigenvector, the second target eigenvector, the third eigenvector and the fourth eigenvector to obtain a feature description matrix.
[0119] In an exemplary embodiment, the above-mentioned first splicing unit includes at least one of the following: a first generating subunit, used to arrange the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector in the order in which the fusion subnetwork generates the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector to obtain a feature description matrix; a first arranging subunit, used to arrange the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector according to the set weight coefficient of the difference vector, the weight coefficient of the first target feature vector, the weight coefficient of the second target feature vector, the weight coefficient of the third feature vector and the weight coefficient of the fourth feature vector to obtain a feature description matrix.
[0120] In an exemplary embodiment, the above-mentioned device also includes determining a first loss function in the following manner: L1=min(distance(p, pa1)+1-distance(pa, pb)+margin); wherein L1 is used to represent the first loss function, p is used to represent the first target feature vector, pa1 is used to represent the second target feature vector, distance(p, pa1) is used to represent the distance between p and pa1, pb is used to represent the first other target feature vector of other original images, and margin is used to represent preset parameters.
[0121] In an exemplary embodiment, the above-mentioned device also includes determining a second loss function in the following manner: L2=min(distance(Δpa1, Δpb1)+1-distance(Δpb1, Δpb2)+margin); wherein, L2 is used to represent the second loss function, Δpa1=pa1-pa, Δpb1=pb1-pb, Δpb2=pb2-pb, pa1 is used to represent the second target feature vector, distance(Δpa1, Δpb1) is used to represent the distance between Δpa1 and Δpb1, pb1 is used to represent the second other target feature vector, pb2 is used to represent the third other target feature vector, the second other target feature vector corresponds to the first enhanced image of the other original image, the third other target feature vector corresponds to the second enhanced image of the other original image, and margin is used to represent a preset parameter.
[0122] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0123] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0124] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0125] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0126] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0127] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0128] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0129] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0130] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0131] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0132] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A training method for a classification network, characterized in that: include: Acquire multiple sets of training data, wherein each set of the training data includes an original image and an enhanced image obtained by performing enhancement processing on the original image; The initial classification network is trained using the multiple groups of training data to obtain a target classification network, wherein the initial classification network includes a fusion subnetwork and a classification subnetwork, and for each group of the training data, the fusion subnetwork is used to generate a feature description matrix based on a difference vector between the original image and the enhanced image, wherein the difference vector is a vector representation of the difference in image features between the original image and the enhanced image, and the classification subnetwork is used to perform image classification and recognition on the original image based on the feature description matrix.
2. The method according to claim 1, characterized in that The method of using the multiple sets of training data to train the initial classification network to obtain the target classification network includes: Iteratively training the initial classification network using the multiple sets of training data until the number of times the initial classification network is trained reaches a target number of times, or when the loss value output by the target loss function of the initial classification network meets a preset training end condition, the training is terminated to obtain the target classification network; Wherein, the initial classification network further includes a preprocessing subnetwork, and the preprocessing subnetwork is used to convert the original image and the enhanced image into vector representation; The loss value output by the target loss function is a loss value determined based on a first loss value output by the first loss function of the fusion sub-network and a second loss value output by the second loss function; The first loss function is used to represent the loss between the feature description matrix and a first known feature description matrix corresponding to the original image input by the preprocessing subnetwork and the enhanced image, and the second loss function is used to represent the loss between the feature description matrix and a second known feature description matrix corresponding to the image feature difference between the original image input by the preprocessing subnetwork and the enhanced image.
3. The method according to claim 2, characterized in that For each set of the training data, the fusion sub-network is used to generate the feature description matrix through the following steps: Determine a first target feature vector of the original image and a second target feature vector of the enhanced image, wherein the first target feature vector is a vector representation of an attribute feature of the original image, and the second target feature vector is a vector representation of an attribute feature of the enhanced image; determining the difference vector between the original image and the enhanced image based on the first target feature vector and the second target feature vector; The feature description matrix is constructed using the difference vector, the first target feature vector, and the second target feature vector.
4. The method according to claim 3, characterized in that Determining a first target feature vector of the original image and a second target feature vector of the enhanced image includes: Inputting the first feature vector of the original image and the second feature vector of the enhanced image output by the preprocessing subnetwork into the fusion subnetwork to obtain the first target feature vector and the second target feature vector; Among them, the first feature vector is a vector representation of the original image, the second feature vector is a vector representation of the enhanced image, and the fusion sub-network is used to perform a matrix transformation operation on both the first feature vector and the second feature vector to obtain the first target feature vector and the second target feature vector.
5. The method according to claim 3, characterized in that: Determining the difference vector between the original image and the enhanced image based on the first target feature vector and the second target feature vector includes: The first target feature vector and the second target feature vector are both input into the fusion sub-network to obtain the difference vector, wherein the fusion sub-network is used to calculate the difference between the first target feature vector and the second target feature vector to obtain the difference vector.
6. The method according to claim 3, characterized in that: Constructing the feature description matrix using the difference vector, the first target feature vector, and the second target feature vector includes: Inputting the first image description of the original image and the second image description of the enhanced image into the fusion sub-network to obtain a third feature vector and a fourth feature vector, wherein the fusion sub-network is used to convert the first image description and the second image description into vector representations, the third feature vector is the vector representation of the second image description, and the fourth feature vector is the vector representation of the second image description; The difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector are concatenated to obtain the feature description matrix.
7. The method according to claim 6, characterized in that The difference vector, the first target feature vector, the second target feature vector, the third feature vector, and the fourth feature vector are concatenated to obtain the feature description matrix, including at least one of the following: Arrange the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector in the order in which the fusion sub-network generates the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector to obtain the feature description matrix; According to the set weight coefficient of the difference vector, the weight coefficient of the first target feature vector, the weight coefficient of the second target feature vector, the weight coefficient of the third feature vector and the weight coefficient of the fourth feature vector, the difference vector, the first target feature vector, the second target feature vector, the third feature vector and the fourth feature vector are arranged to obtain the feature description matrix.
8. A classification network, characterized in that include: Fusion sub-network and classification sub-network, where The fusion subnetwork is used to generate a feature description matrix based on a difference vector between an original image and an enhanced image, wherein the enhanced image is an image obtained after the original image is enhanced, and the difference vector is a vector representation of the difference in image features between the original image and the enhanced image; The classification subnetwork is used to perform image classification and recognition on the original image based on the feature description matrix.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. 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 computer program, the steps of the method described in any one of claims 1 to 7 are implemented.