Image recognition methods, devices and electronic equipment

CN122574474APending Publication Date: 2026-08-14TP-LINK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610608239.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-30
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]然而,上述方法通过人工标注获得训练数据集的成本较高,且通过训练得到的目标重识别模型仅能在特定场景下进行目标重识别处理,泛化性差,难以应用在其他动态场景中,影响了目标重识别模型的识别精度

Benefits of technology

[0011]本申请实施例的第一方面提供的图像识别方法,通过获取包括多个图像簇的训练数据集,根据训练数据集确定聚类图像簇集,并对重识别模型进行迭代训练,得到第t重识别模型。根据测试数据集,确定训练次数t对应的第t重识别模型的第一平均精度均值。在第一平均精度均值未达到预设条件时标记训练次数t加一,返回执行根据训练数据集确定聚类图像簇集,并基于聚类图像簇集对重识别模型进行迭代训练,得到第t重识别模型及之后的步骤。在第一平均精度均值达到预设条件时,确定对应的第t重识别模型为目标重识别模型;将至少两张待识别图像数据输入至目标重识别模型中,得到目标重识别结果,以确定各待识别图像数据中的物体是否相同。基于无标签的训练数据集实现了重识别模型的自主增强、自我迭代学习,降低了学习成本的同时,使得模型可以在各种动态场景中进行目标重识别处理,提升了目标重识别模型的泛化能力,提高了目标重识别模型在多种场景下的识别精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122574474A_ABST
    Figure CN122574474A_ABST
Patent Text Reader

Abstract

This application belongs to the field of data processing technology and provides an image recognition method, apparatus, and electronic device. In this application, an embodiment acquires a training dataset including multiple image clusters, determines clustered image clusters based on the training dataset, and iteratively trains a re-recognition model to obtain the t-th re-recognition model. Based on a test dataset, a first average precision of the t-th re-recognition model is determined. If the first average precision does not reach a preset condition, the training iteration t is incremented by one, and the process returns to the steps of determining the clustered image clusters based on the training dataset and subsequent steps. When the first average precision reaches a preset condition, the t-th re-recognition model is determined as the target re-recognition model. Based on the target re-recognition model, the target re-recognition result for at least two images to be recognized is determined. The re-recognition model can achieve self-iterative learning based on an unlabeled training dataset, making the model applicable to various dynamic scenarios and improving the accuracy of the re-recognition results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, and in particular relates to an image recognition method, apparatus and electronic device. Background Technology

[0002] Object re-identification models are commonly used to identify specific people, vehicles, etc., in various scenarios such as cross-camera, cross-scene, and cross-viewpoint situations. They are widely used in fields such as intelligent security, intelligent retrieval, intelligent transportation, object tracking, and people search. Generally, supervised training is required using a large amount of labeled training datasets in specific scenarios to enable the object re-identification model to learn its object re-identification capabilities.

[0003] However, the above methods are costly to obtain training datasets through manual annotation, and the target re-identification models obtained through training can only perform target re-identification processing in specific scenarios, with poor generalization and difficulty in applying them to other dynamic scenarios, which affects the recognition accuracy of the target re-identification models.

[0004] Therefore, improving the generalization ability and recognition accuracy of target re-identification models has become an urgent problem to be solved. Summary of the Invention

[0005] In view of this, embodiments of this application provide an image recognition method, apparatus, and electronic device capable of clustering a training dataset constructed from image clusters to obtain a clustered image cluster set. A re-identification model is iteratively trained based on the clustered image cluster set and validated using a test dataset to obtain a target re-identification model. The target re-identification result is obtained by performing target re-identification processing using the target re-identification model. The re-identification model can achieve autonomous enhancement and self-iterative learning based on an unlabeled training dataset, enabling it to perform target re-identification processing in various dynamic scenarios and improving the accuracy of the re-identification results.

[0006] A first aspect of this application provides an image recognition method, including: Obtain a training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object; The clustered image clusters are determined based on the training dataset, and the re-recognition model is iteratively trained based on the clustered image clusters to obtain the t-th re-recognition model; wherein, the initial value of the training number t is one; Based on the test dataset, determine the first average precision mean of the t-th re-identification model corresponding to the training number t; When the mean of the first average accuracy of the t-th re-identification model does not reach the preset condition, the training number t is incremented by one, and the process returns to the step of determining the clustered image clusters based on the training dataset, and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps. When the mean of the first average accuracy of the t-th re-identification model reaches a preset condition, the t-th re-identification model is determined to be the target re-identification model; At least two image data to be identified are input into the target re-identification model to obtain the target re-identification result output by the target re-identification model; the target re-identification result is used to indicate whether the objects in each of the image data to be identified are the same.

[0007] A second aspect of this application provides an image recognition device, comprising: A data acquisition module is used to acquire a training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object; The training module is used to determine the clustered image clusters based on the training dataset, and to iteratively train the re-recognition model based on the clustered image clusters to obtain the t-th re-recognition model; wherein the initial value of the training number t is one; The mean determination module is used to determine the first average precision mean of the t-th re-identification model corresponding to the training number t based on the test dataset; The loop module is used to increment the training number t by one when the mean of the first average precision of the t-th re-identification model does not reach the preset condition, and return to execute the steps of determining the clustered image clusters based on the training dataset, and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps. The model determination module is used to determine the t-th re-identification model as the target re-identification model when the mean of the first average accuracy of the t-th re-identification model reaches a preset condition; The recognition module is used to input at least two images to be recognized into the target re-recognition model to obtain the target re-recognition result output by the target re-recognition model; the target re-recognition result is used to indicate whether the objects in each of the images to be recognized are the same.

[0008] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the image recognition method provided in the first aspect.

[0009] A fourth aspect of this application provides a computer program storage medium including a computer program that, when executed by an electronic device, implements the steps of the image recognition method provided in the first aspect.

[0010] The fifth aspect of this application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the steps of the image recognition method provided in the first aspect.

[0011] The image recognition method provided in the first aspect of this application involves acquiring a training dataset including multiple image clusters, determining clustered image clusters based on the training dataset, and iteratively training a re-recognition model to obtain the t-th re-recognition model. Based on a test dataset, a first average precision mean of the t-th re-recognition model corresponding to the training number t is determined. If the first average precision mean does not reach a preset condition, the training number t is incremented by one, and the process returns to determining the clustered image clusters based on the training dataset, iteratively training the re-recognition model based on the clustered image clusters, obtaining the t-th re-recognition model, and subsequent steps. When the first average precision mean reaches a preset condition, the corresponding t-th re-recognition model is determined as the target re-recognition model; at least two images to be recognized are input into the target re-recognition model to obtain the target re-recognition result, thereby determining whether the objects in each image are the same. Based on an unlabeled training dataset, the re-recognition model achieves autonomous enhancement and self-iterative learning, reducing learning costs while enabling the model to perform target re-recognition processing in various dynamic scenarios, improving the generalization ability of the target re-recognition model, and increasing the recognition accuracy of the target re-recognition model in various scenarios.

