Image recognition method and device, computer equipment, readable storage medium and program product
Through the image soft segmentation and feature extraction of image recognition methods, combined with supervision training, the problem of low feature extraction accuracy caused by hard segmentation of pedestrian images in the prior art is solved, and the accuracy of pedestrian recognition is improved.
Patent Information
- Application Number
- CN202411786780.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, hard segmentation of pedestrian images based on the Transformer model leads to poor image feature extraction accuracy, which in turn affects the accuracy of pedestrian recognition results.
An image recognition method is provided, by acquiring the sample data set, performing initial feature extraction, using the attribute information of the image recognition model and sample object for image soft segmentation and feature extraction, and combining preset triple losses and classification losses for supervision and training until the loss of the image feature extraction result output by the model meets the preset conditions.
The accuracy of sample object segmentation and feature extraction accuracy of image recognition model are improved, thereby improving the accuracy of target object recognition.
Smart Images

Figure CN119649409A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision technology, and in particular to an image recognition method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] With the development of computer vision technology, pedestrian re-identification technology has emerged in fields such as intelligent person search and intelligent security. However, in real-world application scenarios, there are many occlusion problems among pedestrians, resulting in the loss of pedestrian information and noise interference, which leads to a significant decrease in the accuracy of pedestrian re-identification.
[0003] In traditional techniques, to address the problem of pedestrian occlusion, pedestrian images are rigidly segmented based on the Transformer model. This involves uniformly segmenting the pedestrian image according to a preset segmentation ratio, analyzing and processing the segmented image blocks to obtain the image feature extraction results of the segmented pedestrian image, and then calculating the similarity between the image feature extraction results and the pedestrian features of the pedestrian to be identified to obtain the pedestrian recognition result.
[0004] However, in current traditional technologies, the hard segmentation of pedestrian images based on the transformer model results in poor accuracy of image feature extraction, which in turn leads to poor accuracy of pedestrian recognition. Therefore, a new image recognition method is urgently needed. Summary of the Invention
[0005] Therefore, it is necessary to provide an image recognition method, apparatus, computer device, computer-readable storage medium, and computer program product to address the aforementioned technical problems.
[0006] In a first aspect, this application provides an image recognition method, comprising:
[0007] Obtain a sample dataset; the sample dataset contains sample images and reference images of the sample objects;
[0008] Initial feature extraction is performed on the sample image and the reference image to obtain sample image features and reference image features;
[0009] Using the image recognition model and the attribute information of the sample object, soft image segmentation and feature extraction are performed on the features of the sample image and the features of the reference image to obtain the image feature extraction result;
[0010] The image recognition model is trained under supervision based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining a trained image recognition model; the trained image recognition model is used to extract image feature extraction results from the image data of the target object, and the image feature extraction results are used to identify the target object.
[0011] In one embodiment, obtaining the sample dataset includes:
[0012] Obtain sample images of the sample object, wherein the sample images are occluded image data, and the sample images include positive sample images and negative sample images;
[0013] Obtain a reference image of the sample object, wherein the reference image is unobstructed image data;
[0014] Based on the sample images of the sample objects and the reference images corresponding to the sample images, the positive sample dataset and the negative sample dataset are divided to obtain the sample dataset.
[0015] In one embodiment, the initial feature extraction of the sample image and the reference image to obtain sample image features and reference image features includes:
[0016] For each sample image and the reference image in the sample dataset, initial feature extraction is performed on the sample image and the reference image based on a preset convolution model to obtain sample image features and reference image features.
[0017] In one embodiment, the step of performing soft image segmentation and feature extraction on the sample image features and the reference image features using an image recognition model and attribute information of the sample object to obtain image feature extraction results includes:
[0018] Based on the attribute information of the sample object, the image segmentation region is determined;
[0019] Based on the image segmentation region, soft image segmentation is performed on the sample image features and the reference image features to obtain a first segmentation result corresponding to the sample image features and a second segmentation result corresponding to the reference image features;
[0020] The first segmentation result and the second segmentation result are used to extract features by an image recognition model to obtain the image feature extraction result.
[0021] In one embodiment, the step of performing soft image segmentation on the sample image features and the reference image features according to the image segmentation region to obtain a first segmentation result corresponding to the sample image features and a second segmentation result corresponding to the reference image features includes:
[0022] Based on the image segmentation region, soft image segmentation is performed on the sample image features and the reference image features respectively to obtain a first segmentation feature after segmentation of the sample image features and a second segmentation feature after segmentation of the reference image features;
[0023] The distance between the first segmentation feature and the second segmentation feature of the same image segmentation region is calculated to determine the weight coefficient corresponding to each image segmentation region.
[0024] If the weight coefficient corresponding to a target image segmentation region is greater than a preset weight threshold, the first segmentation feature and the second segmentation feature of the target image segmentation region are subjected to pixel-level image segmentation to obtain the first segmentation result corresponding to the sample image feature and the second segmentation result corresponding to the reference image feature.
[0025] In one embodiment, the image recognition model is supervisedly trained based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model satisfies a preset model training stopping condition, thereby obtaining a trained image recognition model, including:
[0026] Based on the preset triplet loss algorithm and classification loss algorithm, the first loss and the second loss between the image feature extraction results corresponding to the sample image features and the image feature extraction results corresponding to the reference image features are calculated;
[0027] If the first loss and the second loss do not meet the preset model training stopping condition, the step of performing soft image segmentation and feature extraction on the sample image features and the reference image features using the attribute information of the image recognition model and the sample object to obtain the image feature extraction result is repeated until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, and the trained image recognition model is obtained.
[0028] In one embodiment, the method further includes:
[0029] Obtain the image dataset and standard pedestrian features of the target object to be identified;
[0030] Based on the trained image recognition model, feature extraction is performed on the image dataset to obtain the target image feature extraction result;
[0031] The target image features are obtained by concatenating the extracted features.
[0032] Similarity calculation is performed between the standard pedestrian features and the target image features to obtain a similarity ranking sequence corresponding to the image dataset, and the target object is identified and located based on the similarity ranking sequence.
[0033] Secondly, this application also provides an image recognition device, the device comprising:
[0034] The first acquisition module is used to acquire a sample dataset; the sample dataset contains sample images and reference images of sample objects;
[0035] The first feature extraction module is used to perform initial feature extraction on the sample image and the reference image to obtain sample image features and reference image features;
[0036] The second feature extraction module is used to perform soft image segmentation and feature extraction on the features of the sample image and the features of the reference image using the image recognition model and the attribute information of the sample object, so as to obtain the image feature extraction result;
[0037] The model training module is used to supervise the training of the image recognition model based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining the trained image recognition model; the trained image recognition model is used to extract image feature extraction results of image data of target objects, and the image feature extraction results are used to identify the target objects.
[0038] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0039] Obtain a sample dataset; the sample dataset contains sample images and reference images of the sample objects;
[0040] Initial feature extraction is performed on the sample image and the reference image to obtain sample image features and reference image features;
[0041] Using the image recognition model and the attribute information of the sample object, soft image segmentation and feature extraction are performed on the features of the sample image and the features of the reference image to obtain the image feature extraction result;
[0042] The image recognition model is trained under supervision based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining a trained image recognition model; the trained image recognition model is used to extract image feature extraction results from the image data of the target object, and the image feature extraction results are used to identify the target object.
[0043] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0044] Obtain a sample dataset; the sample dataset contains sample images and reference images of the sample objects;
[0045] Initial feature extraction is performed on the sample image and the reference image to obtain sample image features and reference image features;
[0046] Using the image recognition model and the attribute information of the sample object, soft image segmentation and feature extraction are performed on the features of the sample image and the features of the reference image to obtain the image feature extraction result;
[0047] The image recognition model is trained under supervision based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining a trained image recognition model; the trained image recognition model is used to extract image feature extraction results from the image data of the target object, and the image feature extraction results are used to identify the target object.
[0048] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0049] Obtain a sample dataset; the sample dataset contains sample images and reference images of the sample objects;
[0050] Initial feature extraction is performed on the sample image and the reference image to obtain sample image features and reference image features;
[0051] Using the image recognition model and the attribute information of the sample object, soft image segmentation and feature extraction are performed on the features of the sample image and the features of the reference image to obtain the image feature extraction result;
[0052] The image recognition model is trained under supervision based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining a trained image recognition model; the trained image recognition model is used to extract image feature extraction results from the image data of the target object, and the image feature extraction results are used to identify the target object.
[0053] The aforementioned image recognition method, apparatus, computer equipment, computer-readable storage medium, and computer program product acquire a sample dataset; the sample dataset includes sample images and reference images of sample objects; initial feature extraction is performed on the sample images and the reference images to obtain sample image features and reference image features; image soft segmentation and feature extraction are performed on the sample image features and the reference image features using an image recognition model and attribute information of the sample objects to obtain image feature extraction results;
[0054] The image recognition model is trained under supervised supervision using preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining a trained image recognition model. The trained image recognition model is used to extract image feature extraction results from the image data of the target object, and the image feature extraction results are used to identify the target object. Using this method, by pre-extracting features from sample images and reference images in the sample dataset, sample image features and reference image features are obtained. Based on the attribute information of the sample object and the image recognition model, soft image segmentation and feature extraction can be performed on the sample image features and reference image features, improving the accuracy of sample object segmentation. Furthermore, the image recognition model is trained under supervised supervision using preset triplet loss and classification loss, resulting in a trained image recognition model that improves the accuracy of image feature extraction, thereby improving the accuracy of target object recognition. Attached Figure Description
[0055] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 This is a flowchart illustrating an image recognition method in one embodiment;
[0057] Figure 2 This is a flowchart illustrating the steps for obtaining a sample dataset in one embodiment;
[0058] Figure 3 This is a flowchart illustrating the initial feature extraction step in one embodiment;
[0059] Figure 4 This is a flowchart illustrating the image soft segmentation processing steps in one embodiment;
[0060] Figure 5 This is a flowchart illustrating the steps for extracting image feature processing results in one embodiment;
[0061] Figure 6 This is a schematic diagram of the weighted soft-segmentation Transformer model structure in one embodiment;
[0062] Figure 7 This is a flowchart illustrating the steps of training an image recognition model based on a preset loss function in one embodiment.
[0063] Figure 8 This is a flowchart illustrating the steps of using an image recognition model to identify and locate a target object in one embodiment.
[0064] Figure 9 This is a schematic diagram illustrating the application process of an image recognition model in one embodiment;
[0065] Figure 10 This is a structural block diagram of an image recognition device in one embodiment;
[0066] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0067] 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.
[0068] In one embodiment, current pedestrian re-identification technologies require feature extraction and similarity matching of the image data of the pedestrian to be identified, thereby achieving pedestrian image recognition. Feature extraction of the pedestrian image data requires an image recognition model. This image recognition model needs to be pre-trained based on a sample dataset before performing image recognition. A well-trained image recognition model can achieve high-precision feature extraction and image recognition. Figure 1As shown, an image recognition method is provided. This embodiment illustrates the method applied to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0069] Step 102: Obtain the sample dataset.
[0070] The sample dataset contains sample images and reference images of the sample objects.
[0071] In implementation, the terminal pre-integrates an initial, untrained image recognition model. This model can be a Transformer model, a deep learning model used for Natural Language Processing (NLP) and other sequence data processing tasks. Before application, this image recognition model needs to be pre-trained. However, in real-world scenarios of person re-identification, pedestrian images often suffer from significant occlusion, resulting in missing pedestrian information and noise interference, which greatly degrades the performance of the image recognition model. Therefore, to improve the accuracy of person re-identification, images with occluded parts are considered as sample images during the training process. Simultaneously, to achieve supervised training of the image recognition model, the sample dataset should also include reference images containing full-body information of the sample object—i.e., unoccluded images. Thus, when training the image recognition model is needed, the terminal obtains a sample dataset containing both sample and reference images.
[0072] Optionally, the sample images included in the sample dataset also carry sample labels, which are used to identify the sample images so that they can be classified and judged when the image recognition model performs recognition processing on the sample images.
[0073] Step 104: Perform initial feature extraction on the sample image and the reference image to obtain the sample image features and the reference image features.
[0074] In implementation, after acquiring the sample dataset, the terminal performs initial feature extraction on the sample images and reference images to obtain sample image features and reference image features. Specifically, the terminal can call a preset convolutional model to perform initial feature extraction on the sample images and reference images respectively, obtaining sample image features corresponding to the sample images and reference image features corresponding to the reference images. These sample image features and reference image features facilitate image recognition.
[0075] Step 106: Using the image recognition model and the attribute information of the sample object, perform soft image segmentation and feature extraction on the features of the sample image and the reference image to obtain the image feature extraction results.
[0076] In implementation, an image recognition model is pre-integrated into the terminal. Using this Transformer model and the attribute information of the sample objects, the terminal performs soft image segmentation and feature extraction on the features of the sample image and the reference image. Specifically, the key to soft image segmentation is its ability to capture blurred boundaries and overlapping areas between different objects in the image. Thus, the terminal uses the model layers of the image recognition model and the attribute information of the sample objects to segment the initially extracted features of the sample image and the reference image. During this soft segmentation process, segmentation is performed entirely according to pedestrian attribute information, rather than performing indiscriminate segmentation based on a fixed segmentation ratio. This results in a first segmentation result corresponding to the sample image features and a second segmentation result corresponding to the reference image features. Then, the terminal further extracts features from the first and second segmentation results based on the image recognition model, thereby obtaining the image feature extraction results corresponding to the sample image and the reference image.
[0077] Optionally, the pedestrian can be segmented according to their inherent attribute information, including the head, upper body, and lower body. Alternatively, for different application scenarios, pedestrian attribute information can be customized, which may include: head, chest, hands, lower body, and feet. Therefore, this embodiment does not limit the pedestrian attribute information used for image soft segmentation.
[0078] Step 108: Supervised training of the image recognition model is performed based on the preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, and the trained image recognition model is obtained.
[0079] The trained image recognition model is used to extract image features from the image data of the target object, and the extracted image features are used to identify the target object.
[0080] In implementation, during the training of the image recognition model, the terminal continuously supervises the training of the model based on a preset triplet loss function and a classification loss function. During training, the image recognition model calculates loss based on the extracted image features from the sample image and the reference image, and determines whether to continue iteratively updating the model parameters based on the magnitude of this loss. The training continues until the loss between the extracted image features from the model and the reference image meets the preset training termination condition, at which point the terminal determines that the image recognition model training has ended, and the trained image recognition model is obtained.
[0081] Optionally, the preset model training stopping conditions include, but are not limited to: the loss between the image feature extraction results of the sample image and the image feature extraction results of the reference image is less than a preset loss threshold. Alternatively, the model training iterations reach a preset model iteration threshold, and the variation in loss between the image feature extraction results of the sample image and the image feature extraction results of the reference image is within a preset fluctuation range. Therefore, the specific content of the preset model training stopping conditions is not limited in this embodiment.
[0082] In this way, after the terminal obtains the trained image recognition model, it can apply the model by acquiring image data of the target object to be recognized, performing image recognition on the target object in a massive image dataset, and obtaining the image recognition result of the target object. This image recognition result can then be used for target object localization and / or trajectory tracking.
[0083] The above image recognition method involves: acquiring a sample dataset; the sample dataset containing sample images and reference images of the sample object; performing initial feature extraction on the sample and reference images to obtain sample image features and reference image features; using the image recognition model and the attribute information of the sample object, performing soft image segmentation and feature extraction on the sample and reference image features to obtain image feature extraction results; supervising the image recognition model based on preset triplet loss and classification loss until the loss of the image feature extraction results output by the image recognition model meets the preset model training stopping condition, thus obtaining a trained image recognition model; the trained image recognition model is used to extract image feature extraction results from the image data of the target object, and the image feature extraction results are used to identify the target object. This method pre-extracts features from sample and reference images in the sample dataset to obtain sample image features and reference image features. Based on the attribute information of the sample object and the image recognition model, soft image segmentation and feature extraction can be performed on the sample image features and reference image features to improve the accuracy of sample object segmentation. Furthermore, the image recognition model is supervised and trained using preset triplet loss and classification loss to obtain a trained image recognition model, which improves the accuracy of image feature extraction and thus improves the accuracy of target object recognition.
[0084] In one embodiment, such as Figure 2 As shown, the specific processing steps for obtaining the sample dataset in step 102 include:
[0085] Step 201: Obtain the sample image of the sample object.
[0086] The sample images are occluded image data, including positive and negative sample images.
[0087] In implementation, the terminal acquires sample images. These sample images may contain sample objects, which can be arbitrarily selected pedestrians. The sample images can be pedestrian images acquired by road traffic image acquisition devices, etc. When the terminal needs to train the image recognition model, it acquires the corresponding sample images from the image acquisition device. Multiple sample images containing the same sample object can be temporally continuous or discontinuous; this embodiment does not limit the temporal continuity of the acquired sample images. Furthermore, based on the sample objects contained in the sample images, a positive sample dataset and a negative sample dataset can be divided. The positive sample dataset includes sample images of selected sample objects, and the negative sample dataset includes sample images of non-sample objects. Based on the division results of the positive and negative sample data, the sample images are labeled to distinguish whether the image contains a sample object.
[0088] Optionally, in order to enhance the generalization ability of the model, when constructing the sample dataset, the terminal can select multiple sample images for the same sample object, or select multiple sample images corresponding to multiple sample objects. This embodiment of the disclosure does not limit the selection of sample images.
[0089] Step 202: Obtain a reference image of the sample object.
[0090] The reference image is the unobstructed image data.
[0091] In practice, in order to achieve supervised training of the image recognition model, after obtaining the sample image, the terminal can also obtain the reference image of the sample object. The reference image can be the image data of the selected sample object in a standard shooting scene and under normal lighting conditions without being occluded. Each angle of the sample image can correspond to a reference image.
[0092] Step 203: Based on the sample images of the sample objects and the reference images corresponding to the sample images, divide the positive sample dataset and the negative sample dataset to obtain the sample dataset.
[0093] In implementation, since the sample images are divided into positive and negative sample images, based on the positive and negative sample classification of the sample images and combined with the reference image corresponding to each sample image, a positive sample dataset and a negative sample dataset are obtained. These two datasets together constitute the sample dataset. This sample dataset is used to train the image recognition model.
[0094] In this embodiment, sample images and reference images are acquired to construct a sample dataset. The sample images in this dataset not only take into account the problem that pedestrian objects in pedestrian images may be occluded, but also divide the images into positive and negative samples. By training the image recognition model using this sample dataset, the model processing performance and model accuracy of the image recognition model can be improved.
[0095] In one embodiment, such as Figure 3 As shown, the specific processing steps of step 104 include:
[0096] Step 301: For each sample image and reference image in the sample dataset, perform initial feature extraction on the sample image and reference image respectively based on the preset convolution model to obtain sample image features and reference image features.
[0097] In implementation, for each sample image and its corresponding reference image in the sample dataset, the terminal can perform initial feature extraction on the sample and reference images based on a preset convolutional model, such as a CNN (Convolutional Neural Network). This initial feature extraction yields the basic features corresponding to each sample image (sample image features) and the basic features of the reference image (reference image features). The purpose of using a preset CNN model to extract features from the sample and reference images is to perform soft image segmentation on the sample objects based on the initially extracted feature results. This ensures the rationality of the segmentation method, and the soft image segmentation method can capture blurred boundaries and overlapping areas between different objects in the image, considering the distinction between occluded and unoccluded areas of the sample objects, thus avoiding the impact of occlusion on model performance.
[0098] In a specific example, the CNN network can choose ResNet-50 as the baseline network.
[0099] In this embodiment, a preset convolutional model is used to extract initial features from the sample image and the reference image to obtain sample image features and reference image features. This enables soft image segmentation based on the sample image features and reference image features. It takes into account the different blurred boundaries and overlapping areas of the unoccluded area and the occluded part of the sample object, thereby improving the processing performance and accuracy of the image recognition model.
[0100] In one exemplary embodiment, such as Figure 4 As shown, the specific processing procedure of step 106 includes steps 402 to 406. Wherein:
[0101] Step 402: Determine the image segmentation region based on the attribute information of the sample object.
[0102] In implementation, the terminal determines the image segmentation region based on the attribute information of the sample object. For example, if the attribute information of the sample object (i.e., the attribute information of the pedestrian) is that the pedestrian is divided into three parts: head, upper body, and lower body, then the image segmentation region determined based on the attribute information of the sample object includes the three image segmentation regions corresponding to the head, upper body, and lower body. Alternatively, if the attribute information of the sample object is that the pedestrian is divided into the head, chest, hands, lower body, and feet, then the image segmentation region determined based on the attribute information of the sample object includes the five image segmentation regions of the head, chest, hands, lower body, and feet.
[0103] Step 404: Based on the image segmentation region, perform soft image segmentation on the sample image features and the reference image features to obtain the first segmentation result corresponding to the sample image features and the second segmentation result corresponding to the reference image features.
[0104] In implementation, the terminal performs soft image segmentation on the sample image features and reference image features according to the image segmentation regions determined by the sample object attribute information, obtaining a first segmentation result corresponding to the sample image features and a second segmentation result corresponding to the reference image features. Specifically, assuming that soft image segmentation is performed on the sample image features and reference image features according to three image segmentation regions: head, upper body, and lower body, then three first segmentation results corresponding to the three image segmentation regions of head, upper body, and lower body corresponding to the sample image features are obtained, as well as three second segmentation results corresponding to the three image segmentation regions of head, upper body, and lower body corresponding to the reference image features are obtained.
[0105] Step 406: Extract features from the first segmentation result and the second segmentation result using an image recognition model to obtain the image feature extraction result.
[0106] In implementation, the terminal extracts features from the first segmentation result corresponding to the features of the sample image and the second segmentation result corresponding to the features of the reference image using an image recognition model. This yields the image feature extraction results for the sample image and the reference image. These results can be used for supervised training of the image recognition model. Specifically, the model uses the image feature extraction results of the reference image as a reference to analyze and judge the image feature extraction results of the sample image. Simultaneously, it verifies the judgment results based on the labels carried by the sample image, thus achieving model training for the image recognition model.
[0107] In this embodiment, image soft segmentation technology can more accurately divide different regions of the image, thereby focusing more on relevant parts during feature extraction, reducing interference from irrelevant information, and improving the accuracy of feature extraction.
[0108] In an exemplary embodiment, the process of obtaining the first segmentation result and the second segmentation result described in step 404 above includes feature enhancement of the sample image features and the reference image features, and pixel-level image segmentation of the sample image features and the reference image features in special cases, such as... Figure 5 As shown, the specific processing procedure of step 404 includes steps 502 to 506. Wherein:
[0109] Step 502: Based on the image segmentation region, perform soft image segmentation on the sample image features and the reference image features respectively to obtain the first segmentation feature after segmentation of the sample image features and the second segmentation feature after segmentation of the reference image features.
[0110] In implementation, the terminal performs soft image segmentation on the sample image features and reference image features based on the image segmentation regions, obtaining the first segmentation feature after segmentation of the sample image features and the second segmentation feature after segmentation of the reference image features. Assuming that three image segmentation regions are determined based on the attribute information of the sample object, the corresponding first segmentation features of the sample image features include: first segmentation feature A, first segmentation feature B, and first segmentation feature C; the corresponding second segmentation features of the reference image features include: second segmentation feature A, second segmentation feature B, and third segmentation feature C.
[0111] Step 504: Calculate the distance between the first segmentation feature and the second segmentation feature of the same image segmentation region to determine the weight coefficient corresponding to each image segmentation region.
[0112] In implementation, the terminal calculates the distance between the first and second segmentation features of the same image segmentation region. The distance calculation result is used to reflect the similarity between the first and second segmentation features within the image segmentation region. The smaller the distance calculation result, the more similar the first and second segmentation features are; the larger the distance calculation result, the less similar the first and second segmentation features are. In this case, if the distance calculation result is large, it can be suspected that the image segmentation region corresponding to the first segmentation feature is an occluded area of the sample object. Specifically, the Euclidean distance between the first and second segmentation features is calculated. Furthermore, based on the Euclidean distance calculation result, the weight coefficients corresponding to each image segmentation region are determined, i.e., the weight coefficients are 1- The formula for calculating the Euclidean distance between the first and second segmentation features is as follows:
[0113]
[0114] in, This represents the number of image segmentation regions corresponding to the features of the sample image and the features of the reference image (it can also be considered as the number of the first segmentation features or the number of the second segmentation features), for example, =3, then the features of the sample image and the features of the reference image correspond to 3 image segmentation regions. This represents the i-th second segmentation feature after feature segmentation of the reference image. This represents the i-th first segmentation feature after feature segmentation of the sample image. This represents the square root function.
[0115] Based on the Euclidean distance formula, the weight coefficients between the first and second segmentation features corresponding to each image segmentation region are calculated.
[0116] In a specific example, the reference image and the sample image containing the occluded portion of the sample object are fed into a baseline network to extract features. The extracted features are then subjected to soft image segmentation to obtain the second segmentation features corresponding to the features of the reference image. The first segmentation feature corresponding to the sample image features Assuming the image has four segmented regions: head, upper body, lower body, and feet, the terminal uses a matching weighted algorithm to calculate the Euclidean distance between the four regions. ,in And assign a weight to each region. In this example, the weights for each image segmentation region are [0.89, 0.92, 0.41, 0.20].
[0117] Step 506: If there exists a target image segmentation region with a weight coefficient greater than a preset weight threshold, perform pixel-level image segmentation on the first segmentation feature and the second segmentation feature of the target image segmentation region to obtain the first segmentation result corresponding to the sample image feature and the second segmentation result corresponding to the reference image feature.
[0118] In implementation, a weight threshold is pre-set in the terminal. After determining the weight coefficients corresponding to each segmentation feature, the terminal processes the first and second segmentation features with different weight coefficients according to the weight threshold:
[0119] Scenario 1: If the weight coefficients of the first and second segmentation features within a certain target image segmentation region are greater than a preset weight threshold, the terminal performs pixel-level segmentation on the first and second segmentation features contained in that target image segmentation region. Based on the segmented weight coefficients and the pixel-level segmented features, a weighted calculation is performed to obtain the first segmentation result corresponding to the sample image features within the target image segmentation region after feature enhancement, and the second segmentation result corresponding to the reference image features. For example, in the example given in step 504, the weights of each image segmentation region are [0.89, 0.92, 0.41, 0.20]. In this example, the preset weight threshold is 0.68. Therefore, in each image segmentation region, the head region (corresponding to a weight coefficient of 0.89) and the upper body region (corresponding to a weight coefficient of 0.92) both require pixel-level segmentation.
[0120] Optionally, in case two, if the weight coefficient between the first segmentation feature and the second segmentation feature within a certain target image segmentation region is less than or equal to a preset weight threshold, the terminal directly weights the first segmentation feature and the second segmentation feature based on the weight coefficient to obtain the enhanced feature, which is the first segmentation result and the second segmentation result corresponding to the target image segmentation region.
[0121] Step 508: Extract features from the first segmentation result and the second segmentation result using an image recognition model to obtain the image feature extraction result.
[0122] In implementation, the terminal inputs the first and second segmentation results of each image segmentation region corresponding to the sample image and the reference image into the image recognition model, such as... Figure 6 As shown, feature extraction is performed on the first and second segmentation results using an image recognition model to obtain the discriminative features of each segmented region corresponding to the sample image and the reference image. The discriminative features of each segmented region corresponding to the sample image are then stitched together to obtain the image feature extraction result of the sample image. Similarly, the discriminative features of each segmented region corresponding to the reference image are then stitched together to obtain the image feature extraction result of the reference image.
[0123] In this embodiment, by weighting the features of the sample image and the reference image after soft segmentation, and further segmenting the image segmentation region with a weight coefficient greater than the weight threshold, finer-grained pedestrian features are obtained, thereby improving the retrieval accuracy of the image recognition model for occluded pedestrians.
[0124] In one embodiment, such as Figure 7 As shown, the specific processing steps of step 108 include:
[0125] Step 702: Based on the preset triplet loss algorithm and classification loss algorithm, calculate the first loss and the second loss between the image feature extraction results corresponding to the sample image features and the image feature extraction results corresponding to the reference image features.
[0126] In implementation, the terminal calculates the first loss between the image feature extraction results corresponding to the sample image features and the image feature extraction results corresponding to the reference image features, based on the preset triplet loss algorithm and classification loss algorithm. Second loss Specifically, the formula for calculating triplet loss is as follows:
[0127]
[0128] in, The image feature extraction results represent the reference image. The image feature extraction results characterize the positive sample images in the sample images. The image feature extraction results characterize the negative sample images in the sample images. Characterizes the outer margin of an image edge. It is a constant value.
[0129] Classification loss calculation formula:
[0130]
[0131] in, This represents the probability of identifying a sample object given by the image recognition model. This indicates the classification label carried by the sample image. The probability distribution function representing the discrimination probability given by the image recognition model relative to the classification label. This represents the number of sample images, or the number of samples.
[0132] Step 704: If the first loss and the second loss do not meet the preset model training stopping condition, repeat the steps of performing soft image segmentation and feature extraction on the sample image features and reference image features using the attribute information of the image recognition model and the sample object to obtain the image feature extraction result, until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, and the trained image recognition model is obtained.
[0133] In implementation, the first and second losses between the image recognition models of the sample image and the reference image are calculated based on the triplet loss function and the classification loss function. It is then used to determine whether the current image recognition model has been trained. If the current first and second losses do not meet the preset model training stop condition, the model parameters of the image recognition model are updated, and steps 104 to 106 in the above embodiment are re-executed until the loss of the image feature extraction result output by the image recognition model meets the preset model training stop condition, and the image recognition model training is completed.
[0134] In this embodiment, triplet loss and classification loss are used to comprehensively improve the model's feature representation ability and classification accuracy. By continuously adjusting the model parameters and minimizing the loss function, the model performance gradually improves, ultimately achieving the optimal accuracy of the image recognition model.
[0135] In one embodiment, such as Figure 8 As shown, the method also includes:
[0136] Step 801: Obtain the image dataset and the standard pedestrian features of the target object to be identified.
[0137] In practice, when it is necessary to identify and locate a pedestrian, the pedestrian is used as the target object. A standard pedestrian image of the target object (from which standard pedestrian features can be extracted) is acquired, or the standard pedestrian features of the target object are acquired for identification and location. The terminal acquires the image dataset collected by the image acquisition device within a certain time period, and inputs the standard pedestrian features and the image dataset into the trained image recognition model.
[0138] Step 802: Based on the trained image recognition model, perform feature extraction on the image dataset to obtain the target image feature extraction result.
[0139] In implementation, the terminal extracts features from the image dataset based on the trained image recognition model to obtain the target image feature extraction result. The feature extraction process of this image recognition model is similar to steps 104 to 106 and steps 402 to 406 described in the above embodiments. Specifically, during inference, the image recognition model removes the matching weighting algorithm used in the training phase and only utilizes the most basic CNN and Transformer networks, extracting features for the pedestrian to be retrieved by loading the trained model parameters. For example... Figure 9 As shown, the standard pedestrian features and image dataset of the target object to be detected are first fed into the pre-trained image recognition model. The pedestrian features extracted by CNN are subjected to soft segmentation, that is, the image features are softly segmented according to the image segmentation region to obtain the segmentation result corresponding to the image features. Then, the segmentation result is weighted and enhanced and fed into the Transformer model. The Transformer model is used to further extract features from the image segmentation result to obtain the target image feature extraction result.
[0140] Step 803: Perform feature stitching on the target image feature extraction results to obtain the target image features.
[0141] In practice, the terminal performs feature stitching on the target image feature extraction results to obtain the target image features. These target image features represent the full-body features of the object to be identified.
[0142] Step 804: Calculate the similarity between standard pedestrian features and target image features to obtain the similarity ranking sequence corresponding to the image dataset, and identify and locate the target object based on the similarity ranking sequence.
[0143] In practice, the terminal measures the similarity between standard pedestrian features and pedestrian features in the image dataset to obtain the similarity result for each image in the image dataset. Based on the similarity results of each image, the terminal sorts them (for example, sorting them in descending order of similarity) to obtain the similarity sorting sequence for the image dataset. Thus, the terminal accurately locates the target object to be detected based on the similarity sorting sequence.
[0144] In this embodiment, the target object is identified and detected by the trained image recognition model, thereby achieving accurate positioning of the target object.
[0145] It should be understood that although the steps in the flowcharts of the above embodiments 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 on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments 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 some of the steps or stages of other steps.
[0146] Based on the same inventive concept, this application also provides an image recognition device for implementing the image recognition method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more image recognition device embodiments provided below can be found in the limitations of the image recognition method described above, and will not be repeated here.
[0147] In one exemplary embodiment, such as Figure 10 As shown, an image recognition device 1000 is provided, including: an acquisition module 1001, a first feature extraction module 1002, a second feature extraction module 1003, and a model training module 1004, wherein:
[0148] The acquisition module 1001 is used to acquire the sample dataset; the sample dataset contains sample images and reference images of the sample objects.
[0149] The first feature extraction module 1002 is used to perform initial feature extraction on the sample image and the reference image to obtain sample image features and reference image features.
[0150] The second feature extraction module 1003 is used to perform soft image segmentation and feature extraction on the features of the sample image and the reference image through the image recognition model and the attribute information of the sample object, so as to obtain the image feature extraction result.
[0151] The model training module 1004 is used to supervise the training of the image recognition model based on the preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thus obtaining the trained image recognition model; the trained image recognition model is used to extract the image feature extraction result of the image data of the target object, and the image feature extraction result is used to identify the target object.
[0152] In one embodiment, the acquisition module 1001 is specifically used to acquire a sample image of a sample object. The sample image is occluded image data and includes a positive sample image and a negative sample image.
[0153] Obtain a reference image of the sample object; the reference image is unobstructed image data.
[0154] Based on the sample images of the sample objects and the corresponding reference images, the positive sample dataset and the negative sample dataset are divided to obtain the sample dataset.
[0155] In one embodiment, the first feature extraction module 1002 is specifically used to perform initial feature extraction on each sample image and reference image in the sample dataset based on a preset convolution model, so as to obtain sample image features and reference image features.
[0156] In one embodiment, the second feature extraction module 1003 is specifically used to determine the image segmentation region based on the attribute information of the sample object;
[0157] Based on the image segmentation region, soft image segmentation is performed on the sample image features and the reference image features to obtain the first segmentation result corresponding to the sample image features and the second segmentation result corresponding to the reference image features.
[0158] The first and second segmentation results are used to extract features using an image recognition model to obtain the image feature extraction results.
[0159] In one embodiment, the second feature extraction module 1003 is specifically used to perform soft image segmentation on the sample image features and the reference image features based on the image segmentation region, to obtain the first segmentation feature after segmentation of the sample image features and the second segmentation feature after segmentation of the reference image features.
[0160] The distance between the first and second segmentation features of the same image segmentation region is calculated to determine the weight coefficients corresponding to each image segmentation region.
[0161] If the weight coefficient corresponding to the target image segmentation region is greater than the preset weight threshold, the first segmentation feature and the second segmentation feature of the target image segmentation region are subjected to pixel-level image segmentation to obtain the first segmentation result corresponding to the sample image feature and the second segmentation result corresponding to the reference image feature.
[0162] In one embodiment, the model training module 1004 is used to calculate a first loss and a second loss between the image feature extraction results corresponding to the sample image features and the image feature extraction results corresponding to the reference image features, based on a preset triplet loss algorithm and a classification loss algorithm.
[0163] If the first loss and the second loss do not meet the preset model training stopping condition, the steps of performing soft image segmentation and feature extraction on the sample image features and reference image features using the attribute information of the image recognition model and the sample object are repeated until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, and the trained image recognition model is obtained.
[0164] In one embodiment, the device further includes:
[0165] The second acquisition module is used to acquire the image dataset and the standard pedestrian features of the target object to be identified;
[0166] The third feature extraction module is used to extract features from the image dataset based on the trained image recognition model to obtain the feature extraction results of the target image.
[0167] The feature stitching module is used to stitch together the feature extraction results of the target image to obtain the target image features;
[0168] The identification and localization module is used to calculate the similarity between standard pedestrian features and target image features, obtain the similarity ranking sequence corresponding to the image dataset, and identify and locate the target object based on the similarity ranking sequence.
[0169] Each module in the aforementioned image recognition 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.
[0170] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface 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 interface. The processor provides computing 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 interface is 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, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements an image recognition method. The display unit is used to form a visually visible image and can be a display screen, projection device, or 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.
[0171] Those skilled in the art will understand that Figure 11 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.
[0172] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0173] Obtain the sample dataset; the sample dataset contains sample images and reference images of the sample objects;
[0174] Initial feature extraction is performed on the sample image and the reference image to obtain the sample image features and the reference image features;
[0175] By using the image recognition model and the attribute information of the sample object, soft image segmentation and feature extraction are performed on the features of the sample image and the reference image to obtain the image feature extraction results.
[0176] The image recognition model is trained under supervision based on the preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, and the trained image recognition model is obtained. The trained image recognition model is used to extract the image feature extraction result of the image data of the target object, and the image feature extraction result is used to identify the target object.
[0177] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0178] Obtain sample images of the sample objects. The sample images are occluded image data and include positive and negative sample images.
[0179] Obtain a reference image of the sample object; the reference image is unobstructed image data.
[0180] Based on the sample images of the sample objects and the corresponding reference images, the positive sample dataset and the negative sample dataset are divided to obtain the sample dataset.
[0181] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0182] For each sample image and reference image in the sample dataset, initial feature extraction is performed on the sample image and reference image respectively based on a preset convolution model to obtain sample image features and reference image features.
[0183] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0184] Based on the attribute information of the sample objects, determine the image segmentation region;
[0185] Based on the image segmentation region, soft image segmentation is performed on the sample image features and the reference image features to obtain the first segmentation result corresponding to the sample image features and the second segmentation result corresponding to the reference image features.
[0186] The first and second segmentation results are used to extract features using an image recognition model to obtain the image feature extraction results.
[0187] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0188] Based on the image segmentation region, soft image segmentation is performed on the sample image features and the reference image features respectively to obtain the first segmentation feature after segmentation of the sample image features and the second segmentation feature after segmentation of the reference image features.
[0189] The distance between the first and second segmentation features of the same image segmentation region is calculated to determine the weight coefficients corresponding to each image segmentation region.
[0190] If the weight coefficient corresponding to the target image segmentation region is greater than the preset weight threshold, the first segmentation feature and the second segmentation feature of the target image segmentation region are subjected to pixel-level image segmentation to obtain the first segmentation result corresponding to the sample image feature and the second segmentation result corresponding to the reference image feature.
[0191] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0192] Based on the preset triplet loss algorithm and classification loss algorithm, the first loss and the second loss between the image feature extraction results corresponding to the sample image features and the image feature extraction results corresponding to the reference image features are calculated.
[0193] If the first loss and the second loss do not meet the preset model training stopping condition, the steps of performing soft image segmentation and feature extraction on the sample image features and reference image features using the attribute information of the image recognition model and the sample object are repeated until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, and the trained image recognition model is obtained.
[0194] 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.
[0195] 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.
[0196] 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. When executed, the computer program 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 memory 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, artificial intelligence (AI) processors, etc., and are not limited to these.
[0197] 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 application.
[0198] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this 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. An image recognition method, characterized in that: The method comprises: Acquire a sample data set; the sample data set includes a sample image and a reference image of a sample object; Performing initial feature extraction on the sample image and the reference image to obtain sample image features and reference image features; Performing image soft segmentation and feature extraction on the sample image features and the reference image features through the image recognition model and the attribute information of the sample object to obtain an image feature extraction result; The image recognition model is supervisedly trained based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stop condition, thereby obtaining a trained image recognition model; the trained image recognition model is used to extract the image feature extraction result of the image data of the target object, and the image feature extraction result is used to identify the target object.
2. The method according to claim 1, characterized in that The obtaining of the sample data set comprises: Acquire a sample image of a sample object, wherein the sample image is occluded image data, and the sample image includes a positive sample image and a negative sample image; Acquire a reference image of the sample object, where the reference image is unobstructed image data; Based on the sample image of the sample object and a reference image corresponding to the sample image, a positive sample data set and a negative sample data set are divided to obtain a sample data set.
3. The method according to claim 1, characterized in that The initial feature extraction of the sample image and the reference image to obtain sample image features and reference image features includes: For each sample image and the reference image in the sample data set, initial feature extraction is performed on the sample image and the reference image respectively based on a preset convolution model to obtain sample image features and reference image features.
4. The method according to claim 1, characterized in that: The method of performing image soft segmentation and feature extraction on the sample image features and the reference image features through the image recognition model and the attribute information of the sample object to obtain the image feature extraction result includes: Determining an image segmentation region based on the attribute information of the sample object; According to the image segmentation area, performing image soft segmentation on the sample image feature and the reference image feature to obtain a first segmentation result corresponding to the sample image feature and a second segmentation result corresponding to the reference image feature; Perform feature extraction on the first segmentation result and the second segmentation result through an image recognition model to obtain an image feature extraction result.
5. The method according to claim 4, characterized in that The performing soft image segmentation on the sample image features and the reference image features according to the image segmentation area to obtain a first segmentation result corresponding to the sample image features and a second segmentation result corresponding to the reference image features includes: Based on the image segmentation area, performing image soft segmentation on the sample image feature and the reference image feature respectively to obtain a first segmentation feature after the sample image feature is segmented, and a second segmentation feature after the reference image feature is segmented; Performing distance calculation on the first segmentation feature and the second segmentation feature of the same image segmentation region to determine a weight coefficient corresponding to each of the image segmentation regions; If there is a target image segmentation area corresponding to a weight coefficient greater than a preset weight threshold, the first segmentation feature and the second segmentation feature of the target image segmentation area are subjected to pixel-level image segmentation to obtain a first segmentation result corresponding to the sample image feature and a second segmentation result corresponding to the reference image feature.
6. The method according to claim 1, characterized in that The supervised training of the image recognition model based on the preset triplet loss and classification loss is performed until the loss of the image feature extraction result output by the image recognition model meets the preset model training stop condition, thereby obtaining a trained image recognition model, including: Based on a preset triplet loss algorithm and a classification loss algorithm, calculating a first loss and a second loss between an image feature extraction result corresponding to the sample image feature and an image feature extraction result corresponding to the reference image feature; If the first loss and the second loss do not meet the preset model training stopping condition, the steps of performing soft image segmentation and feature extraction on the sample image features and the reference image features through the image recognition model and the attribute information of the sample object to obtain the image feature extraction result are repeated until the loss of the image feature extraction result output by the image recognition model meets the preset model training stopping condition, thereby obtaining a trained image recognition model.
7. The method according to claim 1, characterized in that The method further comprises: Obtain an image dataset and standard pedestrian features of the target object to be identified; Performing feature extraction on the image data set based on the trained image recognition model to obtain a target image feature extraction result; Performing feature splicing on the target image feature extraction result to obtain the target image feature; A similarity calculation is performed based on the standard pedestrian features and the target image features to obtain a similarity sorting sequence corresponding to the image data set, and the target object is identified and located based on the similarity sorting sequence.
8. An image recognition device, characterized in that: The device comprises: A first acquisition module is used to acquire a sample data set; the sample data set includes a sample image and a reference image of a sample object; A first feature extraction module, used to perform initial feature extraction on the sample image and the reference image to obtain sample image features and reference image features; A second feature extraction module is used to perform image soft segmentation and feature extraction on the sample image features and the reference image features through the image recognition model and the attribute information of the sample object to obtain an image feature extraction result; A model training module is used to perform supervised training on the image recognition model based on preset triplet loss and classification loss until the loss of the image feature extraction result output by the image recognition model meets the preset model training stop condition, thereby obtaining a trained image recognition model; the trained image recognition model is used to extract the image feature extraction result of the image data of the target object, and the image feature extraction result is used to identify the target object.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Model training method and device for identifying seal characters, equipment and medium
CN121170810A