Object recognition method, device and storage medium

By calculating the similarity between the image to be identified and the image of the candidate object, and training the second object recognition model, the problem of low object recognition accuracy when the appearance similarity is high is solved, and the recognition accuracy and the robustness of the model are improved.

CN118762253BActive Publication Date: 2024-12-06HANGZHOU HUACHENG SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411249628.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-06
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

The existing object recognition methods have low accuracy in object recognition with high appearance similarity, and are prone to misidentification.

Method used

By obtaining the similarity of the image to be identified, selecting the candidate object image within the preset threshold interval as the similar image, and using it with the image to be identified as the input sample to generate sample tags, training the second object recognition model, and improving the recognition accuracy Spend.

Benefits of technology

It improves the accuracy of object recognition, enhances the ability to distinguish similar objects, reduces the negative impact of noise samples on model training, and improves the robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762253B_ABST
    Figure CN118762253B_ABST
Patent Text Reader

Abstract

The present application discloses an object recognition method, device and storage medium. The object recognition method calculates the first similarity between the image of the object to be recognized and the image of the candidate object by using a first object recognition model, selects the candidate object image whose first similarity is within a preset threshold interval as a similar image; uses the image of the object to be recognized and the similar image as input samples, generates sample labels corresponding to the input samples based on the first similarity, and trains the second object recognition model, so that the trained second object recognition model is more in line with the object recognition scene. In addition, the sample labels are directly generated using the first similarity to improve the robustness of the second object recognition model. Then, the second object recognition model is used to calculate the similarity between the image of the object to be recognized and the image of the candidate object to obtain the second similarity; determines the object recognition result corresponding to the object to be recognized according to the first similarity and / or the second similarity, and improves the accuracy of object recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an object recognition method, device and storage medium. Background Art

[0002] At present, with the continuous development of artificial intelligence technology, artificial intelligence is widely used in various fields. For example, in the field of object recognition technology, the commonly used object recognition method is generally to directly compare the object features corresponding to the target object image with the pre-stored candidate object features, and then determine whether they are the same object based on the comparison results.

[0003] However, if the appearance of two different objects is very similar, the accuracy of object recognition using the above method is low and misidentification is likely to occur. Summary of the invention

[0004] In order to solve the above technical problems, the present application at least provides an object recognition method, device and storage medium.

[0005] In a first aspect, the present application provides an object recognition method, which includes: obtaining an image of an object to be recognized containing an object to be recognized, inputting the image of the object to be recognized into a pre-trained first object recognition model, and using the first object recognition model to calculate the similarity between the image of the object to be recognized and a candidate object image to obtain a first similarity; selecting a candidate object image whose first similarity is within a preset threshold range to obtain a similar image corresponding to the image of the object to be recognized; using the image of the object to be recognized and the similar image as input samples, generating a sample label corresponding to the input sample based on the first similarity, and sending the input sample and the sample label to a model training end so that the model training end trains a second object recognition model to obtain a second object recognition model after training and update; using the second object recognition model after training and update to calculate the similarity between the image of the object to be recognized and the candidate object image to obtain a second similarity; determining a candidate object image whose first similarity and / or second similarity meets a preset condition, and obtaining an object recognition result corresponding to the object to be recognized based on the candidate object image that meets the preset condition.

[0006] In one embodiment, determining a candidate object image whose first similarity and / or second similarity satisfies a preset condition includes: obtaining a first threshold and a second threshold; if there is a candidate object image corresponding to a first similarity greater than the first threshold, then using the candidate object image whose first similarity is greater than the first threshold as the candidate object image that satisfies the preset condition; or, if there is a candidate object image corresponding to a second similarity greater than the second threshold, then using the candidate object image whose second similarity is greater than the second threshold as the candidate object image that satisfies the preset condition.

[0007] In one embodiment, the method further includes: if there is no candidate object image whose corresponding first similarity is greater than a first threshold, then selecting a candidate object image whose first similarity is within a preset threshold interval to obtain a similar image corresponding to the image of the object to be identified; using the trained and updated second object recognition model to calculate the similarity between the image of the object to be identified and the candidate object image to obtain a second similarity, including: inputting the image of the object to be identified and the similar image corresponding to the image of the object to be identified into the trained and updated second object recognition model to obtain the second similarity output by the trained and updated second object recognition model.

[0008] In one embodiment, before inputting the image of the object to be identified and the similar image corresponding to the image of the object to be identified into the second object recognition model after training and updating, and obtaining the second similarity output by the second object recognition model after training and updating, it also includes: obtaining the input sample set used by the second object recognition model in the model training process; if there are similar images in the input sample set, executing the step of inputting the image of the object to be identified and the similar image corresponding to the image of the object to be identified into the second object recognition model after training and updating, and obtaining the second similarity output by the second object recognition model after training and updating; if there are no similar images in the input sample set, executing the step of using the image of the object to be identified and the similar image as input samples, generating sample labels corresponding to the input samples based on the first similarity, and sending the input samples and sample labels to the model training end.

[0009] In one embodiment, the method also includes: if there is no candidate object image corresponding to a first similarity greater than a first threshold, but there is a candidate object image corresponding to a second similarity greater than a second threshold, then the candidate object images are sorted in descending order according to the size of the first similarity, and a preset number of candidate object images before sorting are selected to obtain a baseline candidate image; if there is an image in the baseline candidate image that is identical to the candidate object image with a second similarity greater than a second threshold, then the candidate object image with a second similarity greater than the second threshold is used as a candidate object image that meets the preset conditions.

[0010] In one embodiment, a candidate object image whose first similarity is within a preset threshold range is selected to obtain a similar image corresponding to the object image to be identified, including: obtaining a third threshold, the third threshold is less than the first threshold; selecting a candidate object image whose first similarity is less than the first threshold and greater than the third threshold, to obtain a similar image corresponding to the object image to be identified.