[0012] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

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

[0014] Figure 1 This is one of the flowcharts illustrating the image recognition method provided in the embodiments of this application; Figure 2 This is a second schematic flowchart of the image recognition method provided in the embodiments of this application; Figure 3 This is an application diagram illustrating the clustering process provided in the embodiments of this application; Figure 4 This is the third flowchart illustrating the image recognition method provided in the embodiments of this application; Figure 5 This is a schematic diagram of the query atlas and the atlas to be queried provided in the embodiments of this application; Figure 6 This is a schematic diagram of the structure of the image recognition device provided in the embodiments of this application; Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0015] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0016] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0017] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0018] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0019] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0020] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0021] Object re-identification models are commonly used to identify specific people, vehicles, etc., in various scenarios such as cross-camera, cross-scene, and cross-viewpoint situations. They are widely used in fields such as intelligent security, intelligent retrieval, intelligent transportation, object tracking, and people search. Generally, supervised training is required using a large amount of labeled training datasets in specific scenarios to enable the object re-identification model to learn its object re-identification capabilities.

[0022] However, the above methods are costly to obtain training datasets through manual annotation, and the target re-identification models obtained through training can only perform target re-identification processing in specific scenarios, with poor generalization and difficulty in applying them to other dynamic scenarios, which affects the recognition accuracy of the target re-identification models.

[0023] To address the aforementioned issues, this application provides an image recognition method, apparatus, and electronic device. The method involves acquiring a training dataset comprising multiple image clusters, determining clustered image clusters based on the training dataset, and iteratively training a re-recognition model to obtain the t-th re-recognition model. Based on a test dataset, a first average precision mean of the t-th re-recognition model corresponding to the training iterations t is determined. If the first average precision mean does not reach a preset condition, the training iterations t are incremented by one, and the process returns to determining the clustered image clusters based on the training dataset, iteratively training the re-recognition model based on the clustered image clusters, and obtaining the t-th re-recognition model and subsequent steps. When the first average precision mean reaches a preset condition, the corresponding t-th re-recognition model is determined as the target re-recognition model. At least two images to be recognized are input into the target re-recognition model to obtain the target re-recognition result, thereby determining whether the objects in each image are the same. Based on an unlabeled training dataset, the re-recognition model achieves autonomous enhancement and self-iterative learning, reducing learning costs while enabling the model to perform target re-recognition processing in various dynamic scenarios, improving the generalization ability of the target re-recognition model, and increasing the recognition accuracy of the target re-recognition model in various scenarios.

[0024] It should be noted that the image recognition method, apparatus and electronic equipment provided in this application can be used in the fields of target re-identification and target tracking, and the application fields of the image recognition method, apparatus and electronic equipment are not limited in this application.

[0025] The aforementioned electronic device is used to indicate a device that supports image recognition functionality. This application embodiment does not impose any special restrictions on the specific type of the electronic device.

[0026] Figure 1 This is one of the flowcharts illustrating the image recognition method provided in an embodiment of this application. Figure 1 As shown, the image recognition method provided in this application includes the following steps: S101. Obtain the training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object.

[0027] In the application, a training dataset consisting of multiple image clusters is obtained. Each image cluster includes at least one first image containing the same object (also referred to as ID). The first images within each cluster are unlabeled (or unassigned), and the objects included in different clusters may be the same or different. The term "same object" refers to the same instance, not the same object category. For example, the same object could be person A, person B, or vehicle C.

[0028] For example, the training dataset includes 5 image clusters. Image cluster 1 includes multiple first image data containing person 'a', image cluster 2 includes multiple first image data containing vehicle 'c', image cluster 3 includes multiple first image data containing person 'b', image cluster 4 includes multiple first image data containing vehicle 'c', and image cluster 5 includes multiple first image data containing person 'a'.

[0029] For example, an image cluster can also be a set generated based on clustering processing.

[0030] As an example rather than a limitation, image clusters can also provide supervisory information by temporally associating the same objects based on trajectory image data.

[0031] The execution subject of this application embodiment can be an electronic device or an image recognition device installed in an electronic device. The image recognition device can be implemented by software or by a combination of software and hardware.

[0032] S102. Determine the clustered image clusters based on the training dataset, and iteratively train the re-identification model based on the clustered image clusters to obtain the t-th re-identification model; wherein, the initial value of the training number t is one.

[0033] In the application, during each iteration of training, the training dataset is clustered to determine multiple corresponding merged image clusters (e.g., the first merged image cluster, the second merged image cluster), resulting in a clustered image cluster set (e.g., the first image cluster set, the second image cluster set). The re-recognition model is then iteratively trained based on the clustered image cluster set to obtain the t-th re-recognition model corresponding to the t-th iteration. The initial value of the training iteration t is one.

[0034] It is understandable that in each iteration of training, the re-identification model used is the re-identification model obtained from the previous round of training. This can also be understood as the (t-1)th re-identification model corresponding to the training number t-1 (or the (t-1)th iteration of training). When the current training process is the first round of iteration (i.e., t=1), the original re-identification model can be used.

[0035] As an example, and not a limitation, the threshold can be different for each clustering process. This can improve the quality of the data used to train the model, thereby improving the performance of the model obtained through training.

[0036] Based on an unlabeled open training dataset, an unsupervised target re-identification model is trained, enabling the model to autonomously enhance and iteratively learn, thereby improving the model's performance and the accuracy of the re-identification results.

[0037] like Figure 2 As shown, in some embodiments, S102 includes the following steps: S1021. Based on the re-identification model, the training dataset is clustered to obtain a first image cluster set; wherein, the first image cluster set includes at least one first merged image cluster; each first merged image cluster includes at least one image cluster.

[0038] In the application, each first image data in the training dataset is input into the re-identification model for processing to obtain the feature data of each first image data. Then, clustering is performed based on the feature data of each first image data to obtain at least one first merged image cluster, thus determining the first image cluster set.

