Image recognition model training method and device, computer device, and storage medium

CN115797687BActive Publication Date: 2026-08-21SHENZHEN POWER SUPPLY BUREAU
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211487311.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2026-08-21
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

[0003]传统技术中,使用少量的已标注图像对图像识别模型进行训练,由于用于训练的已标注图像的数量较少,导致图像识别模型不准确

Benefits of technology

[0055]上述图像识别模型训练方法、装置、计算机设备、存储介质和计算机程序产品,获取包括多张未标注图像的第一训练集,以及包括多张标注图像的第二训练集,首先基于第一训练集中的未标注图像,对初始编码器和第一解码器进行训练,得到初始编码器对应的中间编码器,其次基于第二训练集中的标注图像,对中间编码器和第二解码器进行训练,得到中间编码器对应的目标编码器和第二解码器对应的目标解码器,最后基于目标编码器和目标解码器,得到目标图像识别模型。通过使用大量的未标注图像对初始编码器和第一解码器进行训练,提高了中间编码器的准确性,然后通过已标注图像对中间编码器和第二解码器进行训练,对中间编码器再次进行训练,进一步提高了目标编码器的准确性,使用准确性较高的中间编码器进行编码,提升了第二解码器的训练效果,提高了目标解码器的准确性,由目标编码器和目标解码器构成目标图像识别模型,提高了目标图像识别模型的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115797687B_ABST
    Figure CN115797687B_ABST
Patent Text Reader

Abstract

The application relates to an image recognition model training method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring a first training set and a second training set; the first training set comprises a plurality of unlabeled images, and the second training set comprises a plurality of labeled images; based on the unlabeled images in the first training set, an initial encoder and a first decoder are trained to obtain an intermediate encoder corresponding to the initial encoder; based on the labeled images in the second training set, the intermediate encoder and a second decoder are trained to obtain a target encoder corresponding to the intermediate encoder and a target decoder corresponding to the second decoder; and based on the target encoder and the target decoder, a target image recognition model is obtained. The method can improve the accuracy of the image recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an image recognition model training method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the development of computer technology, image recognition technology has emerged. Image recognition technology refers to the technology of using computers to process, analyze and understand images in order to identify targets and objects of various patterns.

[0003] In traditional techniques, a small number of labeled images are used to train an image recognition model. Because the number of labeled images used for training is small, the image recognition model is inaccurate. Summary of the Invention

[0004] Therefore, it is necessary to provide an image recognition model training method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the accuracy of image recognition models in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a method for training an image recognition model. The method includes:

[0006] Obtain a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images;

[0007] Based on the unlabeled images in the first training set, the initial encoder and the first decoder are trained to obtain the intermediate encoder corresponding to the initial encoder;

[0008] Based on the labeled images in the second training set, the intermediate encoder and the second decoder are trained to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder;

[0009] Based on the target encoder and the target decoder, a target image recognition model is obtained.

[0010] In one embodiment, training the intermediate encoder and the second decoder based on the labeled images in the second training set includes:

[0011] Obtain the target labeled image in the second training set, and the label vector corresponding to the labeled block in the target labeled image;

[0012] Obtain multiple image patches from the target labeled image;

[0013] Based on the intermediate encoder and the second decoder, each image block is encoded and decoded to obtain a prediction vector corresponding to each image block;

[0014] For each image patch, the error between the annotation vector and the prediction vector corresponding to the image patch is calculated to obtain the image loss corresponding to the image patch;

[0015] The minimum image loss is determined from the image losses corresponding to each of the image blocks, and the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder are adjusted based on the minimum image loss.

[0016] In one embodiment, the step of encoding and decoding each image block based on the intermediate encoder and the second decoder to obtain a prediction vector corresponding to each image block includes:

[0017] The intermediate encoder extracts features from each image block to obtain a feature matrix corresponding to each image block.

[0018] The second decoder predicts the feature matrix corresponding to each image block to obtain the prediction vector corresponding to each image block.

[0019] In one embodiment, the annotation vector includes an annotation classification vector and an annotation location vector; the step of calculating the error between the annotation vector and the prediction vector corresponding to the image patch for each image patch, to obtain the image loss corresponding to the image patch, includes:

[0020] For each image patch, based on the prediction vector corresponding to the image patch, the prediction classification vector and prediction location vector corresponding to the image patch are obtained;

[0021] Calculate the cross-entropy loss between the labeled classification vector and the predicted classification vector to obtain the classification error corresponding to the image patch;

[0022] Calculate the regression loss between the labeled location vector and the predicted location vector to obtain the location error corresponding to the image patch;

[0023] Based on the classification error and position error corresponding to the image patch, the image loss corresponding to the image patch is obtained.

[0024] In one embodiment, training the initial encoder and the first decoder based on unlabeled images in the first training set includes:

[0025] Obtain the unlabeled target images from the first training set;

[0026] The unlabeled target image is divided into multiple candidate training image blocks of the same size; these multiple candidate training image blocks of the same size constitute the unlabeled target image.

[0027] The target training image block is determined from the plurality of candidate training image blocks;

[0028] The target training image patch is restored into the predicted image corresponding to the unlabeled target image using the initial encoder and the first decoder.

[0029] Calculate the root mean square error between the unlabeled target image and the corresponding predicted image, and adjust the initial encoding parameters of the initial encoder and the decoding parameters of the first decoder based on the root mean square error.

[0030] In one embodiment, restoring the target training image patch into a predicted image corresponding to the unlabeled target image using the initial encoder and the first decoder includes:

[0031] The initial encoder is used to extract features from the target training image patch to obtain the feature matrix corresponding to the target training image patch;

[0032] The same replacement matrix is ​​used as the feature matrix corresponding to the non-target training image patch; the replacement matrix and the feature matrix corresponding to the target training image patch have the same number of rows and columns, and each data element in the replacement matrix is ​​the same;

[0033] Based on the feature matrix corresponding to the target training image block, the first decoder predicts the replacement matrix corresponding to each non-target training image block to obtain the prediction matrix corresponding to each non-target training image block.

[0034] Based on the feature matrix corresponding to each of the target training image blocks and the prediction matrix corresponding to each of the non-target training image blocks, the predicted image corresponding to the unlabeled target image is recovered by the first decoder.

[0035] In one embodiment, obtaining the first training set and the second training set includes:

[0036] Acquire multiple original images to be used for training;

[0037] The original images to be trained are labeled to obtain the original labeled images and the original unlabeled images;

[0038] The three primary colors in the original labeled image and the original unlabeled image are converted into their corresponding hue, saturation and brightness to obtain the labeled image corresponding to the original labeled image and the unlabeled image corresponding to the original unlabeled image;

[0039] The first training set is obtained based on the unlabeled images, and the second training set is obtained based on the labeled images.

[0040] Secondly, this application also provides an image recognition model training device. The device includes:

[0041] The acquisition module is used to acquire a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images.

[0042] The first training module is used to train the initial encoder and the first decoder based on the unlabeled images in the first training set to obtain the intermediate encoder corresponding to the initial encoder.

[0043] The second training module is used to train the intermediate encoder and the second decoder based on the labeled images in the second training set, so as to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder.

[0044] The combination module is used to obtain a target image recognition model based on the target encoder and the target decoder.

[0045] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0046] Obtain a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images;

[0047] Based on the unlabeled images in the first training set, the initial encoder and the first decoder are trained to obtain the intermediate encoder corresponding to the initial encoder;

[0048] Based on the labeled images in the second training set, the intermediate encoder and the second decoder are trained to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder;

[0049] Based on the target encoder and the target decoder, a target image recognition model is obtained.

[0050] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0051] Obtain a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images;

[0052] Based on the unlabeled images in the first training set, the initial encoder and the first decoder are trained to obtain the intermediate encoder corresponding to the initial encoder;

[0053] Based on the labeled images in the second training set, the intermediate encoder and the second decoder are trained to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder;

[0054] Based on the target encoder and the target decoder, a target image recognition model is obtained.

[0055] The aforementioned image recognition model training method, apparatus, computer equipment, storage medium, and computer program product acquire a first training set including multiple unlabeled images and a second training set including multiple labeled images. First, based on the unlabeled images in the first training set, an initial encoder and a first decoder are trained to obtain an intermediate encoder corresponding to the initial encoder. Next, based on the labeled images in the second training set, the intermediate encoder and the second decoder are trained to obtain a target encoder corresponding to the intermediate encoder and a target decoder corresponding to the second decoder. Finally, based on the target encoder and the target decoder, a target image recognition model is obtained. By using a large number of unlabeled images to train the initial encoder and the first decoder, the accuracy of the intermediate encoder is improved. Then, by training the intermediate encoder and the second decoder using labeled images, and then training the intermediate encoder again, the accuracy of the target encoder is further improved. Using the more accurate intermediate encoder for encoding improves the training effect of the second decoder and improves the accuracy of the target decoder. The target encoder and the target decoder constitute the target image recognition model, thus improving the accuracy of the target image recognition model. Attached Figure Description

[0056] Figure 1 This is an application environment diagram of an image recognition model training method in one embodiment;

[0057] Figure 2 This is a flowchart illustrating an image recognition model training method in one embodiment;

[0058] Figure 3 This is a flowchart illustrating the training steps of the intermediate encoder and the second decoder in one embodiment.

[0059] Figure 4 This is a flowchart illustrating the initial encoder and first decoder training steps in one embodiment;

[0060] Figure 5 This is a flowchart illustrating the image prediction generation steps in one embodiment;

[0061] Figure 6 This is a flowchart illustrating the image recognition model training process in one embodiment;

[0062] Figure 7 This is a structural block diagram of an image recognition model training device in one embodiment;

[0063] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0065] The image recognition model training method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated on server 104 or placed on a cloud or other network server. Both the terminal and the server can be used independently to execute the image recognition model training method provided in this embodiment. The terminal and server can also be used collaboratively to execute the image recognition model training method provided in this embodiment. For example, a computer device acquires a first training set including multiple unlabeled images and a second training set including multiple labeled images. First, based on the unlabeled images in the first training set, an initial encoder and a first decoder are trained to obtain an intermediate encoder corresponding to the initial encoder. Second, based on the labeled images in the second training set, the intermediate encoder and the second decoder are trained to obtain a target encoder corresponding to the intermediate encoder and a target decoder corresponding to the second decoder. Finally, based on the target encoder and the target decoder, a target image recognition model is obtained. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0066] In one embodiment, such as Figure 2As shown, an image recognition model training method is provided. This method can be applied to computer devices, which can be terminals or servers. The method can be executed independently by the terminal or server, or it can be implemented through interaction between the terminal and the server. This embodiment uses the application of this method to a computer device as an example for illustration, including steps 202 to 208.

[0067] Step 202: Obtain the first training set and the second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images.