[0011] In one embodiment, a sample label corresponding to an input sample is generated based on the first similarity, including: constructing an initial similarity matrix based on the first similarity between the image of the object to be identified and each candidate object image; resetting the first similarity in the initial similarity matrix that is less than a third threshold value to a preset minimum value to obtain a target similarity matrix after noise reduction; normalizing the target similarity matrix to obtain a normalized matrix, and using the normalized matrix as a sample label.

[0012] In one embodiment, the similarity between the image of the object to be identified and the image of the candidate object is calculated using the second object recognition model after training and update to obtain the second similarity, including: extracting the global image features and local image features of the image of the object to be identified and the image of the candidate object respectively; weightedly fusing the global image features and local image features of the image of the object to be identified to obtain the features of the object to be identified; and weightedly fusing the global image features and local image features of the candidate object image to obtain the features of the candidate object; calculating the similarity between the features of the object to be identified and the features of the candidate object to obtain the second similarity; wherein the local image feature extraction step includes: extracting the mask area of ​​the image of the object to be identified or the candidate object image, and calculating the minimum bounding box corresponding to the mask area to obtain the target area; dividing the target area into multiple image blocks, inputting the image blocks into a pre-trained foreground segmentation model, and obtaining the foreground segmentation results corresponding to the image blocks output by the foreground segmentation model; detecting whether there are adjacent pixels between the foreground segmentation results corresponding to each image block and whether the number of adjacent pixels is greater than a preset number threshold, if so, fusing the foreground segmentation results corresponding to the image blocks to obtain a fused segmentation result; extracting the image features corresponding to the fused segmentation result to obtain the local image features.

[0013] According to a second aspect of the present application, there is provided an object recognition device, which includes: a first recognition module, which is used to obtain an image of an object to be recognized containing an object to be recognized, input the image of the object to be recognized into a pre-trained first object recognition model, and use the first object recognition model to calculate the similarity between the image of the object to be recognized and the candidate object image to obtain a first similarity; an image selection module, which is used to select the candidate object image whose first similarity is within a preset threshold interval, and obtain a similar image corresponding to the image of the object to be recognized; a model training module, which is used to use the image of the object to be recognized and the similar image as input samples, generate a sample label corresponding to the input sample based on the first similarity, and send the input sample and the sample label to a model training end so that the model training end trains a second object recognition model to obtain a second object recognition model after training and updating; a second recognition module, which is used to calculate the similarity between the image of the object to be recognized and the candidate object image using the second object recognition model after training and updating, and obtain a second similarity; a result generation module, which is used to determine the candidate object image whose first similarity and / or second similarity meets the preset conditions, and obtain the object recognition result corresponding to the object to be recognized based on the candidate object image that meets the preset conditions.

[0014] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned object recognition method.

[0015] A fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, which implement the above-mentioned object recognition method when the program instructions are executed by a processor.

[0016] The above scheme calculates the similarity between the image of the object to be identified and the image of the candidate object by using the first object recognition model to obtain the first similarity; selects the candidate object image whose first similarity is within the preset threshold interval to obtain the similar image corresponding to the image of the object to be identified; uses the image of the object to be identified and the similar image as input samples, and generates sample labels corresponding to the input samples based on the first similarity to train the second object recognition model, so that the trained second object recognition model is more in line with the object recognition scene, and as time goes by, the second object recognition model has a stronger ability to distinguish similar objects in the object recognition scene. In addition, directly using the first similarity to generate sample labels can effectively avoid the negative impact of noise samples on the training of the second object recognition model, and improve the robustness of the second object recognition model. Then, the second object recognition model after training and update is used to calculate the similarity between the image of the object to be identified and the image of the candidate object to obtain the second similarity; determines the object recognition result corresponding to the object to be identified according to the first similarity and / or the second similarity, and improves the accuracy of object recognition.

[0017] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0019] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;

[0020] Figure 2 is a flow chart of an object recognition method shown in an exemplary embodiment of the present application;

[0021] Figure 3 is a schematic diagram of a fused foreground segmentation result shown in an exemplary embodiment of the present application;

[0022] Figure 4 is a schematic diagram of filling a missing segmented area according to an exemplary embodiment of the present application;

[0023] Figure 5 is a flow chart of an object recognition method shown in another exemplary embodiment of the present application;

[0024] Figure 6 is a block diagram of an object recognition device shown in an exemplary embodiment of the present application;

[0025] Figure 7 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present application;

[0026] Figure 8 It is a schematic diagram of the structure of a computer-readable storage medium shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0027] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0028] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0029] The term "and / or" in this article is only an association information describing the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.

[0030] The object recognition method provided in the embodiment of the present application is described below.

[0031] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include a terminal 110 and a server 120, and the terminal 110 and the server 120 are connected to each other in communication.

[0032] The number of the terminal 110 may be one or more. The terminal 110 may be a camera, a door access device, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, etc., but is not limited thereto.

[0033] Server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0034] In one example, the server 120 may perform object recognition processing on an image of an object to be recognized that is obtained from the terminal 110 and contains the object to be recognized, to obtain an object recognition result. Of course, the server 120 may store the object recognition result locally, transmit it back to the terminal 110, or transmit it to other terminals.

[0035] In one example, a client running a target application is installed in the terminal 110. For example, the target application may be an application that provides an object recognition function, and the target application performs object recognition processing on an image of an object to be recognized to obtain an object recognition result. The server 120 may be a background server of the target application, and is used to provide background services for the client of the target application.

[0036] In the object recognition method provided in the embodiment of the present application, the execution subject of each step can be the terminal 110, such as the client of the target application installed and running in the terminal 110, or the server 120, or the terminal 110 and the server 120 can interact and cooperate to execute, that is, part of the steps of the method are executed by the terminal 110 and the other steps are executed by the server 120.

[0037] See also Figure 2 , Figure 2 is a flowchart of an object recognition method shown in an exemplary embodiment of the present application. The object recognition method can be applied to Figure 1 It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.

[0038] like Figure 2 As shown, the object recognition method at least includes steps S210 to S250, which are described in detail as follows:

[0039] Step S210: obtaining an image of an object to be identified containing an object to be identified, inputting the image of the object to be identified into a pre-trained first object recognition model, and using the first object recognition model to calculate the similarity between the image of the object to be identified and the candidate object image to obtain a first similarity.