[0039] Understandably, during the clustering process, at least one image cluster containing the same object will be merged (also known as aggregation), and the merged image clusters will be defined as the first merged image clusters. In other words, each first merged image cluster includes at least one image cluster. This ensures that each first merged image cluster contains second image data containing the same object.

[0040] The image data contained in each first merged image cluster in the first image cluster set is the second image data; the second image data is derived from each first image data in the training dataset, and the number of second image data in the first image cluster set is less than or equal to the number of first image data in the training dataset.

[0041] It is understandable that during the first clustering process, there may be a situation where an image cluster contains objects that are different from any other image cluster, and therefore cannot be clustered. Therefore, it is assumed that this image cluster will not participate in the second clustering process or subsequent operations during this round of iterative training.

[0042] Taking a training dataset consisting of five image clusters as an example, after the first clustering process, image clusters one and five are identified as the first merged image cluster containing the same object (i.e., person a), and image clusters two and four are identified as the first merged image cluster containing the same object (i.e., vehicle c). The object in image cluster three (i.e., person b) is different from those in image clusters one, two, four, and five, and therefore cannot be clustered. Thus, image cluster three will not participate in the second clustering process or subsequent operations during this iteration of training.

[0043] S1022. Perform clustering processing on the first image cluster to obtain the second image cluster.

[0044] In the application, based on the feature data of each second image data, the first image cluster is subjected to a second clustering process to obtain at least one second merged image cluster, which is determined as the second image cluster.

[0045] It is understandable that the second image cluster set obtained by performing a second clustering process on each first merged image cluster includes a second merged image cluster consisting of at least one first merged image cluster that has been successfully merged, or it may include a second merged image cluster consisting of a single first merged image cluster that has not been successfully merged.

[0046] like Figure 3 As shown, the training dataset 301 includes image clusters T1, T2...T11, and each image cluster includes at least one first image data containing the same object arranged in chronological order.

[0047] After performing the first clustering process on the training dataset 301, a first image cluster set 302 is obtained. This first image cluster set 302 includes a first merged image cluster 3021 (composed of image clusters T1 and T2), a first merged image cluster 3022 (composed of image clusters T3 and T4), a first merged image cluster 3023 (composed of image clusters T5 and T6), a first merged image cluster 3024 (composed of image clusters T7 and T8), and a first merged image cluster 3025 (composed of image clusters T9 and T10). Each first merged image cluster includes at least one image cluster, and each image cluster includes at least one second image data containing the same object. Among them, image cluster T11 contains objects that are different from those in the other image clusters and cannot be aggregated. Therefore, it does not participate in the second clustering and subsequent operations during this round of iterative training.

[0048] After performing a second clustering process on the first image cluster 302, a second image cluster 303 is obtained. The second image cluster 303 includes a second merged image cluster 3031 (composed of the first merged image cluster 3021 and the first merged image cluster 3022), a second merged image cluster 3032 (including the first merged image cluster 3023 that failed to merge), a second merged image cluster 3033 (including the first merged image cluster 3024 that failed to merge), and a second merged image cluster 3034 (including the first merged image cluster 3025 that failed to merge).

[0049] S1023. Determine the training sample set based on the second image cluster set; S1024. Select multiple sample data according to the training sample set and train the re-identification model to obtain the trained re-identification model.

[0050] In the application, within each training cycle of the current iteration of training, multiple sample image clusters are determined based on the second image cluster set to obtain a training sample set. Multiple sample data are selected from each sample image cluster in the training sample set and input into the re-identification model for processing to train the re-identification model, update the parameters of the re-identification model, and obtain the re-identification model trained in the current training cycle.

[0051] S1025. If the training period has not reached the target training period, mark the training period by one, and return to execute the steps of selecting multiple sample data according to the training sample set and training the re-identification model and subsequent steps.

[0052] In the application, if the target training period has not been reached in the current training period, the training period is incremented by one. Then, the process returns to select multiple sample data based on the training sample set, train the re-identification model, and proceed with subsequent steps until the target training period is reached at the end of a certain training period, at which point the current round of iterative training ends.

[0053] As an example, and not a limitation, at the beginning of each training iteration, parameters such as the target training period and learning rate are obtained. The target training period in each iteration is the quotient of the total number of samples and the batch size. For example, the total number of samples is M, and the batch size is P. K, then the target training period = M / (P) K).

[0054] S1026. When the training cycle reaches the target training cycle, based on the validation dataset, determine the t-th re-identification model among the re-identification models after training.

[0055] In the application, a validation dataset is obtained. This validation dataset consists of a selected number of initial images from the training dataset, labeled accordingly. The validation dataset is used to evaluate the fit of the re-identification model during the iterative process.

[0056] The validation dataset includes a second query image set and a corresponding second query image set. The second query image set includes at least one second query image data containing the same object. The second query image set includes at least one second query image data containing the same object as the corresponding second query image data. Each second query image data and each second query image data carries a corresponding label.

[0057] It is understood that the operation of "determining the validation dataset based on the training dataset" can be performed after step S101; the embodiments of this application do not specifically limit the execution order of the above-mentioned operations such as "determining the validation dataset based on the training dataset".

[0058] In the application, at the end of each training cycle, the evaluation result of the re-identification model obtained in each training cycle is determined based on the validation dataset. Based on the evaluation results of each training cycle in the current iteration of training, the optimal re-identification model is selected and determined as the t-th re-identification model obtained in the current iteration of training.

[0059] In applications, evaluation results include, but are not limited to, mean accuracy (mAP).

[0060] For example, within the mean average accuracy mAP of each training cycle in the current iteration training process, the re-identification model corresponding to the mean average accuracy mAP with the largest value is determined as the t-th re-identification model obtained in the current iteration training process.

[0061] In some embodiments, S1021 includes the following steps: The first image data in the training dataset is input into the re-identification model for processing to obtain the first feature data of each first image data; Determine the first cosine similarity between every two first feature data.

[0062] In the application, the first image data in the training dataset is input into the re-identification model for processing to obtain the first feature data (or feature vector) of each of the first image data, and the first cosine similarity between each pair of first feature data is calculated.

[0063] Based on the first cosine similarity and the first preset threshold, the first image data are clustered to obtain the first image cluster set.

[0064] In the application, a pre-set first preset threshold is obtained. Based on the first preset threshold and each first cosine similarity, each first image data in the training dataset is clustered to obtain at least one first merged image cluster, thereby determining the first image cluster set.