[0068] The first training set consists of a collection of unlabeled images. This set contains a large number of unlabeled images, which can be original captured images or raw image frames extracted from video, or processed images obtained after preprocessing original images or frames. The second training set consists of a collection of labeled images. The total number of labeled images in the second training set can be less than the total number of unlabeled images in the first training set. A labeled image is an image obtained by labeling the target object within the image. A labeled image must contain at least one bounding box. The target object can be labeled using a rectangle, circle, or other bounding box. The target object can be defined as needed. For example, the target object could be the rusted portion of a utility pole.

[0069] For example, a computer device acquires a first training set comprising multiple unlabeled images and a second training set comprising multiple labeled images.

[0070] In one embodiment, a computer device acquires a target video corresponding to a target time period, extracts multiple image frames containing the target subject from the target video, and combines these multiple image frames into a first training set; it then acquires multiple image frames to be labeled from the first training set, labels the objects in each image frame to be labeled, resulting in multiple labeled image frames, which are then combined into a second training set. Here, the target subject refers to a type of equipment, such as a power transmission line pole. The labeled object refers to a specific part of the target subject, such as a rust block.

[0071] Step 204: Based on the unlabeled images in the first training set, train the initial encoder and the first decoder to obtain the intermediate encoder corresponding to the initial encoder.

[0072] Training refers to the process of adjusting the parameters involved in the initial encoder and the first decoder using unlabeled images. The initial encoder is an encoder that extracts features from the image but has not been trained. It can be understood as an encoder with randomized parameters. The first decoder is a decoder that reconstructs the image from the data. The intermediate encoder is an encoder trained on unlabeled images from the first training set. It can be understood as an encoder obtained by repeatedly adjusting the initial encoder; the intermediate encoder can extract features from the image more accurately than the initial encoder.

[0073] For example, the computer device trains an initial encoder and a first decoder using unlabeled images from a first training set, and obtains an intermediate encoder corresponding to the initial encoder after training.

[0074] In one embodiment, the computer device trains an initial encoder and a first decoder using unlabeled images from a first training set to obtain intermediate encoding parameters for an intermediate encoder. The intermediate encoding parameters are then used to update the initial encoding parameters corresponding to the initial encoder to obtain an intermediate encoder corresponding to the initial encoder.

[0075] Step 206: Based on the labeled images in the second training set, train the intermediate encoder and the second decoder to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder.

[0076] In this context, the second decoder refers to a decoder that predicts the category and location of an image patch based on the prediction data corresponding to that patch. The prediction data is the data obtained by the intermediate encoder through feature extraction of the image patch. The prediction data can be a feature matrix. An image patch is a portion of the labeled image. The target encoder is the encoder obtained after training. It can be understood as an encoder obtained by adjusting the intermediate encoding parameters of the intermediate encoder. The target decoder is the decoder obtained after training. It can be understood as a second decoder obtained by adjusting the second decoding parameters of the second decoder.

[0077] For example, the computer device trains the intermediate encoder and the second decoder using labeled images in the second training set, and after training, obtains the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder.

[0078] In one embodiment, the computer device uses each labeled image in the second training set to train the intermediate encoder and the second decoder respectively, to obtain the error loss corresponding to each labeled image, and adjusts the parameters to be adjusted of the intermediate encoder and the second decoder based on the error loss corresponding to each labeled image, to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder.

[0079] Step 208: Based on the target encoder and target decoder, a target image recognition model is obtained.

[0080] In this context, a target image recognition model refers to a model capable of identifying target objects in an image to be recognized. The target object belongs to the same category as the labeled object in the labeled image. For example, if the labeled object in the labeled image of the second training set is a rust block, the target image recognition model would identify the rust block in the image to be recognized.

[0081] For example, a computer device combines a target encoder and a target decoder to obtain a target image recognition model.

[0082] In one embodiment, the computer device combines an image patch acquisition model, a target encoder, and a target decoder into a target image recognition model. The image patch acquisition module can acquire a preset number of image patches from an image to be recognized.

[0083] In the above image recognition model training method, the accuracy of the intermediate encoder is improved by training the initial encoder and the first decoder with a large number of unlabeled images. Then, the intermediate encoder and the second decoder are trained with labeled images. The intermediate encoder is trained again to further improve the accuracy of the target encoder. The use of the intermediate encoder with higher accuracy improves the training effect of the second decoder and improves the accuracy of the target decoder. The target image recognition model is composed of the target encoder and the target decoder, thus improving the accuracy of the target image recognition model.

[0084] In one embodiment, such as Figure 3 As shown, training the intermediate encoder and the second decoder based on the labeled images in the second training set includes:

[0085] Step 302: Obtain the target labeled image in the second training set, and the label vector corresponding to the labeled block in the target labeled image.

[0086] In this context, a labeled block refers to an image patch within the target labeled image. It can be understood as an image within the target labeled image that is enclosed by a bounding box. A label vector is a vector used to represent the category and location of a labeled block. It can be understood as a vector containing data representing the category and location of the labeled block. For example, a label vector might have seven dimensions: the first three dimensions represent the category of the labeled block, and the last four dimensions represent its location.

[0087] For example, the computer device obtains a target labeled image from the second training set, and then obtains the label vectors corresponding to the labeled blocks in the target labeled image.

[0088] In one embodiment, the computer device acquires a target labeled image from the second training set, then acquires a labeled block from the target labeled image, obtains a classification vector of the labeled block based on the image features in the labeled block, obtains a position vector of the labeled block based on the position of the labeled block in the target labeled image, and obtains a label vector corresponding to the labeled block in the target labeled image based on the classification vector and position vector corresponding to the labeled block.

[0089] In one embodiment, the computer device obtains a target labeled image from the second training set, then obtains the label block identifier corresponding to the labeled block in the target labeled image, and obtains the label vector corresponding to the labeled block in the target labeled image based on the label block identifier.