[0040] The objects to be identified include but are not limited to vehicles, animals, etc.

[0041] The to-be-recognized object image and the candidate object image may be pre-stored in a memory, or may be acquired in real time.

[0042] For example, an image acquisition device is deployed in an object recognition scenario, and an image of the object to be recognized is acquired by the image acquisition device.

[0043] Among them, since the number of objects to be identified contained in the object image to be identified may be multiple, target recognition can be performed on the collected original image to determine the image area corresponding to each object to be identified, and then the image area corresponding to each object to be identified in the original image is cropped to obtain the object image to be identified corresponding to each object to be identified.

[0044] Optionally, the image of the object to be identified may be subjected to image preprocessing, such as image noise reduction processing, image size conversion processing, etc., to improve the accuracy of subsequent object identification.

[0045] For example, an image of a candidate object may be captured by an image capture device to obtain the candidate object image, and object attribute information corresponding to the candidate object may be further registered, the object attribute information including but not limited to the object name, object identifier, etc., so as to associate the object attribute information with the candidate object image for storage.

[0046] Furthermore, the image of the object to be identified is input into a pre-trained first object recognition model, and the first object recognition model is used to calculate the similarity between the image of the object to be identified and the candidate object image to obtain a first similarity.

[0047] Among them, the first object recognition model is used to calculate the similarity between images. The first object recognition model can be built based on convolutional neural networks (CNN), recurrent neural networks (RNN), etc., and trained using an open source image recognition training sample set, such as LFW (Labeled Faces in the Wild), CelebA (Celeb Faces Attribute) and other image sets to train the first object recognition model.

[0048] Exemplarily, a pre-trained first object recognition model is deployed in the terminal, and candidate object images are stored in the terminal. The first object recognition model is used to calculate the similarity between the to-be-recognized object image and the candidate object image to obtain a first similarity.

[0049] Exemplarily, the server is deployed with a pre-trained first object recognition model, and the terminal sends the image of the object to be recognized and the candidate object image to the server for input into the first object recognition model, and the first object recognition model is used to calculate the similarity between the image of the object to be recognized and the candidate object image to obtain the first similarity. After obtaining the candidate object image, the server can store the candidate object image, and the terminal only needs to send the image of the object to be recognized later.

[0050] The calculation process of the first similarity is exemplified as follows:

[0051] Detect the position of the object to be identified in the image of the object to be identified to identify the posture of the object to be identified, determine whether the posture of the object to be identified meets the preset posture requirement (such as the preset posture requirement is that the perspective of the posture is classified as a normal viewing angle), and / or determine whether the image clarity corresponding to the object to be identified meets the preset clarity requirement, etc., to filter out low-quality images of the object to be identified, then extract the key points of the object to be identified in the image of the object to be identified, align the key points of the object to be identified with the key points of the template object, so as to perform perspective alignment on the object to be identified in the image of the object to be identified, and obtain a preprocessed image of the object to be identified.

[0052] Furthermore, the image features of the preprocessed image of the object to be identified are extracted by the first object recognition model to obtain the features of the object to be identified. Similarly, the processing process of the candidate object image and the type of the image of the object to be identified are used to obtain the features of the candidate object. The similarity (such as cosine distance, Euclidean distance, etc.) between the features of the object to be identified and the features of the candidate object is calculated, and the calculated similarity is used as the first similarity.

[0053] Step S220: selecting candidate object images whose first similarity is within a preset threshold range, and obtaining similar images corresponding to the object image to be identified.

[0054] A preset threshold interval is obtained, candidate object images whose first similarity is within the preset threshold interval are selected, and these candidate object images are used as similar images corresponding to the object image to be identified.

[0055] It should be noted that the number of similar images can be one or more.

[0056] Step S230: Use the image of the object to be identified and the similar image as input samples, generate sample labels corresponding to the input samples based on the first similarity, and send the input samples and sample labels to the model training end so that the model training end trains the second object recognition model to obtain the second object recognition model after training and update.

[0057] Since there may be multiple similar objects in the candidate object images in the base database, and due to differences in image acquisition conditions, the images of the same object acquired under different conditions may be quite different. Therefore, in the process of acquiring the image of the object to be identified for object recognition in the object recognition scene, the first similarity between the image of the object to be identified and the candidate object image corresponding to the same object may not be high, and there is a situation where it is not possible to directly determine without doubt that the image of the object to be identified and the candidate object image are the same object based on the first similarity.

[0058] To address the above problem, sample images of similar objects can be collected and the corresponding objects can be marked in the sample images of similar objects to train the neural network as training samples. However, the applicant found that in the actual training process, it is difficult to collect a large number of sample images of similar objects, resulting in the accuracy of the trained neural network for distinguishing similar objects being unsatisfactory.

[0059] Therefore, based on object recognition according to the first object recognition model, the present application filters out similar images corresponding to the image of the object to be recognized according to the first similarity between the image of the object to be recognized and the image of the candidate object, uses these images of the object to be recognized and similar images as input samples, and generates sample labels corresponding to the input samples according to the first similarity, wherein the first similarity can be directly used as the sample label, and the first similarity can also be normalized to obtain the sample label. Then, the input sample and the sample label are sent to the model training end so that the model training end trains the second object recognition model to obtain the second object recognition model after training and updating.

[0060] Optionally, in addition to training the second object recognition model based on the image of the object to be recognized and its corresponding similar images, the second object recognition model can also be trained with other candidate object images, such as determining dissimilar images corresponding to the image of the object to be recognized as negative samples to train the second object recognition model. This application does not limit the specific implementation method of model training.

[0061] Among them, the second object recognition model can be constructed based on a convolutional neural network, a recurrent neural network, etc., and this application does not limit this.

[0062] For example, the loss function used to train and update the second object recognition model can be expressed as the following formula 1:

[0063] (Formula 1)