[0065] For example, when the first cosine similarity is greater than or equal to a first preset threshold, it is determined that the two first image data corresponding to the first cosine similarity contain the same object. When the two first image data come from different image clusters, the two image clusters are aggregated to obtain the corresponding first merged image cluster. By analogy, all first image data containing the same object in the training dataset are clustered to obtain at least one first merged image cluster, thereby determining the first image cluster set.

[0066] The first preset threshold can be specifically set according to the actual situation, for example, it can be set to 0.9 or 0.95. Alternatively, it can be determined by the accuracy calculated from the validation dataset (or evaluation set). For example, the range of cosine similarity is [0, 1]. With a step size of 0.001, the accuracy of the re-identification model (i.e., the re-identification model obtained in the previous round of training) calculated based on the validation dataset is calculated at each cosine similarity value (e.g., 0, 0.001, 0.002, ..., 1). The cosine similarity value corresponding to the first time the accuracy reaches the preset accuracy (e.g., the preset accuracy is 99%) is determined as the first preset threshold. Here, accuracy refers to the proportion of objects with the same ID (or the same instance, the same object) among all sample pairs (i.e., two image data) with similarity exceeding the similarity threshold.

[0067] During iterative training, model performance continuously improves, with precision and recall increasing. In the first clustering process, recall is increased while maintaining the same precision. Image clusters that failed to cluster successfully in the current training round are clustered and incorporated into subsequent training rounds. In the second clustering process, precision is increased while maintaining the same recall. This reduces the possibility of incorrectly aggregating (and thus suppressing) image data containing different objects, effectively preserving more image clusters and improving both data volume and quality. This achieves a virtuous cycle of "data update -> model iteration -> data update," continuously improving data quality and model performance and expressiveness.

[0068] In some embodiments, S1022 includes the following steps: Based on the first cosine similarity and the second preset threshold, each first merged image cluster in the first image cluster set is clustered to obtain a second image cluster set; the second image cluster set includes at least one second merged image cluster; each second merged image cluster includes at least one first merged image cluster; the second preset threshold is less than the first preset threshold.

[0069] In the application, a second preset threshold is determined, which is less than a first preset threshold. Based on the second preset threshold and the first cosine similarity, clustering is performed on each of the first merged image clusters in the first image cluster set to obtain at least one second merged image cluster, thereby determining the second image cluster set.

[0070] For example, when the first cosine similarity is greater than or equal to the second preset threshold, it is determined that the two second image data corresponding to the first cosine similarity contain the same object. When the two second image data come from different first merged image clusters, the two first merged image clusters are aggregated to obtain the corresponding second merged image cluster. By analogy, all second image data containing the same object in the first image cluster set are clustered to obtain at least one second merged image cluster, thereby determining the second image cluster set.

[0071] The recall rate refers to the proportion of sample pairs (i.e., two image data sets) with the same ID whose similarity exceeds a similarity threshold. The second preset threshold can be specifically set according to the actual situation, for example, 0.8 or 0.85. Alternatively, it can be determined by the recall rate calculated from the validation dataset (or evaluation set). For example, with a cosine similarity range of [0, 1], and a step size of 0.001, the recall rate of the re-identification model is calculated based on the validation dataset for each cosine similarity value (e.g., 1, 0.999, ..., 0). The cosine similarity value corresponding to the first time the recall rate reaches the preset recall rate (e.g., the preset recall rate is 80%) is determined as the second preset threshold.

[0072] By determining two thresholds based on precision and recall, the quality of training data is improved, achieving consistency of IDs within each merged image cluster and dissimilarity of IDs between different merged image clusters. This enables the trained model to achieve higher performance. Two clustering processes are applied to the training dataset to perform hierarchical clustering of associated images with the same object, improving the accuracy of the clustering results. Furthermore, during iterative training of the model on the unlabeled training dataset, the model is not trained on image clusters that cannot be clustered, thus improving the model's performance after multiple iterations. Additionally, during iteration, the model parameters are continuously evaluated and optimized based on the validation dataset, thereby continuously improving the model's performance and enhancing its re-identification capability.

[0073] In some embodiments, S1023 includes the following steps: Select one first merged image cluster from each of the second merged image clusters to obtain the training sample set.

[0074] In the application, a first merged image cluster is selected from each of the second merged image clusters to obtain the training sample set.

[0075] Understandably, because the threshold for the second clustering process is relatively small, image data with the same ID may be clustered together, potentially resulting in image data with different IDs being clustered together. Therefore, from the second merged image cluster, a set of images with the same ID obtained through the first clustering process (i.e., the first merged image cluster) is selected to obtain the corresponding training sample set.

[0076] like Figure 4 As shown, in some embodiments, S1024 includes the following steps: S10241. Select multiple sample image clusters in the training sample set, and select multiple second image data from each sample image cluster to determine the sample data.

[0077] In the application, multiple sample image clusters are selected from the training sample set. For each sample image cluster, multiple second image data are selected as sample data, such that the sample data sampled from each sample image cluster includes different objects.

[0078] For example, a first merged image cluster (one first merged image cluster can indicate one ID) is selected from each of the second merged image clusters in the second image cluster set to obtain the corresponding training sample set. In each training cycle, P sample image clusters are selected from the multiple first merged image clusters (i.e., multiple IDs) in the training sample set. K image data are randomly selected from each sample image cluster to be determined as sample data; then the batch size of the sample data in the current training cycle is P. K. For the P selected above K sample data are preprocessed and then used as training data to train the re-identification model, resulting in the re-identification model trained for the current training cycle. The preprocessing methods include, but are not limited to, at least one of scaling, data augmentation, and normalization.

[0079] It is understandable that the number of first merged image clusters selected in the second image cluster set can be determined as the number of the same object (or the same ID) in the training dataset. In each training cycle, multiple sample image clusters are selected from multiple first merged image clusters, and multiple sample data are selected from each sample image cluster. After multiple training cycles, all sample data can be collected for each object (or ID) in the training dataset, and an iterative training process can be performed on the re-identification model.

[0080] The method for selecting the first merged image cluster from the second merged image cluster can be random selection or selection based on preset selection conditions. The preset selection conditions can be selecting the first merged image cluster with the largest number of image data, or selecting the first merged image cluster with the smallest average similarity of feature data between every two second image data. This application embodiment does not limit this.