[0090] Step 304: Obtain multiple image patches from the target labeled image.

[0091] For example, a computer device acquires multiple image patches from a target labeled image.

[0092] In one embodiment, a computer device randomly selects a preset number of image blocks from a target labeled image.

[0093] In one embodiment, a computer device identifies the main subject in a target labeled image and then divides the main subject into multiple image blocks of a preset size.

[0094] Step 306: Based on the intermediate encoder and the second decoder, each image block is encoded and decoded to obtain the prediction vector corresponding to each image block.

[0095] The prediction vector refers to the vector that represents the category and location of an image patch after encoding and decoding. The image patch category refers to the class corresponding to the image patch. Image patch categories can be divided according to specific circumstances. For example, image patches can be divided into normal metal image patches, rusted metal image patches, and background image patches.

[0096] For example, the computer device uses an intermediate encoder and a second decoder to encode and decode each image block respectively, to obtain a prediction vector corresponding to each image block.

[0097] Step 308: For each image patch, calculate the error between the labeled vector and the prediction vector corresponding to the image patch to obtain the image loss corresponding to the image patch.

[0098] Here, error refers to the difference between the predicted vector and the labeled vector.

[0099] For example, the computer device calculates the error between the prediction vector corresponding to each image patch and the annotation vector corresponding to the annotation patch, and uses the error as the image loss corresponding to the image patch.

[0100] In one embodiment, the computer device calculates the straight-line distance between the predicted vector and the labeled vector for each image patch, and uses the straight-line distance as the image loss for the image patch.

[0101] Step 310: Determine the minimum image loss from the image losses corresponding to each image block, and adjust the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder based on the minimum image loss.

[0102] Intermediate encoding parameters refer to the encoding parameters of the intermediate encoder.

[0103] For example, a computer device compares the image losses corresponding to multiple image patches in a target labeled image, determines the minimum image loss, and then uses the minimum image loss to adjust the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder to obtain the adjusted intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder.

[0104] In this embodiment, the accuracy of the intermediate encoder is improved by training the initial encoder and the first decoder with a large number of unlabeled images.

[0105] In one embodiment, each image block is encoded and decoded based on an intermediate encoder and a second decoder to obtain a prediction vector corresponding to each image block, including:

[0106] The intermediate encoder extracts features from each image patch to obtain a feature matrix for each image patch; the second decoder then predicts the feature matrix for each image patch to obtain a prediction vector for each image patch.

[0107] Feature extraction refers to extracting image features from image patches. Prediction refers to inferring the category and location of image patches based on the feature matrix corresponding to the image patches.

[0108] For example, the computer device uses an intermediate encoder to extract features from each image block to obtain a feature matrix corresponding to each image block, and then uses a second decoder to predict the feature matrix corresponding to each image block to obtain a prediction vector corresponding to each image block.

[0109] In one embodiment, the computer device uses an intermediate encoder to count the pixel values ​​of each pixel in each image block to obtain the statistical results corresponding to each image block. Based on the statistical results corresponding to each image block, features are extracted from each image block to obtain the feature matrix corresponding to each image block. Then, a second decoder is used to predict the feature matrix corresponding to each image block to obtain the prediction vector corresponding to each image block.

[0110] In this embodiment, an intermediate encoder is used to extract features from the image patch. The intermediate encoder is a trained encoder, and the resulting feature matrix can accurately reflect the features of the image patch. Then, a second decoder is used to predict the feature matrix. The predicted object is an accurate feature matrix, which improves the accuracy of the predicted vector.

[0111] In one embodiment, the annotation vector includes a annotation classification vector and an annotation location vector; for each image patch, the error between the annotation vector and the prediction vector corresponding to the image patch is calculated to obtain the image loss corresponding to the image patch, including:

[0112] For each image patch, based on the prediction vector corresponding to the image patch, the predicted classification vector and predicted location vector corresponding to the image patch are obtained; the cross-entropy loss between the labeled classification vector and the predicted classification vector is calculated to obtain the classification error corresponding to the image patch; the regression loss between the labeled location vector and the predicted location vector is calculated to obtain the location error corresponding to the image patch; based on the classification error and location error corresponding to the image patch, the image loss corresponding to the image patch is obtained.

[0113] In this context, the classification vector represents the category of an image patch, while the location vector represents its position. For example, if the label vector is (1, 0, 0, 8.2, 4.6, 4, 2), the first dimension represents whether the labeled patch is a normal metal image patch, the second dimension represents whether it is a rusted metal image patch, the third dimension represents whether it is a background image patch, the fourth dimension represents the horizontal coordinate of the center point of the labeled patch, the fifth dimension represents the vertical coordinate of the center point of the labeled patch, the sixth dimension represents the length of the labeled patch, and the seventh dimension represents the height of the labeled patch. Then, vector (1, 0, 0) is the label classification vector, and vector (8.2, 4.6, 4, 2) is the label location vector. Cross-entropy loss is the value obtained by substituting the labeled classification vector and the predicted classification vector into the cross-entropy formula. Regression loss is the value obtained by substituting the labeled location vector and the predicted location vector into the regression loss function.

[0114] For example, the computer device obtains the predicted classification vector and predicted position vector of the image patch from the predicted vector of the image patch, and then obtains the labeled classification vector and labeled position vector of the labeled patch from the labeled vector of the labeled patch of the target labeled image. The labeled classification vector and the predicted classification vector are substituted into the cross-entropy function to obtain the cross-entropy loss, and the cross-entropy loss is used as the classification error of the image patch. Then, the labeled position vector and the predicted position vector are substituted into the regression loss function to obtain the regression loss, and the regression error is used as the position error of the image patch. Finally, based on the classification error and position error of the image patch, the image loss of the image patch is obtained.