[0064] Among them, Loss is the calculated model training loss; N is the number of input samples; C is the number of similar images; It refers to the sample label value corresponding to the image of the object to be identified in the i-th input sample and the j-th similar image in the sample label; It refers to the probability that the image of the object to be identified in the i-th input sample and the j-th similar image belong to the same object, that is, the model prediction result.

[0065] The second object recognition model is iteratively updated according to the model training loss to obtain a second object recognition model after training and update.

[0066] Among them, the model training end can be a server or other device end containing computing resources, and the model training end can be set separately from the terminal or centrally with the terminal, which is not limited in this application.

[0067] Optionally, an update interval threshold of the model is obtained, and if the time interval between the time of the last training update of the second object recognition model and the current time reaches the update interval threshold, step S230 is executed.

[0068] The update interval threshold may be a preset value or a value that is flexibly adjusted according to actual conditions. For example, the recognition accuracy of the second object recognition model of the current updated version is obtained, and the update interval threshold corresponding to the next update is set according to the recognition accuracy corresponding to the current updated version. For example, the recognition accuracy is the lowest, and the update interval threshold is shorter. Of course, the update interval threshold can also be set according to the recognition accuracy fluctuation trend of the second object recognition model of multiple updated versions, and this application does not limit this.

[0069] Among them, all input samples and their corresponding sample labels obtained between the time of the last training update and the current time can be sent to the model training end.

[0070] For the same object to be identified, during the object recognition process, even if the candidate object image that matches the image of the object to be identified cannot be directly determined without doubt by the first similarity, the first similarity between the image of the object to be identified and the correctly matched candidate object image is the highest in most cases. Therefore, the second object recognition model is trained using the image of the object to be identified, similar images and the first similarity, and when there are multiple similar images, the second object recognition model can learn the degree of similarity between the image of the object to be identified and each similar image.

[0071] Optionally, when training the second object recognition model, the second object recognition model is controlled to learn similar areas and dissimilar areas between the object to be recognized corresponding to the object image to be recognized and the candidate objects corresponding to the similar images, so that the second object recognition model pays more attention to dissimilar areas and improves the ability to distinguish similar objects.

[0072] By taking the image of the object to be identified and the similar image as input samples, generating sample labels corresponding to the input samples based on the first similarity, generating training samples corresponding to the object recognition scene during the object recognition process, and obtaining more training samples as time goes by, the trained second object recognition model and the object recognition scene are more closely matched, and the second object recognition model has a stronger ability to distinguish similar objects in the object recognition scene as time goes by. In addition, directly using the first similarity to generate sample labels can effectively avoid the negative impact of noise samples on the training of the second object recognition model, and improve the robustness of the second object recognition model.

[0073] In addition, the second object recognition model can be trained only based on the sample data of the object recognition scene corresponding to the current terminal, so different terminals correspond to different second object recognition models, and different terminals can continuously optimize their corresponding second object recognition models over time, which can improve the fit between the second object recognition model and the object recognition scene, and the second object recognition model can be quickly trained and deployed. The second object recognition model can also be trained in combination with sample data of object recognition scenes corresponding to multiple terminals, so that multiple terminals correspond to one second object recognition model, thereby improving the scope of application of the second object recognition model.

[0074] Step S240: Calculate the similarity between the to-be-recognized object image and the candidate object image using the trained and updated second object recognition model to obtain a second similarity.

[0075] The trained and updated second object recognition model is deployed on a terminal or a server.

[0076] If the second object recognition model is deployed in the terminal, the terminal can directly input the to-be-recognized object image and the candidate object image into the second object recognition model to obtain the second similarity output by the second object recognition model.

[0077] If the second object recognition model is deployed on the server, the terminal sends the image of the object to be recognized and the candidate object image to the server, and the server inputs the image of the object to be recognized and the candidate object image to the second object recognition model to obtain the second similarity output by the second object recognition model.

[0078] Step S250: determining candidate object images whose first similarity and / or second similarity satisfy preset conditions, and obtaining object recognition results corresponding to the object to be recognized based on the candidate object images satisfying the preset conditions.

[0079] If the candidate object image that matches the image of the object to be identified can be undoubtedly determined by the first similarity, such as the first similarity between the image of the object to be identified and a candidate object image is greater than a preset threshold (such as 0.95), then the candidate object image can be directly judged to meet the preset conditions; of course, the second object recognition model can also be used to calculate the second similarity between the image of the object to be identified and the candidate object image, and the first similarity and the second similarity can be combined to determine whether the candidate object image meets the preset conditions.

[0080] If the first similarity cannot undoubtedly determine that the candidate object image matches the image of the object to be identified, the second similarity between the image of the object to be identified and the candidate object image is calculated using the second object recognition model, and whether the candidate object image meets the preset conditions is determined based on the second similarity, or the first similarity and the second similarity are combined to determine whether the candidate object image meets the preset conditions.

[0081] The object recognition result corresponding to the object to be recognized is obtained based on the candidate object image that meets the preset conditions. For example, the candidate object image that meets the preset conditions is directly used as the object recognition result; or the object attribute information corresponding to the candidate object image that meets the preset conditions is obtained, and the object attribute information is used as the object recognition result.

[0082] Optionally, after obtaining the object recognition result, the object recognition result can be displayed, and permission judgment can be performed based on the object recognition result, etc. This application does not limit this.

[0083] By using the first object recognition model and the second object recognition model to perform multiple object recognition methods, the accuracy of object recognition is improved.

[0084] Next, some embodiments of the present application are described in detail.

[0085] In some embodiments, generating a sample label corresponding to the input sample based on the first similarity in step S230 includes: constructing an initial similarity matrix based on the first similarity between the image of the object to be identified and each candidate object image; resetting the first similarity in the initial similarity matrix that is less than a third threshold value to a preset minimum value to obtain a target similarity matrix after noise reduction; normalizing the target similarity matrix to obtain a normalized matrix, and using the normalized matrix as the sample label.

[0086] For example, the first similarity between the to-be-recognized object image and each similar image is represented as Sij, where i and j are image serial numbers of the to-be-recognized object image and the similar image, respectively.