[0081] See also Figure 3 From the second merged image cluster 3031 in the second image cluster set 303, select a first merged image cluster 3021; ​​select a first merged image cluster 3023 from the second merged image cluster 3032; select a first merged image cluster 3024 from the second merged image cluster 3033; and select a first merged image cluster 3025 from the second merged image cluster 3034 to obtain the training sample set. Figure 3 The first merged image clusters contained in the training sample set are all indicated by bold boxes. In the training sample set (including first merged image clusters 3021, 3023, 3024, and 3025), multiple sample image clusters are selected ( Figure 3 Only two sample image clusters are shown, including the first merged image cluster 3023 and the first merged image cluster 3024 (represented by bold dashed boxes). Multiple sample data are selected from both sample image clusters 3023 and 3024, and the re-identification model is trained to obtain the re-identification model trained in the current training cycle.

[0082] It is understandable that in each iteration, the above steps of "selecting multiple sample image clusters in the training sample set" and subsequent steps can be executed multiple times to complete multiple training cycles until all image data in the training sample set are used as sample data to be input into the re-identification model to complete the training operation, thus determining that the current iteration training process is complete.

[0083] Still with Figure 3 For example, after multiple training cycles, when all image data in the training sample set (including the first merged image cluster 3021, the first merged image cluster 3023, the first merged image cluster 3024, and the first merged image cluster 3025) are input as sample data into the re-identification model to complete the training operation, the current round of iterative training process is determined to be completed.

[0084] In this way, the re-identification model can automatically select training datasets from the data pool through clustering and other processing methods, and perform autonomous iterative training. Two clustering processes are employed: one based on a high threshold to aggregate highly similar clusters, merging clusters; and another based on a low threshold to merge clusters with the same ID. Within each merged image cluster in the resulting set of clusters, only one image cluster is selected, ensuring dissimilarity between the selected clusters, reducing erroneous label information in each round of training data, and improving the data quality of each training round.

[0085] S10242. Input each sample data into the re-identification model for processing to obtain the second feature data of each sample data; S10243. Based on the second feature data and the cluster centers corresponding to the training period, update the parameters of the re-identification model to obtain the trained re-identification model.

[0086] In the application, each sample data in the training sample set is input into the target re-identification model for processing to obtain the second feature data of each sample data. The cluster center corresponding to the current training period is obtained, and the parameters of the re-identification model are updated according to each second feature data and the above cluster center to obtain the re-identification model trained for the current training period.

[0087] In some embodiments, the parameters of the re-identification model are updated based on each second feature data and the cluster centers corresponding to the training period to obtain the trained re-identification model, including the following steps: Based on the second feature data and the cluster centers corresponding to the training period, the loss information is calculated; wherein, the loss information includes at least one of the triplet loss information and the cross-entropy loss information; Based on the loss information, gradient information is determined through backpropagation; the gradient information includes model gradient information and cluster center gradient information. Optimize cluster centers based on cluster center gradient information; Based on the model gradient information, the parameters of the re-identification model are optimized to obtain the trained re-identification model.

[0088] In the application, loss information is calculated based on each second feature data and the cluster centers corresponding to the current training period. This loss information includes, but is not limited to, at least one of triplet loss information and cross-entropy loss information. Backpropagation is performed based on the loss information to determine the model gradient information and cluster center gradient information. The parameters of the re-identification model are optimized based on the model gradient information, and the cluster centers are optimized based on the cluster center gradient information, resulting in the re-identification model trained for the current training period.

[0089] For example, the sample data determined based on the training dataset is input into the re-identification model for processing to obtain the second feature data output by the re-identification model. Based on each second feature data, the object label information in the sample data, and the cluster center of each ID, triplet loss information and cross-entropy loss information are calculated. Then, the gradient information of the model and the gradient information of the cluster centers are calculated through backpropagation. The optimizer optimizes the model based on the gradient information and optimizes the corresponding cluster centers based on the gradient information of the cluster centers, completing the training for the current cycle.

[0090] As an example, and not a limitation, when the current training period is one, the average value of each second feature data is used as the initial cluster center. Based on the second feature data and the initial cluster centers, the corresponding loss information is calculated to optimize the model parameters and the initial cluster centers. For example, the second feature data of each sample data is summed, normalized using the L2 norm, and the average value of the second feature data of multiple samples is obtained and determined as the initial cluster center. When the current training period is longer than one, the optimized cluster centers from the previous training period are used as the cluster centers for the current period.

[0091] It is understandable that the number of IDs may vary in each training round. By using average feature data to construct the initial cluster centers, the need to retrain the cluster centers at the end of each training round is avoided.

[0092] For example, the learning rate can be adjusted after each training cycle, and the model's precision, recall, and other parameters can be evaluated based on the validation dataset until the preset training cycle is reached.

[0093] In some embodiments, during the first round of training, when training the original re-identification model, the cluster centers are randomly initialized.

[0094] S103. Based on the test dataset, determine the first average precision mean of the t-th re-identification model corresponding to the training number t.

[0095] In the application, at the end of each round of iterative training, the mean first average precision of the t-th re-identification model is calculated based on the test dataset.

[0096] Understandably, when training a re-identification model based on noisy raw training data, the resulting model will perform poorly. However, by evaluating and optimizing the model using validation and test datasets, the performance and expressiveness of the re-identification model during iterative training can be improved.

[0097] S104. When the mean of the first average precision of the t-th re-identification model does not reach the preset condition, increment the training number t by one, return to execute the process of determining the clustered image clusters based on the training dataset, and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps.

[0098] In the application, if the mean first accuracy of the t-th re-identification model corresponding to the current training iteration t does not reach the preset condition, the training iteration t is incremented by one. The process then returns to the previous step, determining the clustered image set based on the training dataset, and training the re-identification model based on the clustered image set to obtain the t-th re-identification model and subsequent steps, until the mean first accuracy of the t-th re-identification model corresponding to the training iteration t reaches the preset condition.

[0099] S105. When the mean of the first average accuracy of the t-th re-identification model reaches the preset condition, the t-th re-identification model is determined as the target re-identification model.

[0100] In application, when the average precision of the t-th re-identification model corresponding to the current training iteration t reaches a preset condition, the t-th re-identification model corresponding to the current training iteration t is determined as the target re-identification model. The training dataset, test dataset, validation dataset, and model weights corresponding to the training iteration t are then saved. The preset condition can be specifically set according to the actual situation.

[0101] For example, the preset condition could be: the first average precision is greater than a preset average threshold. For instance, the preset average threshold could be 90% or 95%.

[0102] For example, the preset condition can be: the difference between the first average precision mean and the second average precision mean of the previous round is less than a preset difference threshold. The preset difference threshold can be specifically set according to the actual situation, for example, the preset difference threshold is 0.1 or 0.05.

[0103] The following text mainly uses the example of a preset condition where the difference between the first average precision value and the second average precision value of the previous round is less than a preset difference threshold, and does not constitute a limitation on the preset condition.

[0104] In some embodiments, S103 includes the following steps: Obtain a test dataset; wherein the test dataset includes a first query image set and a corresponding first query image set; the first query image set includes at least one first query image data containing the same object; the first query image set includes at least one first query image data containing the same object; each first query image data and each first query image data carries a corresponding object label.

[0105] In the application, a test dataset is obtained, which includes a first query image set and a corresponding first query image set. The first query image set includes at least one query image data containing the same object. The first query image set includes at least one query image data containing the same object. The test dataset is used to evaluate the real performance and generalization ability of the re-identification model. Here, query image data refers to image data of a specific object, and corresponding query image data refers to image data containing the aforementioned object.

[0106] As an example, and not a limitation, labels may include unique identifiers of objects (i.e., ID tags). Each tag carried by the query image data must appear at least once in the corresponding first query image set.

[0107] like Figure 5 As shown, the first query image data 501 is the image data of vehicle c, which carries the tag "ID001". The corresponding first query image data 502 contains vehicle c (e.g., ...). Figure 5 The image data (shown in image 5021) also carries the "ID001" tag.

[0108] As an example rather than a limitation, the test dataset and the training dataset are datasets collected in different scenarios and have domain bias. In this way, the mean accuracy calculated based on the test dataset can better evaluate the performance of the t-th re-identification model in scene transfer, making its re-identification results closer to the results in real-world scenarios.

[0109] The test dataset is input into the t-th re-identification model for processing to obtain the third feature data of each first query image data and the fourth feature data of each first query image data.

[0110] In the application, each first query image data and each first query image data in the test dataset are input into the t-th re-identification model for processing to obtain the third feature data of each first query image data and the fourth feature data of each first query image data.

[0111] Determine the second cosine similarity between each third feature data and its corresponding fourth feature data.

[0112] In the application, the third feature data of each first query image data is calculated, and the second cosine similarity between it and the fourth feature data of the corresponding first query image data is calculated.

[0113] Based on each second cosine similarity, the mean of the first average precision of the t-th recognition model is determined.

[0114] In application, the mean first accuracy of the t-th recognition model is calculated based on each second cosine similarity.

[0115] For example, the second cosine similarity scores are sorted in descending order to obtain the search sequence corresponding to the query image data. The AP value is calculated based on the position of the query image data with the same ID in the sorted sequence. For instance, if there are four query images with the same ID, ranked 1st, 3rd, 4th, and 7th in the sequence, then AP = (1 / 1 + 2 / 3 + 3 / 4 + 4 / 7) / 4; that is, the numerator ranges from 1 to 4, and the denominator is the number of positions in the sequence. The sum of each score is calculated and the average is taken to obtain the corresponding AP value. The average of the AP values ​​of all query image data is the first mean precision mean, mAP.

[0116] In some embodiments, S105 includes the following steps: Determine the mean of the second average precision of the model for the (t-1)th re-identification corresponding to the training number t-1.

[0117] In the application, based on the test dataset, the mean second average precision of the recognition model corresponding to the (t-1)th re-identification model in the previous round (i.e., the number of training times t-1) is calculated.

[0118] Determine the difference between the first average precision mean and the second average precision mean; When the difference is less than the preset difference threshold, the t-th re-identification model is determined as the target re-identification model.

[0119] In application, the difference between the first average precision of the current round and the second average precision of the previous round is calculated. When the difference is less than a preset difference threshold, the t-th re-identification model corresponding to the current round (i.e., the number of training times t) is determined as the target re-identification model.

[0120] It is understandable that when the above difference is greater than or equal to the preset difference threshold, it is determined that the first average precision of the t-th re-identification model has not reached the preset condition. At this time, the process should return to determine the clustered image clusters based on the training dataset, and train the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps.

[0121] S106. Input at least two images to be identified into the target re-identification model to obtain the target re-identification result output by the target re-identification model; the target re-identification result is used to indicate whether the objects in each image to be identified are the same.

[0122] In the application, at least two images to be identified are input into the target re-identification model to obtain the target re-identification result output by the model. The target re-identification result is used to indicate whether the objects in the images to be identified are the same.

[0123] It is understandable that the target re-identification model outputs the target re-identification result as the feature data of each image data to be identified. The cosine similarity between the feature data of each image data to be identified can be calculated. Based on the relationship between the cosine similarity and a preset cosine similarity threshold, it is determined whether the objects in each image data are the same. The larger the cosine similarity, the greater the probability that the objects in each image data are the same.

[0124] As an example and not a limitation, the preset cosine similarity threshold can be specifically set according to the category of the object in the image data to be identified. For example, when the object in the image data to be identified is a person, the preset cosine similarity threshold is set to 0.7; when the object in the image data to be identified is a vehicle, the preset cosine similarity threshold is set to 0.75.

[0125] The image recognition method provided in this application obtains a training dataset including multiple image clusters, determines clustered image clusters based on the training dataset, and iteratively trains the re-recognition model to obtain the t-th re-recognition model. Based on the test dataset, the first average precision mean of the t-th re-recognition model corresponding to the training number t is determined. If the first average precision mean does not reach a preset condition, the training number t is incremented by one, and the process returns to determine the clustered image clusters based on the training dataset, iteratively trains the re-recognition model based on the clustered image clusters, and obtains the t-th re-recognition model and subsequent steps. When the first average precision mean reaches a preset condition, the corresponding t-th re-recognition model is determined as the target re-recognition model; at least two images to be recognized are input into the target re-recognition model to obtain the target re-recognition result, thereby determining whether the objects in each image are the same. Based on an unlabeled training dataset, the re-recognition model achieves autonomous enhancement and self-iterative learning, reducing learning costs while enabling the model to perform target re-recognition processing in various dynamic scenarios, improving the generalization ability of the target re-recognition model, and increasing the recognition accuracy of the target re-recognition model in various scenarios.

[0126] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0127] This application also provides an image recognition device for performing the steps described in the method embodiments above. The image recognition device can be a virtual appliance within an electronic device, run by the electronic device's processor, or it can be the electronic device itself. Figure 6 As shown, the image recognition device 600 provided in this application embodiment includes: The data acquisition module 601 is used to acquire the training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object; The training module 602 is used to determine the clustered image clusters based on the training dataset, and to iteratively train the re-recognition model based on the clustered image clusters to obtain the t-th re-recognition model; wherein, the initial value of the training number t is one; The mean determination module 603 is used to determine the first average precision mean of the t-th re-identification model corresponding to the number of training times t, based on the test dataset. The loop module 604 is used to increment the training count t by one when the mean of the first average precision of the t-th re-identification model does not reach the preset condition, and return to execute the steps of determining the clustered image clusters based on the training dataset and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps. The model determination module 605 is used to determine the t-th re-identification model as the target re-identification model when the mean of the first average accuracy of the t-th re-identification model reaches a preset condition. The recognition module 606 is used to input at least two image data to be recognized into the target re-recognition model to obtain the target re-recognition result output by the target re-recognition model; the target re-recognition result is used to indicate whether the objects in each image data to be recognized are the same.