[0115] In one embodiment, the computer device sums the classification error and the location error corresponding to the image patch to obtain the image loss corresponding to the image patch.

[0116] In one embodiment, the cross-entropy function L1 and the regression loss function L2 are respectively shown below:

[0117] L1 = -q log p Formula (1)

[0118] L2 = smoothL1(b q b p ) Formula (2)

[0119] Where q is the labeled classification vector, p is the predicted classification vector, and b q For the labeled position vector, b p For the predicted location vector, smoothL1 is the regression loss function.

[0120] In this embodiment, the classification error and the position error are calculated separately, and then the image loss corresponding to the image patch is obtained based on the classification error and the position error, which improves the accuracy of the image loss.

[0121] In one embodiment, such as Figure 4 As shown, training the initial encoder and the first decoder based on unlabeled images in the first training set includes:

[0122] Step 402: Obtain the unlabeled target images in the first training set.

[0123] For example, the computer device acquires an unlabeled image of a target from the first training set.

[0124] Step 404: Divide the unlabeled target image into multiple candidate training image blocks of the same size; the multiple candidate training image blocks of the same size constitute the unlabeled target image.

[0125] For example, a computer device divides an unlabeled target image into multiple candidate training image blocks of the same size.

[0126] In one embodiment, the computer device obtains the total size of the target unlabeled image, determines the number of segments of the target unlabeled image based on the total size, and segments the target unlabeled image based on the number of segments to obtain candidate training image blocks of the same size with the same number of segments.

[0127] Step 406: Determine the target training image block from multiple candidate training image blocks.

[0128] For example, a computer device determines a target training image block from a plurality of candidate training image blocks.

[0129] In one embodiment, a computer device randomly selects a preset number of target training image blocks from a plurality of candidate training image blocks.

[0130] In one embodiment, the computer device randomly selects a preset number of image blocks from a plurality of candidate training image blocks for deletion, and uses the remaining candidate training image blocks as target training image blocks.

[0131] Step 408: Using the initial encoder and the first decoder, the target training image patch is restored into the predicted image corresponding to the unlabeled target image.

[0132] For example, the computer device uses an initial encoder and a first decoder to reconstruct the target training image patch to obtain the predicted image corresponding to the unlabeled target image.

[0133] Step 410: Calculate the root mean square error between the unlabeled target image and the corresponding predicted image, and adjust the initial encoding parameters of the initial encoder and the decoding parameters of the first decoder based on the root mean square error.

[0134] The root mean square error (RMSE) is the square root of the ratio of the square of the deviation between the predicted value and the true value to the number of observations.

[0135] For example, the computer device calculates the root mean square error between the unlabeled target image and the corresponding predicted image, then adjusts the initial encoding parameters of the initial encoder based on the root mean square error to obtain the updated initial encoding parameters of the initial encoder, and adjusts the decoding parameters of the first decoder based on the root mean square error to obtain the updated decoding parameters of the first decoder.

[0136] In one embodiment, the computer device obtains the true pixel value of each pixel in the target unlabeled image and the predicted pixel value of each pixel in the predicted image, and calculates the root mean square error between the target unlabeled image and the corresponding predicted image based on the true pixel value and the predicted pixel value.

[0137] In this embodiment, the initial encoder and the first decoder are trained using the unlabeled target image. The initial encoding parameters of the initial encoder and the decoding parameters of the first decoder are adjusted based on the root mean square error between the unlabeled target image and the corresponding predicted image. Each adjustment aims to reduce the root mean square error between the unlabeled target image and the corresponding predicted image, which is equivalent to reducing the difference between the unlabeled target image and the corresponding predicted image. After the initial encoder is trained multiple times, the accuracy of feature extraction becomes higher and higher, thus improving the accuracy of the initial encoder.

[0138] In one embodiment, such as Figure 5 As shown, the process of restoring the target training image patch into the predicted image corresponding to the unlabeled target image through the initial encoder and the first decoder includes:

[0139] Step 502: Extract features from the target training image patch using the initial encoder to obtain the feature matrix corresponding to the target training image patch.

[0140] The feature matrix refers to the matrix used to characterize the features of the target training image patch. The number of rows and columns of the feature matrix can be set according to actual needs. Feature extraction from target training image patches of the same size will result in feature matrices with the same number of rows and columns.

[0141] For example, the computer device uses an initial encoder to extract features from each target training image patch to obtain a feature matrix corresponding to each target training image patch.

[0142] Step 504: Use the same replacement matrix as the feature matrix corresponding to the non-target training image patch; the replacement matrix and the feature matrix corresponding to the target training image patch have the same number of rows and columns, and each data element in the replacement matrix is ​​the same.

[0143] The replacement matrix is ​​the matrix that represents the non-target training image patch. Each non-target training image patch has the same replacement matrix. The number of rows and columns in the replacement matrix are the same as those in the feature matrix, and each element is the same number.

[0144] For example, the computer device uses a replacement matrix to replace a non-target training image patch until every non-target training patch is replaced with the replacement matrix.

[0145] Step 506: Based on the feature matrix corresponding to the target training image block, the first decoder predicts the replacement matrix corresponding to each non-target training image block to obtain the prediction matrix corresponding to each non-target training image block.