[0087] For example, there are 4 to-be-recognized object images and 4 candidate object images, and their initial similarity matrix M is expressed as the following formula 2:

[0088] (Formula 2)

[0089] Among them, each column corresponds to a candidate object image, each row corresponds to an object image to be identified, the candidate object images corresponding to the first and second columns are objects with high similarity, and the candidate object images corresponding to the third and fourth columns are objects with high similarity.

[0090] The first similarities in the initial similarity matrix that are less than the third threshold are reset to a preset minimum value to obtain a target similarity matrix after noise reduction.

[0091] For example, if the third threshold is 0.8 and the preset minimum value is 0.1, the target similarity matrix M1 is expressed as the following formula 3:

[0092] (Formula 3)

[0093] The target similarity matrix can be directly used as a sample label. Of course, the target similarity matrix can also be normalized and the normalized matrix can be used as a sample label. This application does not limit this.

[0094] Optionally, if only similar images corresponding to the image of the object to be identified are used as input samples, a sample label is generated according to the first similarity between the image of the object to be identified and the similar images. For example, a similarity matrix is ​​constructed according to the first similarity between the image of the object to be identified and each similar image, and each element in the matrix corresponds to the first similarity with the similar image. Then, the similarity matrix is ​​normalized and the normalized similarity matrix is ​​used as the sample label.

[0095] In some embodiments, in order to reduce noise samples in the input samples for training the second object recognition model, the first similarity between the image of the object to be recognized and the candidate object image recognized within a preset time period can also be statistically analyzed, and the noise sample is determined based on the statistical result, and the noise sample is filtered. The image of the object to be recognized and the similar image after filtering the noise sample are used as input samples, and the input sample and the corresponding sample label are sent to the model training end.

[0096] Exemplarily, based on the magnitude of the first similarity of similar images corresponding to each image of the object to be identified, similar images are sorted in descending order to obtain a similar image sequence corresponding to each image of the object to be identified, and a statistical analysis is performed on the similar image sequence corresponding to each image of the object to be identified according to preset rules, and the image of the object to be identified and its corresponding similar image with conflicting similar image sequences are used as noise samples.

[0097] For example, the similarity between each image of the object to be identified is calculated to obtain the input image similarity, and the images of the object to be identified whose input image similarity is greater than a preset similarity threshold are divided into one category, and it is detected whether there are conflicts in the similar image sequences corresponding to the images of the object to be identified belonging to one category, and the similar image sequences with conflicts are filtered out.

[0098] For example, the object images to be identified include H1, H2, H3, and H4, the similar image sequences corresponding to H1 are N1 and N2, the similar image sequences corresponding to H2 and H3 are both N1, and the similar image sequences corresponding to H4 are N2 and N3. The input image similarity between each object image to be identified is calculated, and the object images H1, H2, H3, and H4 to be identified whose input image similarity is greater than a preset similarity threshold are classified into one category. By analyzing H1, H2, H3, and H4, it is found that the similar image sequence of H4 is significantly different from the similar image sequences of H1, H2, and H3 in the classification, and it is determined that there is a conflict in the similar image sequence of H4, and the object image H4 to be identified and its corresponding similar images are filtered out.

[0099] Exemplarily, the candidate object image and the to-be-identified object image whose first similarity is greater than the first threshold are taken as accurate image pairs. If there is and only one candidate object image and the to-be-identified object image whose first similarity is greater than the first threshold (such as 0.95), it is considered that it can be determined without doubt that the to-be-identified object image and the candidate object image correspond to the same object. The to-be-identified object image and its corresponding candidate object image in the above case are recorded to obtain an accurate image pair. The to-be-identified object image determined in step S220 and its corresponding similar image are taken as an inaccurate image pair. Then, the similarity between the to-be-identified object image in the accurate image pair and the to-be-identified object image in each inaccurate image pair is calculated to obtain the input image similarity. The to-be-identified object images whose input image similarity is greater than the preset similarity threshold are classified into one category, and the probability that the corresponding inaccurate image pair belonging to one category belongs to a noise sample is calculated according to the accurate image pair.

[0100] For example, it can be determined whether there is a candidate object image in the accurate image pair in each similar image corresponding to the inaccurate image pair. If not, the probability of it being a noise sample is high. If so, the sorting position of the candidate object image in the accurate image pair in the similar image sequence corresponding to the inaccurate image pair is determined. The earlier the sorting position, the smaller the probability of it being a noise sample. Conversely, the probability of it being a noise sample is high.

[0101] Of course, other methods may be used to determine the noise sample, which is not limited in this application.

[0102] In some embodiments, in step S240, the similarity between the image of the object to be identified and the image of the candidate object is calculated using the second object recognition model after training and update to obtain the second similarity, including: extracting global image features and local image features of the image of the object to be identified and the image of the candidate object, respectively; performing weighted fusion on the global image features and local image features of the image of the object to be identified to obtain the features of the object to be identified; and, performing weighted fusion on the global image features and local image features of the candidate object image to obtain the features of the candidate object; calculating the similarity between the features of the object to be identified and the features of the candidate object to obtain the second similarity.

[0103] Among them, the local image features are image features corresponding to the image area of ​​the object to be identified or the candidate object in the image, and the image areas of the object to be identified and the candidate object can be segmented from the image of the object to be identified and the image of the candidate object through an image segmentation network.

[0104] In some embodiments, taking the image of the object to be identified as an example, the mask area of ​​the object to be identified in the image of the object to be identified is extracted, and the minimum bounding box corresponding to the mask area is calculated to obtain the target area. Then, the regional tile size is obtained, such as the regional tile size is [20px, 20px], and the target area is divided into N image blocks according to the regional tile size. Each image block is traversed, and the image block is input into a pre-trained foreground segmentation model to obtain the foreground segmentation result corresponding to the image block output by the foreground segmentation model. Detect whether there are adjacent pixels between the foreground segmentation results corresponding to each image block and whether the number of adjacent pixels is greater than a preset number threshold. If so, the foreground segmentation results corresponding to the image blocks that meet the above conditions are fused.