[0128] In some embodiments, the training module includes: The first processing unit is used to perform clustering processing on the training dataset based on the re-identification model to obtain a first image cluster set; wherein the first image cluster set includes at least one first merged image cluster; each first merged image cluster includes at least one image cluster. The second processing unit is used to perform clustering processing on the first image cluster to obtain a second image cluster. The sample determination unit is used to determine the training sample set based on the second image cluster set; The training unit is used to select multiple sample data based on the training sample set and train the re-identification model to obtain the trained re-identification model. The loop unit is used to increment the training period by one when the target training period has not been reached, and then return to execute the steps of selecting multiple sample data according to the training sample set and training the re-identification model and subsequent steps. The first determining unit is used to determine the t-th re-identification model among the re-identification models after training, based on the validation dataset, when the training cycle reaches the target training cycle.

[0129] In some embodiments, the first processing unit is specifically used for: The first image data in the training dataset is input into the re-identification model for processing to obtain the first feature data of each first image data; Determine the first cosine similarity between every two first feature data; Based on the first cosine similarity and the first preset threshold, the first image data are clustered to obtain the first image cluster set.

[0130] In some embodiments, the second processing unit is specifically used for: Based on the first cosine similarity and the second preset threshold, each first merged image cluster in the first image cluster set is clustered to obtain a second image cluster set; the second image cluster set includes at least one second merged image cluster; each second merged image cluster includes at least one first merged image cluster; the second preset threshold is less than the first preset threshold.