[0146] The prediction matrix is ​​the matrix calculated by combining the feature matrix corresponding to the target training image patch with the replacement matrix. It can be understood as a matrix obtained by predicting the features of non-target training image patches using the target training image patch. The number of rows and columns in the prediction matrix is ​​the same as the number of rows and columns in the feature matrix.

[0147] For example, the computer device combines the feature matrix corresponding to the target training image block and uses the first decoder to predict the replacement matrix corresponding to each non-target training image block to obtain the prediction matrix corresponding to each non-target training image block.

[0148] Step 508: Based on the feature matrix corresponding to each target training image block and the prediction matrix corresponding to each non-target training image block, the predicted image corresponding to the unlabeled target image is recovered by the first decoder.

[0149] The predicted image refers to the image obtained by performing operations on the feature matrix and the prediction matrix.

[0150] For example, the computer device uses a first decoder to recover the feature matrix and the prediction matrix to obtain the predicted image corresponding to the unlabeled target image.

[0151] In this embodiment, a decoder is used to predict the replacement matrix to obtain a prediction matrix. Then, the feature matrix and the prediction matrix are recovered to obtain a prediction map. This provides accurate basic data for calculating the root mean square error between the unlabeled target image and the prediction map, thus improving the accuracy of the root mean square error calculation.

[0152] In one embodiment, obtaining the first training set and the second training set includes:

[0153] Acquire multiple original images to be trained; annotate some of the original images to be trained to obtain original annotated images and original unannotated images; convert the three primary colors in the original annotated images and original unannotated images into their corresponding hues, saturations and brightness to obtain an annotated image corresponding to the original annotated image and an unannotated image corresponding to the original unannotated image; obtain the first training set based on the unannotated images and the second training set based on the annotated images.

[0154] In this context, the original image refers to an unprocessed image. The three primary colors are red, green, and blue, which cannot be further decomposed into their constituent colors. Hue refers to the relative brightness or darkness of an image, manifested as color in a color image. Saturation refers to the vividness or intensity of a color. Brightness is the ratio of the luminous intensity of a light source to its area, that is, the luminous intensity per unit projected area.

[0155] For example, a computer device acquires multiple original images to be trained, annotates some of the original images to be trained, and uses the annotated original images as original labeled images and the unannotated original images as original unlabeled images. Then, the three primary colors in the original labeled images and the original unlabeled images are converted into their corresponding hues, saturation and brightness to obtain the labeled images corresponding to the original labeled images and the unlabeled images corresponding to the original unlabeled images. All the unlabeled images are combined into a first training set, and all the labeled images are combined into a second training set.

[0156] In one implementation, the method for converting the three primary colors of an image into their corresponding hue (H), saturation (S), and brightness (I) is as follows:

[0157]

[0158]

[0159]

[0160] I = (R + G + B) / 3 Formula (4)

[0161] Where R is the color value of the red channel, G is the color value of the green channel, and B is the color value of the blue channel.

[0162] In this embodiment, the original labeled and unlabeled images are converted from images of the red-green-blue color model to labeled and unlabeled images of the HIS color model. The brightness and color components of the image are separated. The enhancement operation of the brightness component does not affect the color information, which can effectively avoid image color distortion. Moreover, the image enhancement processing only needs to be performed in one dimension, which improves the image processing speed.

[0163] In one exemplary embodiment, the image recognition model is used to identify rusted areas on power transmission line towers. Creating labeled images requires significant manpower, resulting in a limited number of labeled images. However, a large number of unlabeled images are captured by inspection and monitoring equipment. Given the large number of unlabeled images and the limited number of labeled images, a method such as... Figure 6 The training process shown is used to train the image recognition model and improve its accuracy.

[0164] Obtain the original labeled images and the original unlabeled images. Obtain multiple original images to be trained, and label some of the original images to be trained. The labeled original images are used as the original labeled images, and the unlabeled original images are used as the original unlabeled images.

[0165] Color space conversion is performed on the original labeled image and the original unlabeled image. The three primary colors in the original labeled image and the original unlabeled image are converted into their corresponding hue, saturation and brightness to obtain the labeled image corresponding to the original labeled image and the unlabeled image corresponding to the original unlabeled image. All the unlabeled images are combined into the first training set and all the labeled images are combined into the second training set.

[0166] Based on unlabeled images in the first training set, the initial encoder and the first decoder are trained. A target unlabeled image is obtained from the first training set and divided into multiple candidate training image blocks of the same size. The target training image block is selected from these candidate blocks, and the non-target training image blocks are deleted. The initial encoder extracts features from each target training image block to obtain a feature matrix. The same replacement matrix is ​​used as the feature matrix for each non-target training image block. Combining the feature matrix of the target training image block, the first decoder predicts the replacement matrix for each non-target training image block to obtain a prediction matrix. The first decoder recovers the prediction image corresponding to the target unlabeled image using the feature matrix and the prediction matrix. The root mean square error (RMSE) between the target unlabeled image and the corresponding prediction image is calculated. The initial encoding parameters of the initial encoder are adjusted based on the RMSE to obtain the updated initial encoding parameters. The decoding parameters of the first decoder are also adjusted based on the RMSE to obtain the updated decoding parameters. Obtain the next unlabeled image of the target and repeat the above process until the last unlabeled image of the target in the first training set is obtained, thus obtaining the intermediate encoder.