[0105] Among them, the foreground segmentation model can be implemented based on the SAM (Segment Anything) large model, or it can be implemented based on other neural network structures, and this application does not limit this.

[0106] For example, see Figure 3 , Figure 3 FIG. 1 is a schematic diagram showing a fused foreground segmentation result according to an embodiment of the present application. Figure 3 As shown, for two adjacent image blocks in the target area, if there are adjacent pixels between the foreground segmentation results corresponding to the two image blocks, and the number of adjacent pixels is greater than a preset number threshold, the foreground segmentation results corresponding to the two image blocks are fused.

[0107] After the fusion of all foreground segmentation results is completed, the fused segmentation result is obtained, and the image features corresponding to the fused segmentation result are extracted to obtain the local image features.

[0108] Optionally, after obtaining the fused segmentation result in the above embodiment, there may be a situation where the segmentation area is missing, the missing segmentation area is filled, and then the image feature is extracted from the filled fused segmentation result to obtain the local image feature. Figure 4 , Figure 4 FIG. 1 is a schematic diagram showing filling of missing segmented areas according to an embodiment of the present application, as shown in FIG. Figure 4 As shown in , for each fused segmentation result, the minimum bounding box of the area corresponding to the fused segmentation result is calculated, and each row of pixels in the bounding box is traversed to identify the missing segmentation area. Figure 4 As shown, each row of pixels is traversed from left to right, and the points from white to gray are recorded as 1, and the points from gray to white are recorded as 0. All pixels between 0 and 1 are regarded as missing segmentation areas and filled with gray to obtain the filled fusion segmentation result.

[0109] Optionally, each fused segmentation result is sorted from small to large, the first N fused segmentation results are extracted as the fused segmentation results corresponding to the object to be identified, and the image feature Fs corresponding to each of the above fused segmentation results is extracted. Then, according to the above first N fused segmentation results, the region is divided again in the image of the object to be identified, and the region adjacent to the first N fused segmentation results is divided into the object region, and the image feature Fp of the object region is extracted, and the image feature Fs corresponding to each fused segmentation result and the image feature Fp of the object region are weightedly fused to obtain the local image feature corresponding to the object to be identified.

[0110] The above embodiment improves the accuracy of local area division.

[0111] Exemplarily, the attention mechanism is used to calculate the weights of the global image features and local image features of the to-be-identified object image and the candidate object image, thereby performing weighted feature fusion.

[0112] When weighted fusion is performed on global image features and local image features, different image regions are assigned different weight values ​​according to their ability to distinguish similar objects. The weight assignment method is obtained by the second object recognition model through learning input samples and sample labels.

[0113] After extracting the features of the object to be identified and the features of the candidate objects through the second object recognition model, the similarity between the features of the object to be identified and the features of the candidate objects is calculated to obtain a second similarity.

[0114] Further, candidate object images whose first similarity and / or second similarity meet a preset condition are determined.

[0115] In some embodiments, determining the candidate object image whose first similarity and / or second similarity satisfies a preset condition in step S250 includes: obtaining a first threshold and a second threshold; if there is a candidate object image corresponding to a first similarity greater than the first threshold, then using the candidate object image whose first similarity is greater than the first threshold as the candidate object image that satisfies the preset condition; or, if there is a candidate object image corresponding to a second similarity greater than the second threshold, then using the candidate object image whose second similarity is greater than the second threshold as the candidate object image that satisfies the preset condition.

[0116] The first threshold value and the second threshold value may be the same or different. The first threshold value and the second threshold value may be pre-set fixed values ​​or values ​​flexibly calculated according to actual conditions.

[0117] For example, based on the time interval between the image acquisition time corresponding to each candidate object image and the current time, the first threshold and / or the second threshold corresponding to each candidate object image is flexibly calculated, wherein the shorter the above time interval is, the higher the first threshold and / or the second threshold is, and the longer the time interval is, the lower the first threshold and / or the second threshold is, thereby improving the accuracy of the first threshold and the second threshold.

[0118] In some embodiments, if there is no candidate object image whose corresponding first similarity is greater than the first threshold, a candidate object image whose first similarity is within a preset threshold interval is selected to obtain a similar image corresponding to the image of the object to be identified; in step S240, the similarity between the image of the object to be identified and the candidate object image is calculated using the trained and updated second object recognition model to obtain the second similarity, including: inputting the image of the object to be identified and the similar image corresponding to the image of the object to be identified into the trained and updated second object recognition model to obtain the second similarity output by the second object recognition model.

[0119] That is, only the image of the object to be identified and the similar images corresponding to the image of the object to be identified are input into the second object recognition model, which can reduce the image processing amount of the second object recognition model.

[0120] Of course, under the premise that the computing resources of the execution entity deploying the second object recognition model are sufficient, the image of the object to be recognized and each candidate object image can be input into the second object recognition model for recognition processing to perform a comprehensive comparison on each candidate object image.

[0121] In some embodiments, before inputting the image of the object to be identified and the similar image corresponding to the image of the object to be identified into the second object recognition model after training and updating, and obtaining the second similarity output by the second object recognition model after training and updating, it also includes: obtaining the input sample set used by the second object recognition model in the model training process; if there are similar images in the input sample set, executing the step of inputting the image of the object to be identified and the similar image corresponding to the image of the object to be identified into the second object recognition model after training and updating, and obtaining the second similarity output by the second object recognition model after training and updating; if there are no similar images in the input sample set, executing the step of using the image of the object to be identified and the similar image as input samples, generating sample labels corresponding to the input samples based on the first similarity, and sending the input samples and sample labels to the model training end.

[0122] That is, it is detected whether the second object recognition model has learned the candidate object image to be input during the training process. If it has been learned, it is directly input into the second object recognition model for processing. If it has not been learned, it needs to be used as an input sample to train the second object recognition model to improve the accuracy of the second similarity outputted in the end.