[0131] In some embodiments, the sample determination unit includes: Select one first merged image cluster from each second merged image cluster to obtain the training sample set; Training units include: Determine a sub-unit, which is used to select multiple sample image clusters in the training sample set, and select multiple second image data in each sample image cluster to determine as sample data; The processing subunit is used to input each sample data into the re-identification model for processing, and to obtain the second feature data of each sample data. The training subunit is used to update the parameters of the re-identification model based on each second feature data and the cluster center corresponding to the training period, so as to obtain the trained re-identification model.

[0132] In some embodiments, the training subunit is specifically used for: Based on the second feature data and the cluster centers corresponding to the training period, the loss information is calculated; wherein, the loss information includes at least one of the triplet loss information and the cross-entropy loss information; Based on the loss information, gradient information is determined through backpropagation; the gradient information includes model gradient information and cluster center gradient information. Optimize cluster centers based on cluster center gradient information; Based on the model gradient information, the parameters of the re-identification model are optimized to obtain the trained re-identification model.

[0133] In some embodiments, the mean determination module is specifically used for: Obtain a test dataset; wherein, the test dataset includes a first query image set and a corresponding first query image set; the first query image set includes at least one first query image data containing the same object; the first query image set includes at least one first query image data containing the same object; each first query image data and each first query image data carries a corresponding object label; The test dataset is input into the t-th re-identification model for processing to obtain the third feature data of each first query image data and the fourth feature data of each first query image data; Determine the second cosine similarity between each third feature data and its corresponding fourth feature data; Based on each second cosine similarity, the mean of the first average precision of the t-th recognition model is determined.

[0134] In some embodiments, the model determination module is specifically used for: Determine the mean second average precision of the model for the (t-1)th re-identification corresponding to the training number t-1; Determine the difference between the first average precision mean and the second average precision mean; When the difference is less than the preset difference threshold, the t-th re-identification model is determined as the target re-identification model.

[0135] The image recognition device provided in this application embodiment can be used to execute the technical solution of the image recognition method in the above embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0136] In applications, the modules in an image recognition device can be software program modules, or they can be implemented through different logic circuits integrated in a processor, or they can be implemented through multiple distributed processors.

[0137] Corresponding to the image recognition method provided above, this application also provides an electronic device with image recognition functionality, such as... Figure 7 As shown, the electronic device 700 includes: at least one processor 701 ( Figure 7 Only one processor is shown in the diagram, along with memory 702 and a computer program 703 stored in memory 702 and executable on at least one processor 701. When processor 701 executes computer program 703, it performs the following steps: Obtain the training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object; The clustered image clusters are determined based on the training dataset, and the re-identification model is iteratively trained based on the clustered image clusters to obtain the t-th re-identification model; where the initial value of the training number t is one; Based on the test dataset, determine the first average precision of the t-th re-identification model corresponding to the training number t; When the mean of the first average accuracy of the t-th re-identification model does not reach the preset condition, the training number t is incremented by one, and the process returns to determine the clustered image clusters based on the training dataset, and iteratively trains the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps. When the mean of the first average accuracy of the t-th re-identification model reaches the preset condition, the t-th re-identification model is determined as the target re-identification model; Input at least two image data to be identified into the target re-identification model to obtain the target re-identification result output by the target re-identification model; the target re-identification result is used to indicate whether the objects in each image data are the same.

[0138] In the application, electronic device 700 may include, but is not limited to, processors and memory. Those skilled in the art will understand that... Figure 7 This is merely an example of electronic device 700 and does not constitute a limitation on electronic device 700. It may include more or fewer components than shown, or combine certain components, or different components; for example, it may also include input / output devices, network access devices, etc.

[0139] In applications, the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0140] In applications, the memory may be an internal storage unit of the electronic device 700 in some embodiments, such as a hard disk or RAM of the electronic device 700. In other embodiments, the memory may be an external storage device of the electronic device 700, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., provided by the electronic device 700. Furthermore, the memory may include both internal storage units and external storage devices of the electronic device 700. The memory is used to store operating systems, applications, boot loaders, data, and other programs, such as program code for computer programs. The memory can also be used to temporarily store data that has been output or will be output.