[0167] Based on the labeled images in the second training set, the intermediate encoder and the second decoder are trained. A target labeled image is obtained from the second training set, and the label vectors corresponding to the labeled blocks in the target labeled image are obtained. Multiple image blocks are obtained from the target labeled image, and the intermediate encoder is used to extract features from each image block to obtain a feature matrix for each image block. Then, the second decoder is used to predict the feature matrix corresponding to each image block to obtain a prediction vector for each image block. The error between the prediction vector corresponding to each image block and the label vector corresponding to the labeled block is calculated, and this error is used as the image loss for each image block. The image losses corresponding to multiple image blocks in a target labeled image are compared, and the minimum image loss is determined. Then, the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder are adjusted using the minimum image loss to obtain the adjusted intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder. The next target labeled image is obtained, and the above process is repeated until the last target labeled image in the second training set, resulting in the target image recognition model.

[0168] In this embodiment, the accuracy of the intermediate encoder is improved by training the initial encoder and the first decoder with a large number of unlabeled images. Then, the intermediate encoder and the second decoder are trained with labeled images. The intermediate encoder is trained again, further improving the accuracy of the target encoder. Using the more accurate intermediate encoder for encoding improves the training effect of the second decoder and enhances the accuracy of the target decoder. The target encoder and the target decoder constitute the target image recognition model, thus improving the accuracy of the target image recognition model. It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction for the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the steps or stages of other steps.

[0169] Based on the same inventive concept, this application also provides an image recognition model training apparatus for implementing the image recognition model training method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more embodiments of the image recognition model training apparatus provided below can be found in the limitations of the image recognition model training method described above, and will not be repeated here.

[0170] In one embodiment, such as Figure 7 As shown, an image recognition model training device is provided, comprising: an acquisition module 702, a first training module 704, a second training module 706, and a combination module 708, wherein:

[0171] The acquisition module 702 is used to acquire a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images.

[0172] The first training module 704 is used to train the initial encoder and the first decoder based on the unlabeled images in the first training set to obtain the intermediate encoder corresponding to the initial encoder.

[0173] The second training module 706 is used to train the intermediate encoder and the second decoder based on the labeled images in the second training set, so as to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder.

[0174] The combination module 708 is used to obtain a target image recognition model based on the target encoder and the target decoder.

[0175] In one embodiment, the second training module 706 is further configured to: acquire target labeled images in the second training set, and label vectors corresponding to labeled blocks in the target labeled images; acquire multiple image blocks from the target labeled images; encode and decode each image block based on the intermediate encoder and the second decoder respectively to obtain a prediction vector corresponding to each image block; calculate the error between the label vector and the prediction vector corresponding to each image block for each image block to obtain the image loss corresponding to the image block; determine the minimum image loss from the image losses corresponding to each image block, and adjust the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder based on the minimum image loss.

[0176] In one embodiment, the second training module 706 is further configured to: extract features from each image block using an intermediate encoder to obtain a feature matrix corresponding to each image block; and predict the feature matrix corresponding to each image block using a second decoder to obtain a prediction vector corresponding to each image block.

[0177] In one embodiment, the second training module 706 is further configured to: for each image patch, obtain the predicted classification vector and the predicted position vector corresponding to the image patch based on the prediction vector corresponding to the image patch; calculate the cross-entropy loss between the labeled classification vector and the predicted classification vector to obtain the classification error corresponding to the image patch; calculate the regression loss between the labeled position vector and the predicted position vector to obtain the position error corresponding to the image patch; and obtain the image loss corresponding to the image patch based on the classification error and the position error corresponding to the image patch.

[0178] In one embodiment, the first training module 704 is further configured to: acquire unlabeled target images in a first training set; divide the unlabeled target images to obtain multiple candidate training image blocks of the same size; form the unlabeled target image from the multiple candidate training image blocks of the same size; determine the target training image block from the multiple candidate training image blocks; restore the target training image block to the predicted image corresponding to the unlabeled target image through an initial encoder and a first decoder; calculate the root mean square error between the unlabeled target image and the corresponding predicted image; and adjust the initial encoding parameters of the initial encoder and the decoding parameters of the first decoder based on the root mean square error.

[0179] In one embodiment, the first training module 704 is further configured to: extract features from the target training image patch using an initial encoder to obtain a feature matrix corresponding to the target training image patch; use the same replacement matrix as the feature matrix corresponding to the non-target training image patch; the replacement matrix has the same number of rows and columns as the feature matrix corresponding to the target training image patch, and each data element in the replacement matrix is ​​the same; based on the feature matrix corresponding to the target training image patch, predict the replacement matrix corresponding to each non-target training image patch using a first decoder to obtain a prediction matrix corresponding to each non-target training image patch; and based on the feature matrix corresponding to each target training image patch and the prediction matrix corresponding to each non-target training image patch, recover the prediction map corresponding to the unlabeled target image using a first decoder.

[0180] In one embodiment, the acquisition module 702 is further configured to: acquire multiple original images to be trained; label some of the original images to be trained to obtain original labeled images and original unlabeled images; convert the three primary colors in the original labeled images and original unlabeled images into their corresponding hues, saturation and brightness to obtain labeled images corresponding to the original labeled images and unlabeled images corresponding to the original unlabeled images; obtain a first training set based on the unlabeled images and a second training set based on the labeled images.