[0123] In some embodiments, the method also includes: if there is no candidate object image corresponding to a first similarity greater than a first threshold, but there is a candidate object image corresponding to a second similarity greater than a second threshold, then the candidate object images are sorted in descending order according to the size of the first similarity, and a preset number of candidate object images are selected before sorting to obtain a benchmark candidate image.

[0124] Among them, the preset number can be 1, 2, or 3.

[0125] Optionally, the value of the preset number can be determined according to the size of the first similarity. The larger the value of the first similarity, the larger the preset number, and the smaller the value of the first similarity, the smaller the preset number, thereby improving the accuracy of object recognition.

[0126] Further, it is determined whether there is an image in the reference candidate image that is identical to the candidate object image whose second similarity is greater than a second threshold. If so, the candidate object image whose second similarity is greater than the second threshold is used as the candidate object image that meets the preset condition.

[0127] If there are multiple candidate object images whose second similarity is greater than the second threshold, the candidate object image with the largest second similarity is selected, and the other candidate object images are filtered out.

[0128] In some embodiments, in combination with the above embodiments, in step S220, a candidate object image whose first similarity is within a preset threshold range is selected to obtain a similar image corresponding to the object image to be identified, including: obtaining a third threshold, the third threshold is less than the first threshold; selecting a candidate object image whose first similarity is less than the first threshold and greater than the third threshold, to obtain a similar image corresponding to the object image to be identified.

[0129] Of course, the preset threshold interval may also be set to other threshold intervals, which is not limited in this application.

[0130] In some embodiments, see Figure 5 , Figure 5 This is a flow chart of an object recognition method shown in another embodiment of the present application. Figure 5 As shown, the steps of performing object recognition by the terminal include:

[0131] Step S511: using the first object recognition model to calculate the similarity between the image of the object to be recognized and the image of the candidate object to obtain a first similarity;

[0132] Step S512: Determine whether there is a candidate object image corresponding to a first similarity greater than a first threshold, if not, execute step S513, if yes, execute step S519;

[0133] Step S513: Determine whether the terminal is deployed with a second object recognition model, if not, execute step S514, if yes, execute step S516;

[0134] Step S514: determine whether there is a candidate object image corresponding to a first similarity greater than a second threshold, if so, execute step S515, if not, end;

[0135] Step S515: taking the candidate object image whose first similarity is greater than the second threshold as a similar image, and sending the object image to be identified, the similar image, and the first similarity to the model training end;

[0136] Step S516: whether there is a candidate object image to be input in the used input sample set, if not, execute step S514, if yes, execute step S517;

[0137] Step S517: inputting the to-be-recognized object image and the candidate object image into a second object recognition model to obtain a second similarity between the to-be-recognized object image and the candidate object image;

[0138] Step S518: Determine whether there is a candidate object image corresponding to a second similarity greater than a second threshold value, if not, then end, if yes, then execute step S519;

[0139] Step S519: Generate an object recognition result according to the candidate object image.

[0140] The model training end performs the following steps to train the second object recognition model:

[0141] Step S5151: taking the to-be-recognized object image and the similar image as input samples, and generating a sample label corresponding to the input sample based on the first similarity;

[0142] Step S5152: training a second object recognition model based on the input sample and its corresponding sample label;

[0143] Step S5153: Send the trained and updated second object recognition model to the terminal for deployment.

[0144] The object recognition method provided by the present application calculates the similarity between the image of the object to be recognized and the image of the candidate object by using the first object recognition model to obtain the first similarity; selects the candidate object image whose first similarity is within the preset threshold interval to obtain the similar image corresponding to the image of the object to be recognized; uses the image of the object to be recognized and the similar image as input samples, and generates sample labels corresponding to the input samples based on the first similarity to train the second object recognition model, so that the trained second object recognition model is more in line with the object recognition scene, and as time goes by, the second object recognition model has a stronger ability to distinguish similar objects for the object recognition scene. In addition, directly using the first similarity to generate sample labels can effectively avoid the negative impact of noise samples on the training of the second object recognition model, and improve the robustness of the second object recognition model. Then, the second object recognition model after training and updating is used to calculate the similarity between the image of the object to be recognized and the image of the candidate object to obtain the second similarity; determines the object recognition result corresponding to the object to be recognized according to the first similarity and / or the second similarity, and improves the accuracy of object recognition.

[0145] Figure 6 FIG. 1 is a block diagram of an object recognition device shown in an exemplary embodiment of the present application. Figure 6 As shown, the exemplary object recognition device 600 includes: a first recognition module 610, an image selection module 620, a model training module 630, a second recognition module 640 and a result generation module 650. Specifically:

[0146] The first recognition module 610 is used to obtain an image of an object to be recognized containing an object to be recognized, input the image of the object to be recognized into a pre-trained first object recognition model, and use the first object recognition model to calculate the similarity between the image of the object to be recognized and the candidate object image to obtain a first similarity;

[0147] An image selection module 620 is used to select candidate object images whose first similarity is within a preset threshold range, and obtain similar images corresponding to the object image to be identified;

[0148] The model training module 630 is used to use the image of the object to be identified and the similar image as input samples, generate a sample label corresponding to the input sample based on the first similarity, and send the input sample and the sample label to the model training end so that the model training end trains the second object recognition model to obtain the second object recognition model after training and updating;

[0149] A second recognition module 640 is used to calculate the similarity between the image of the object to be recognized and the image of the candidate object by using the second object recognition model after training and updating, so as to obtain a second similarity;

[0150] The result generation module 650 is used to determine the candidate object images whose first similarity and / or second similarity meet the preset conditions, and obtain the object recognition result corresponding to the object to be recognized based on the candidate object images that meet the preset conditions.

[0151] It should be noted that the object recognition device provided in the above embodiment and the object recognition method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the object recognition device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0152] See also Figure 7 , Figure 7 7 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 700 includes a memory 701 and a processor 702, and the processor 702 is used to execute program instructions stored in the memory 701 to implement the steps in any of the above-mentioned object recognition method embodiments. In a specific implementation scenario, the electronic device 700 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 700 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0153] Specifically, the processor 702 is used to control itself and the memory 701 to implement the steps in any of the above-mentioned object recognition method embodiments. The processor 702 can also be called a central processing unit (CPU). The processor 702 may be an integrated circuit chip with signal processing capabilities. The processor 702 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 702 can be implemented by an integrated circuit chip.