[0141] It should be noted that the information interaction and execution process between the above-mentioned devices / modules are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0142] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The functional modules in the embodiments can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules can be implemented in hardware or as software functional modules. Furthermore, the specific names of the functional modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the modules in the above-described device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0143] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps described in the various method embodiments above.

[0144] This application provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.

[0145] If an integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, 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 computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / electronic device, a recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0146] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0147] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0148] In the embodiments provided in this application, it should be understood that the disclosed apparatus / device and method can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.

[0149] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0150] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An image recognition method, characterized in that, include: Obtain a training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object; The clustered image clusters are determined based on the training dataset, and the re-recognition model is iteratively trained based on the clustered image clusters to obtain the t-th re-recognition model; wherein, the initial value of the training number t is one; Based on the test dataset, determine the first average precision mean of the t-th re-identification model corresponding to the training number t; When the mean of the first average accuracy of the t-th re-identification model does not reach the preset condition, the training number t is incremented by one, and the process returns to the step of determining the clustered image clusters based on the training dataset, and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps. When the mean of the first average accuracy of the t-th re-identification model reaches a preset condition, the t-th re-identification model is determined to be the target re-identification model; At least two image data to be identified are input into the target re-identification model to obtain the target re-identification result output by the target re-identification model; the target re-identification result is used to indicate whether the objects in each of the image data to be identified are the same.

2. The image recognition method as described in claim 1, characterized in that, The step of determining clustered image clusters based on the training dataset and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model includes: Based on the re-identification model, the training dataset is clustered to obtain a first image cluster set; wherein, the first image cluster set includes at least one first merged image cluster; each first merged image cluster includes at least one image cluster; The first image cluster is clustered to obtain the second image cluster; Based on the second image cluster set, a training sample set is determined; Multiple sample data are selected based on the training sample set, and the re-identification model is trained to obtain the trained re-identification model. If the training period has not reached the target training period, increment the training period by one, and return to the steps of selecting multiple sample data according to the training sample set and training the re-identification model and subsequent steps. When the training cycle reaches the target training cycle, the t-th re-identification model is determined from each of the trained re-identification models based on the validation dataset.

3. The image recognition method as described in claim 2, characterized in that, The process of clustering the training dataset based on the re-identification model to obtain a first image cluster set includes: Each of the first image data in the training dataset is input into the re-identification model for processing to obtain the first feature data of each of the first image data; Determine the first cosine similarity between every two of the first feature data; Based on the first cosine similarity and the first preset threshold, clustering is performed on each of the first image data to obtain the first image cluster set.

4. The image recognition method as described in claim 3, characterized in that, The process of clustering the first image cluster to obtain the second image cluster includes: Based on the first cosine similarity and the second preset threshold, each of the first merged image clusters in the first image cluster set is clustered to obtain a second image cluster set; the second image cluster set includes at least one second merged image cluster; each second merged image cluster includes at least one first merged image cluster; the second preset threshold is less than the first preset threshold.

5. The image recognition method as described in claim 4, characterized in that, The step of determining the training sample set based on the second image cluster set includes: Select a first merged image cluster from each of the second merged image clusters to obtain the training sample set; The step of selecting multiple sample data based on the training sample set and training the re-identification model to obtain the trained re-identification model includes: In the training sample set, multiple sample image clusters are selected, and in each sample image cluster, multiple second image data are selected to be determined as sample data. Each of the sample data is input into the re-identification model for processing to obtain the second feature data of each of the sample data; Based on each of the second feature data and the cluster centers corresponding to the training period, the parameters of the re-identification model are updated to obtain the trained re-identification model.

6. The image recognition method as described in claim 5, characterized in that, The step of updating the parameters of the re-identification model based on each of the second feature data and the cluster centers corresponding to the training period to obtain the trained re-identification model includes: Based on each of the second feature data and the cluster centers corresponding to the training period, loss information is calculated; wherein, the loss information includes at least one of triplet loss information and cross-entropy loss information; Based on the loss information, gradient information is determined through backpropagation; wherein, the gradient information includes model gradient information and cluster center gradient information; Based on the cluster center gradient information, optimize the cluster centers; Based on the model gradient information, the parameters of the re-identification model are optimized to obtain the trained re-identification model.

7. The image recognition method according to any one of claims 1 to 6, characterized in that, The step of determining the first average precision mean of the t-th re-recognition model corresponding to the training number t based on the test dataset includes: Obtain a test dataset; wherein the test dataset includes a first query image set and a corresponding first query image set; the first query image set includes at least one first query image data containing the same object; the first query image set includes at least one first query image data containing the same object; each first query image data and each first query image data carries a corresponding object label. The test dataset is input into the t-th re-identification model for processing to obtain the third feature data of each of the first query image data and the fourth feature data of each of the first query image data. Determine the second cosine similarity between each of the third feature data and the corresponding fourth feature data; Based on each of the second cosine similarities, the first average precision mean of the t-th re-identification model is determined.

8. The image recognition method according to any one of claims 1 to 6, characterized in that, The step of determining the t-th re-identification model as the target re-identification model when the mean of the first average accuracy of the t-th re-identification model reaches a preset condition includes: Determine the mean second average precision of the model for the (t-1)th re-identification corresponding to the training number t-1; Determine the difference between the first average precision mean and the second average precision mean; When the difference is less than a preset difference threshold, the t-th re-identification model is determined as the target re-identification model.

9. An image recognition device, characterized in that, include: A data acquisition module is used to acquire a training dataset; wherein the training dataset includes multiple image clusters, and each image cluster includes at least one first image data containing the same object; The training module is used to determine the clustered image clusters based on the training dataset, and to iteratively train the re-recognition model based on the clustered image clusters to obtain the t-th re-recognition model; wherein the initial value of the training number t is one; The mean determination module is used to determine the first average precision mean of the t-th re-identification model corresponding to the training number t based on the test dataset; The loop module is used to increment the training number t by one when the mean of the first average precision of the t-th re-identification model does not reach the preset condition, and return to execute the steps of determining the clustered image clusters based on the training dataset, and iteratively training the re-identification model based on the clustered image clusters to obtain the t-th re-identification model and subsequent steps. The model determination module is used to determine the t-th re-identification model as the target re-identification model when the mean of the first average accuracy of the t-th re-identification model reaches a preset condition; The recognition module is used to input at least two images to be recognized into the target re-recognition model to obtain the target re-recognition result output by the target re-recognition model; the target re-recognition result is used to indicate whether the objects in each of the images to be recognized are the same.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the image recognition method according to any one of claims 1 to 8.