[0181] Each module in the aforementioned image recognition model training device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0182] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an image recognition model training method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0183] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0184] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0185] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0186] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0187] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0188] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0189] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0190] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for training an image recognition model, characterized in that, The method includes: Obtain a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images; Obtain unlabeled target images from the first training set; divide the unlabeled target images into multiple candidate training image blocks of the same size; the multiple candidate training image blocks of the same size constitute the unlabeled target image; determine the target training image block from the multiple candidate training image blocks; restore the target training image block to the predicted image corresponding to the unlabeled target image using an initial encoder and a first decoder; calculate the root mean square error between the unlabeled target image and the corresponding predicted image; adjust the initial encoding parameters of the initial encoder and the decoding parameters of the first decoder based on the root mean square error to obtain the intermediate encoder corresponding to the initial encoder; Obtain the target labeled image in the second training set, and the label vector corresponding to the labeled block in the target labeled image; obtain multiple image blocks from the target labeled image; based on the intermediate encoder and the second decoder, encode and decode each image block respectively to obtain the prediction vector corresponding to each image block; for each image block, calculate the error between the label vector and the prediction vector corresponding to the image block to obtain the image loss corresponding to the image block; determine the minimum image loss from the image losses corresponding to each image block, and based on the minimum image loss, adjust the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder; Based on the target encoder and the target decoder, a target image recognition model is obtained.

2. The method according to claim 1, characterized in that, The step of obtaining the target labeled image in the second training set and the label vector corresponding to the labeled block in the target labeled image includes: Obtain a target-labeled image from the second training set; Obtain labeled blocks from the target labeled image, and obtain the classification vector of the labeled blocks based on the image features in the labeled blocks; Based on the position of the labeled block in the target labeled image, the position vector of the labeled block is obtained; Based on the classification vector and position vector corresponding to the labeled block, the label vector corresponding to the labeled block in the target labeled image is obtained.

3. The method according to claim 1, characterized in that, The step of encoding and decoding each image block based on the intermediate encoder and the second decoder to obtain a prediction vector corresponding to each image block includes: The intermediate encoder extracts features from each image block to obtain a feature matrix corresponding to each image block. The second decoder predicts the feature matrix corresponding to each image block to obtain the prediction vector corresponding to each image block.

4. The method according to claim 1, characterized in that, The annotation vector includes a classification vector and a location vector; for each image patch, calculating the error between the annotation vector and the prediction vector corresponding to the image patch to obtain the image loss corresponding to the image patch includes: For each image patch, based on the prediction vector corresponding to the image patch, the prediction classification vector and prediction location vector corresponding to the image patch are obtained; Calculate the cross-entropy loss between the labeled classification vector and the predicted classification vector to obtain the classification error corresponding to the image patch; Calculate the regression loss between the labeled location vector and the predicted location vector to obtain the location error corresponding to the image patch; Based on the classification error and position error corresponding to the image patch, the image loss corresponding to the image patch is obtained.

5. The method according to claim 1, characterized in that, The step of obtaining multiple image patches from the target labeled image includes: The main image subject in the target labeled image is identified, and the main image subject is divided into multiple image blocks of a preset size.

6. The method according to claim 1, characterized in that, The step of restoring the target training image patch into the predicted image corresponding to the unlabeled target image through the initial encoder and the first decoder includes: The initial encoder is used to extract features from the target training image patch to obtain the feature matrix corresponding to the target training image patch; The same replacement matrix is ​​used as the feature matrix corresponding to the non-target training image patch; the replacement matrix and the feature matrix corresponding to the target training image patch have the same number of rows and columns, and each data element in the replacement matrix is ​​the same; Based on the feature matrix corresponding to the target training image block, the first decoder predicts the replacement matrix corresponding to each non-target training image block to obtain the prediction matrix corresponding to each non-target training image block. Based on the feature matrix corresponding to each of the target training image blocks and the prediction matrix corresponding to each of the non-target training image blocks, the predicted image corresponding to the unlabeled target image is recovered by the first decoder.

7. The method according to claim 1, characterized in that, The acquisition of the first training set and the second training set includes: Acquire multiple original images to be used for training; The original images to be trained are labeled to obtain the original labeled images and the original unlabeled images; The three primary colors in the original labeled image and the original unlabeled image are converted into their corresponding hue, saturation and brightness to obtain the labeled image corresponding to the original labeled image and the unlabeled image corresponding to the original unlabeled image; The first training set is obtained based on the unlabeled images, and the second training set is obtained based on the labeled images.

8. An image recognition model training device, characterized in that, The device includes: The acquisition module is used to acquire a first training set and a second training set; the first training set includes multiple unlabeled images, and the second training set includes multiple labeled images. A first training module is configured to: acquire unlabeled target images in the first training set; divide the unlabeled target images into multiple candidate training image blocks of the same size; the multiple candidate training image blocks of the same size constitute the unlabeled target image; determine a target training image block from the multiple candidate training image blocks; restore the target training image block to the predicted image corresponding to the unlabeled target image using an initial encoder and a first decoder; calculate the root mean square error between the unlabeled target image and the corresponding predicted image; and adjust the initial encoding parameters of the initial encoder and the decoding parameters of the first decoder based on the root mean square error to obtain an intermediate encoder corresponding to the initial encoder. The second training module is used to acquire target labeled images in the second training set, and label vectors corresponding to labeled blocks in the target labeled images; acquire multiple image blocks from the target labeled images; encode and decode each image block based on the intermediate encoder and the second decoder to obtain a prediction vector corresponding to each image block; calculate the error between the label vector and the prediction vector corresponding to each image block for each image block to obtain the image loss corresponding to the image block; determine the minimum image loss from the image losses corresponding to each image block, and adjust the intermediate encoding parameters of the intermediate encoder and the decoding parameters of the second decoder based on the minimum image loss to obtain the target encoder corresponding to the intermediate encoder and the target decoder corresponding to the second decoder. The combination module is used to obtain a target image recognition model based on the target encoder and the target decoder.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Picture recognition model training method and device, picture recognition method and device and storage medium

    CN113569887A

  • Target object detection method and apparatus, and computer device and storage medium

    WO2022213879A1