[0154] See also Figure 8 , Figure 8 The computer-readable storage medium 800 stores program instructions 810 that can be executed by a processor, and the program instructions 810 are used to implement the steps in any of the above-mentioned object recognition method embodiments.

[0155] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0156] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0157] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0158] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

Claims

1. An object recognition method, characterized in that: include: Acquire an image of an object to be identified containing an object to be identified, input the image of the object to be identified into a pre-trained first object recognition model, and use the first object recognition model to calculate the similarity between the image of the object to be identified and a candidate object image to obtain a first similarity; Selecting a candidate object image whose first similarity is within a preset threshold range to obtain a similar image corresponding to the object image to be identified; Taking the to-be-recognized object image and the similar image as input samples, generating a sample label corresponding to the input sample based on the first similarity, and sending the input sample and the sample label to a model training end so that the model training end trains a second object recognition model to obtain a second object recognition model after training and updating; Calculating the similarity between the to-be-recognized object image and the candidate object image using the second object recognition model after training and updating to obtain a second similarity; Determine a candidate object image whose first similarity and the second similarity meet a preset condition, or determine a candidate object image whose second similarity meets a preset condition, and obtain an object recognition result corresponding to the object to be recognized based on the candidate object image that meets the preset condition.

2. The method according to claim 1, characterized in that The determining of the candidate object images whose first similarity and / or second similarity meets a preset condition includes: Obtain a first threshold and a second threshold; If there is a candidate object image corresponding to a first similarity greater than the first threshold, taking the candidate object image with the first similarity greater than the first threshold as a candidate object image that meets the preset condition; Alternatively, if there is a candidate object image corresponding to which the second similarity is greater than the second threshold, the candidate object image with the second similarity greater than the second threshold is taken as the candidate object image that meets the preset condition.

3. The method according to claim 2, characterized in that The method further comprises: If there is no candidate object image whose corresponding first similarity is greater than the first threshold, then selecting a candidate object image whose first similarity is within a preset threshold interval to obtain a similar image corresponding to the to-be-identified object image; The step of calculating the similarity between the to-be-recognized object image and the candidate object image using the second object recognition model after training and updating to obtain a second similarity includes: The to-be-recognized object image and a similar image corresponding to the to-be-recognized object image are input into the trained and updated second object recognition model to obtain a second similarity output by the trained and updated second object recognition model.

4. The method according to claim 3, characterized in that Before inputting the to-be-recognized object image and the similar image corresponding to the to-be-recognized object image into the trained and updated second object recognition model to obtain the second similarity output by the trained and updated second object recognition model, the method further includes: Obtaining a set of input samples used by the second object recognition model in a model training process; If the similar image exists in the input sample set, the step of inputting the to-be-recognized object image and the similar image corresponding to the to-be-recognized object image into the trained and updated second object recognition model to obtain a second similarity output by the trained and updated second object recognition model is performed; If the similar image does not exist in the input sample set, the steps of taking the image of the object to be identified and the similar image as input samples, generating a sample label corresponding to the input sample based on the first similarity, and sending the input sample and the sample label to the model training end are performed.

5. The method according to claim 2, characterized in that: The method further comprises: If there is no candidate object image whose corresponding first similarity is greater than the first threshold, but there is a candidate object image whose corresponding second similarity is greater than the second threshold, sorting the candidate object images in descending order according to the magnitude of the first similarity, selecting a preset number of candidate object images before sorting, and obtaining a reference candidate image; If there is an image in the reference candidate images that is the same as the candidate object image whose second similarity is greater than the second threshold, the candidate object image whose second similarity is greater than the second threshold is taken as the candidate object image that meets the preset condition.

6. The method according to claim 2, characterized in that The step of selecting a candidate object image whose first similarity is within a preset threshold range to obtain a similar image corresponding to the object image to be identified includes: Obtaining a third threshold, where the third threshold is less than the first threshold; A candidate object image whose first similarity is less than the first threshold and greater than the third threshold is selected to obtain a similar image corresponding to the object image to be identified.

7. The method according to claim 1, characterized in that Generating a sample label corresponding to the input sample based on the first similarity includes: constructing an initial similarity matrix based on a first similarity between the to-be-recognized object image and each of the candidate object images; Resetting the first similarity in the initial similarity matrix that is less than the third threshold to a preset minimum value to obtain a target similarity matrix after noise reduction; The target similarity matrix is ​​normalized to obtain a normalized matrix, and the normalized matrix is ​​used as a sample label.

8. The method according to claim 1, characterized in that The step of calculating the similarity between the to-be-recognized object image and the candidate object image using the second object recognition model after training and updating to obtain a second similarity includes: Respectively extracting global image features and local image features of the to-be-identified object image and the candidate object image; Performing weighted fusion on the global image features and local image features of the to-be-recognized object image to obtain the to-be-recognized object features; and performing weighted fusion on the global image features and local image features of the candidate object image to obtain the candidate object features; Calculating the similarity between the feature of the object to be identified and the feature of the candidate object to obtain a second similarity; Wherein, the local image feature extraction step includes: Extracting a mask area of ​​the to-be-identified object image or the candidate object image, and calculating a minimum bounding box corresponding to the mask area to obtain a target area; Dividing the target area into a plurality of image blocks, inputting the image blocks into a pre-trained foreground segmentation model, and obtaining a foreground segmentation result corresponding to the image blocks output by the foreground segmentation model; Detecting whether there are adjacent pixels between the foreground segmentation results corresponding to each of the image blocks and whether the number of adjacent pixels is greater than a preset number threshold, and if so, fusing the foreground segmentation results corresponding to the image blocks to obtain a fused segmentation result; The image features corresponding to the fused segmentation results are extracted to obtain local image features.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the steps in the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and the program instructions can be executed by a processor to implement the steps in the method according to any one of claims 1 to 8.