A method and device for generating vehicle re-identification data set based on diffusion model

Through a cross-modal generation method based on diffusion model, only a small number of unlabeled images are used to generate the vehicle re-identification data set, which solves the dependence on real data and manual annotation in the prior art, and improves data quality and model performance.

CN119649320BActive Publication Date: 2025-04-25ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510175539.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-04-25
Estimated Expiration
2045-02-18

AI Technical Summary

Technical Problem

The existing vehicle re-identification virtual data set generation methods rely on a large amount of real data and manual annotations, and the quality, paradigm and diversity of generated data are limited, so it cannot effectively reduce the dependence on real data and manual annotations.

Method used

A cross-modal generation method from coarse to fine based on diffusion model is adopted, using only 1% of the unlabeled images in the original dataset, and a synthetic vehicle re-identification dataset for specific downstream scenarios is generated by iteratively optimizing the prompt word template and fine-tuning the diffusion model.

Benefits of technology

It significantly narrows the gap between synthetic data and real data, improves the performance of vehicle re-identification models, reduces the dependence on real data and manual annotation, and the generated data has application potential in the fields of privacy protection and intelligent transportation systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649320B_ABST
    Figure CN119649320B_ABST
Patent Text Reader

Abstract

The method and device for generating a vehicle re-identification dataset based on a diffusion model provided by the present invention belong to the technical field of vehicle re-identification. The method includes constructing a prompt word template based on vehicle attributes and iteratively optimizing it; taking an unlabeled image of real vehicle re-identification as input, using a pre-trained multimodal image description model to predict the image-text pair of the unlabeled vehicle, and fine-tuning the diffusion model; based on the optimized prompt word template and the fine-tuned diffusion model, combined with target detection and semantic filtering for optimization, constructing a vehicle re-identification dataset generation model, and generating a vehicle re-identification dataset. The method of the present invention can achieve better results on the downstream vehicle re-identification dataset than the existing virtual dataset generation method, and the number of real data required by the generation method is only 1% of the data required by the existing method, and the real data does not need to be labeled, which is beneficial to privacy protection and reducing data labeling overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of vehicle re-identification, and in particular to a method and device for generating a vehicle re-identification data set based on a diffusion model. Background Art

[0002] Vehicle re-identification is a key technology in the field of computer vision and intelligent transportation systems. Its main goal is to accurately identify the same vehicle from different perspectives or scenes captured by different cameras. This technology is widely used in vehicle tracking, traffic monitoring, road safety and other fields.

[0003] In recent years, the rapid development of deep learning technology has provided strong technical support for vehicle re-identification tasks. The performance of deep learning models is highly dependent on large-scale, high-quality, and diverse training datasets. However, in actual situations, building a large-scale real training dataset for vehicle re-identification models faces the following challenges: 1. Data privacy and legal compliance: The actual collected vehicle data usually contains sensitive information, such as license plate numbers or the privacy of specific vehicles, and may face restrictions on privacy protection and legal supervision; 2. High data collection cost: Collecting large-scale vehicle images in a multi-camera network requires deploying a large number of devices at different locations, which is time-consuming and expensive; 3. Complex data annotation: The vehicle re-identification task requires assigning a unique identifier to each vehicle, which requires accurate annotation of a large amount of image data. This annotation process is not only labor-intensive, but also prone to introducing noise or errors. In order to solve the above problems, the generation of virtual training datasets has become an important alternative.

[0004] Existing methods for generating virtual datasets for vehicle re-ID can be mainly divided into two types: game engine-based methods and generative adversarial network-based methods.

[0005] For example, the game engine-based method disclosed in conference paper 1 (Simulating Content Consistent Vehicle Datasets with Attribute Descent, 2020, European Conference on Computer Vision (ECCV), 775-791) imports a 3D car model into the game engine, and then exports vehicle image data from the virtual environment for model training. However, the existing methods for generating vehicle re-identification datasets based on game engines have the following main problems: first, there is a large domain difference between the virtual scene generated using the 3D model and the real scene; second, the production process of the 3D car model used in this type of method consumes a lot of manpower and time costs; in addition, the process of generating virtual data using this type of method requires the use of a large amount of annotated real data to guide the adjustment of the engine parameters to reduce the domain difference between the generated data and the real data.

[0006] Therefore, the use of a large amount of real data that has been labeled in this process goes against the original intention of introducing and using virtual data, that is, it does not reduce the dependence on real data and manual labeling.

[0007] For example, conference paper 2 (Vehicle View Synthesis by Generative Adversarial Network, 2023, IEEE International Conference on Acoustics, Speech and Signal Processing, 1-5) and conference paper 3 (VehicleGAN: Pair-flexible Pose Guided Image Synthesis for Vehicle Re-identification, 2024, IEEE Intelligent Vehicles Symposium (IV), 447-453) disclose methods based on generative adversarial networks, which use generative adversarial networks to learn to generate new perspectives from existing vehicle re-identification datasets. However, such methods have the following main problems: First, such methods rely on a large, annotated real vehicle re-identification dataset to train a generative adversarial network that generates new perspectives, and also do not reduce the use of real data and manual annotations. In addition, the data quality, data paradigm, and data diversity of vehicle re-identification data generated using such methods are often limited by the original real datasets.

[0008] Therefore, the existing vehicle re-ID dataset generation technology still needs to be further improved and developed to reduce the dependence on real data and manual annotation, while achieving more realistic and higher quality image output. Summary of the invention

[0009] The purpose of the present invention is to provide a method and device for generating a vehicle re-identification dataset based on a diffusion model. Through a coarse-to-fine cross-modal generation method based on a diffusion model, a synthetic vehicle re-identification dataset for a specific downstream scenario is produced by using only 1% of the unlabeled images in the original dataset.

[0010] To achieve the above-mentioned object of the invention, an embodiment provides a method for generating a vehicle re-identification dataset based on a diffusion model, comprising the following steps:

[0011] Building a prompt word template based on vehicle attributes, and iteratively optimizing the prompt word template based on a diffusion model to obtain an optimized prompt word template;

[0012] Taking real vehicle re-identification unlabeled images as input, the pre-trained multimodal image description model is used to predict the image-text pairs of unlabeled vehicles, and the diffusion model is fine-tuned based on the image-text pairs;

[0013] Based on several optimized prompt word templates and several fine-tuned diffusion models, a fine-tuned vehicle re-identification dataset generation model is constructed. Then, vehicle re-identification target detection and semantic filtering are combined for optimization to construct an optimized vehicle re-identification dataset generation model to generate a vehicle re-identification dataset.

[0014] Based on the diffusion model for image generation, it is easy to intuitively think that the diffusion model is not good at controlling the details of the image and the generated images are unstable, so it is impossible to generate effective synthetic data for vehicle re-identification tasks. However, this method starts from a counterintuitive perspective and uses a method from coarse-grained to fine-grained to generate images based on the diffusion model. In the end, it is found that even if there is some noise in the data, the method based on the diffusion model can still significantly improve the performance of the generated data in the vehicle re-identification task compared with the previous method.

[0015] In one embodiment, the iterative optimization of the prompt word template based on the diffusion model includes: generating an image based on the diffusion model as feedback to optimize the prompt word template, wherein the format of the optimized prompt word template is a car of [color][production year][brand][model][body style] driving on the road.

[0016] In one embodiment, the image-text pair-based fine-tuning diffusion model includes: fine-tuning the diffusion model using a low-rank adaptation method, introducing a low-rank matrix into the original parameters of the fine-tuning network layer, calculating the gradient of the parameters of the fine-tuning network layer according to the optimization objective, and updating the weights in the decoder.

[0017] In one embodiment, the method based on several optimized prompt word templates and several fine-tuned diffusion models includes: randomly extracting several optimized prompt word templates from the optimized prompt templates to select the optimal diffusion model, and finally selecting the fine-tuned diffusion model in which the text encoder is in a frozen state.

[0018] In one embodiment, the constructing of the fine-tuned vehicle re-identification dataset generation model includes: selecting prompt words from the optimized prompt word template and inputting them into the selected fine-tuned diffusion model to generate a fine-tuned vehicle re-identification dataset generation model for generating vehicle re-identification images.

[0019] In one embodiment, the optimization of combining vehicle re-identification target detection and semantic filtering to construct an optimized vehicle re-identification dataset generation model includes: using a target detection model trained on high-resolution images to perform vehicle detection and cropping, configuring the detection model to only detect vehicle categories, and limiting the number of bounding boxes for each image, focusing on the most prominent vehicles in the scene, and setting a threshold to retain images with high vehicle confidence; after cropping, filtering out semantically misaligned images to generate an optimized vehicle re-identification dataset generation model.

[0020] In one embodiment, the filtering out of semantically misaligned images includes: using a cross-modal visual language model, extracting text and image features for fusion, and deleting semantically misaligned images that match wrong colors based on test prompts.

[0021] In one embodiment, the method of screening semantically misaligned images based on test prompts includes: constructing the test prompts as phrases, in which color terms are dynamically replaced from a predefined color list, calculating the cosine similarity between image features and test text features, comparing the predicted color with the expected color, retaining the image if the predicted color matches the expected color, otherwise discarding the image.

[0022] In order to clearly demonstrate a method for generating a vehicle re-identification dataset based on a diffusion model, a device for generating a vehicle re-identification dataset based on a diffusion model is provided, comprising a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to implement a method for generating a vehicle re-identification dataset based on a diffusion model when executing the computer program.

[0023] Compared with the prior art, the present invention has the following beneficial effects:

[0024] (1) To address the problem of generating virtual datasets for vehicle re-identification, this paper proposes a coarse-to-fine cross-modal generation method based on a diffusion model, which can produce a synthetic vehicle re-identification dataset for specific downstream scenarios using only 1% of the unlabeled images in the original dataset.

[0025] (2) The dataset generation method significantly narrows the gap between synthetic data and real data, thereby improving the performance of subsequent vehicle re-identification models and is expected to be applied in areas such as privacy protection and intelligent transportation systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0027] Figure 1 Flowchart of the method for generating a vehicle re-ID dataset based on the diffusion model.

[0028] Figure 2 Schematic diagram of the vehicle re-identification dataset generation process based on the diffusion model, where: Figure 2 A in the figure is the process of constructing the prompt words in the vehicle re-identification dataset; Figure 2 B in the figure is the fine-tuning process of the diffusion model; Figure 2 C in the figure is the process of building an optimized vehicle re-ID dataset generation model based on the prompt words and the fine-tuned diffusion model. DETAILED DESCRIPTION

[0029] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.

[0030] In order to generate a more realistic and higher quality vehicle re-identification image dataset while reducing the use of real data and manual annotation, the embodiment provides a method for generating a vehicle re-identification dataset based on a diffusion model, such as Figure 1 As shown, the following steps are included:

[0031] S1. Construct a prompt word template based on vehicle attributes, and iteratively optimize the prompt word template based on a diffusion model to obtain an optimized prompt word template.

[0032] In this embodiment, based on the existing vehicle model data captured from the Internet and using the images generated by the diffusion model as feedback, an optimized prompt word database is obtained for subsequent image generation. Specifically, the noisy online information is first filtered, and the vehicle attributes of different models, namely color, production year, brand and model, are collected from the online automobile information website (the website used in this embodiment is autoevolution, the website address is https: / / www.autoevolution.com / ). It is worth noting that color is an important attribute and is used again in S3 for semantic filtering.

[0033] In addition, inspired by the alternating optimization technique and the human-diffusion interaction technique, the embodiment also develops a prompt word template to improve the quality of the generated image. Specifically, Figure 2 As shown in A in the figure, a component of the prompt word template is adjusted according to the feedback of the diffusion model, and the multi-view consistency generated by the pre-trained model is evaluated based on the original prompt word template "[color][brand][model]" until the optimal prompt word template is found: a [color][production year][brand][model][body style] is driving on the road, and an optimized prompt word library is constructed.

[0034] S2. Taking real vehicle re-identification unlabeled images as input, we use the pre-trained multimodal image description model to predict the image-text pairs of unlabeled vehicles, and fine-tune the diffusion model based on the image-text pairs.

[0035] In the embodiment, a text-to-image diffusion model is used to generate vehicle images based on the prompt words. However, the pre-trained diffusion model still has difficulty adapting to real-world vehicle images, resulting in a domain gap between the synthesized images and the images in the vehicle re-identification dataset. Therefore, the embodiment further fine-tunes the diffusion model to mitigate the domain difference while retaining its generative ability. Figure 2 Figure 2(B) illustrates the step-by-step fine-tuning stages from data preparation to model optimization.

[0036] Specifically, a pre-trained multimodal image description model, namely BLIP-2, is first deployed to predict textual hints for unlabeled vehicle images, and then the generated image-text pairs are used to fine-tune the text-to-image diffusion model. Due to the large number of parameters in the text-to-image diffusion model, fully fine-tuning the entire model requires a lot of GPU resources and time. In addition, fine-tuning the entire model requires millions of image-text pairs to prevent model collapse, which is impractical for vehicle re-identification tasks. To address this issue, this embodiment introduces additional weights in the decoder while keeping the pre-trained weights unchanged. These additional weights enable the final visual style to adapt while retaining the generative ability of the model. This approach limits the number of trainable parameters, provides a parameter-efficient training method, and reduces the risk of model collapse due to limited training data.

[0037] Specifically, the diffusion model is fine-tuned using the low-rank adaptation (LoRA) method, which is chosen for its simplicity and effectiveness. For the fine-tuning network layers, the original parameters are To begin, we introduce a low-rank matrix , denoted as BA, where , ,rank The newly added low-rank matrix BA is factored Zoom, where is initialized to The forward pass of the adjusted fine-tuning network layer is expressed as: .

[0038] in, represents the output of the fine-tuning network layer, Represents the input. The optimization objective of the network is the mean squared error (MSE) loss, the gradient of the parameters of the fine-tuned network layer is calculated according to the optimization objective, and the weights of the fine-tuned network layer are updated. It is worth noting that this method can be trained with only a small amount (1%) of unlabeled images of the real vehicle dataset for fine-tuning (for example, for the VeRi-776 dataset, only 378 unlabeled real images are needed for fine-tuning), while previous methods require large-scale datasets or rely on a large number of labeled images. In addition, unlike previous methods, this method utilizes the generative ability of the diffusion model and is able to generate more realistic images. Similarly, multiple candidate diffusion models are fine-tuned in preparation for the next stage, which involves selecting the best diffusion model in S3.

[0039] S3. Based on several optimized prompt word templates and several fine-tuned diffusion models, a fine-tuned vehicle re-identification dataset generation model is constructed, and then optimized by combining vehicle re-identification target detection and semantic filtering to construct an optimized vehicle re-identification dataset generation model to generate a vehicle re-identification dataset.

[0040] In the embodiment, about 10 prompt words are first extracted from the optimized prompt word library to evaluate and select the best fine-tuned diffusion model. Similar to the idea of ​​prompt template design, the selection of the fine-tuned model depends on the qualitative evaluation of the images generated by each candidate model. Figure 2 As shown in C in FIG. 1 , an illustrative example of a fine-tuned model evaluated together with a corresponding generated image is provided. Through this evaluation, the embodiment selects a fine-tuned diffusion model that keeps the text encoder in a frozen state. Then, the prompt word is obtained from the prompt word library optimized by S1 and input into the best fine-tuned diffusion model, which automatically generates a synthetic image.

[0041] Due to the limitations of text-to-image generation models in producing fine-grained and controllable outputs, directly using the generated images is not enough to train the vehicle re-ID network due to the following two major challenges, namely multiple objects and semantic misalignment. While the present invention only requires partial images containing high-quality vehicles, the diffusion model will generate low-quality images, such as images containing multiple vehicles, distorted generated vehicle bodies, or no vehicles at all.

[0042] To solve this problem, the embodiment uses an object detection model, namely YOLOv5x6, which is trained on high-resolution images of 1280*1280 for vehicle detection and cropping. The detection model is configured to detect only vehicle categories, with a special focus on cars and trucks. The number of bounding boxes per image is limited to one, focusing on the most prominent vehicle in each scene. Only images with high vehicle confidence are retained by setting a threshold, and any small vehicles with a height or width less than or equal to 250 pixels are excluded. After cropping, noisy images with semantic misalignment, such as vehicles with incorrect colors, are further screened out.

[0043] In particular, a cross-modal visual language model, CLIP, is used to extract features for text and image modalities, denoted as and . Then, semantically misaligned images matching the wrong colors are removed. Specifically, the test prompts are constructed as phrases, such as “red vehicle”, where color terms are dynamically replaced from a predefined list of colors, such as “red”, “yellow”, “green”, “white”, and “black”. Cosine similarity between image and test text at the feature level for: .

[0044] Predicted Color Defined as: The predicted colors are then compared to the expected colors, which are specified in the hint used to generate the image. If the predicted colors match the expected colors, the image is kept; otherwise, it is discarded.

[0045] The embodiment also provides a device for generating a vehicle re-identification dataset based on a diffusion model, including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to implement a method for generating a vehicle re-identification dataset based on a diffusion model when executing the computer program.

[0046] In order to clearly demonstrate the method and device for generating vehicle re-ID dataset based on diffusion model, experimental verification was carried out on the dataset VeRi-776 and the dataset VehicleID, as well as comparison with other vehicle re-ID data generation methods.

[0047] The VeRi-776 dataset is derived from real-world surveillance scenes and contains 51,035 images involving 776 vehicles. Among them, the dataset uses 576 vehicles for training and 200 vehicles for testing. The training set contains 37,778 images. The query set contains 1,678 images, and the gallery contains 11,579 images. The vehicle images in this dataset cover three main perspectives: front view, rear view, and side view, which makes it one of the most challenging datasets in the field of vehicle re-identification.

[0048] The VehicleID dataset contains images of cars in a small city in China, captured by multiple real surveillance cameras distributed in the city. The dataset collects 221,567 vehicle images of 26,328 vehicle IDs. Among them, the dataset uses 113,346 images of 13,164 vehicles for training. The test set is divided into three, called small, medium, and large. The query set of the small test set contains 5,693 images of 800 vehicles, and the gallery contains 800 images of 800 vehicles. The query set of the medium test set contains 11,777 images of 1,600 vehicles, and the gallery contains 1,600 images of 1,600 vehicles. The query set of the large test set contains 17,377 images of 2,400 vehicles, and the gallery contains 2,400 images of 2,400 vehicles. This experiment is based on PyTorch.

[0049] When measuring the performance of vehicle re-identification data generation, the main evaluation indicators used in this invention include mean average precision (mAP) and Rank-N. Mean average precision is used to evaluate the overall performance of vehicle re-identification, representing the average precision of all retrieval results. To calculate mAP, it is necessary to first calculate the mean average precision AP for the retrieval results of each image in the query set, as shown in the following formula: .

[0050] in, Represents the index of the image in the gallery collection, represents the total number of test images, represents the number of real samples that correctly match the target vehicle, Indicates the first The precision before the bit, Indicates Whether the bit image has the same ID as the target vehicle. Finally, the average precision of all query set retrieval results is calculated, which is mAP, as shown in the following formula: .

[0051] in, represents the total number of query images, Represents the query image. Rank-N is a commonly used evaluation index in vehicle re-identification, which is used to measure the performance of the system in the retrieval results. Rank-1 and Rank-5 are generally selected as the measurement criteria. Rank-1 and Rank-5 represent the probability of correct matching of the first and first 5 images in the retrieval result list, respectively.

[0052] The method Vehicle-Diff of this example is compared with the existing vehicle re-identification data generation method. In the experimental setting, in order to make a fair comparison with the previous methods, this embodiment uses the vehicle re-identification network based on ResNet50 and pre-trained on ImageNet-1K, which is used in one of the most advanced vehicle re-identification data generation methods, "Simulating Content Consistent Vehicle Datasets with Attribute Descent" (i.e., "VehicleX"). In addition, this embodiment also compares the differences between the data generation methods on Swin Transformer V2, one of the most advanced network architectures currently. At the same time, for the sake of fairness in comparison, the same number of virtual images as in the virtual dataset publicly available online in the reference "Simulating Content Consistent Vehicle Datasets with Attribute Descent" are used to train the vehicle re-identification network.

[0053] Table 1 shows in detail the comparison results of Vehicle-Diff in this embodiment and other methods when the VeRi-776 dataset is used as the source dataset, where the bold represents the best results. Table 2 shows the comparison results of this embodiment and other vehicle re-identification data generation methods when the VehicleID dataset is used as the source dataset.

[0054] Table 1

[0055]

[0056] Table 2

[0057]

[0058] In addition to reporting the results obtained by training on real data alone, Tables 1 and 2 also report the results of the evaluation method used in the previous data generation method evaluation and the results obtained by mixing the data generated by the method proposed in the present invention with the real data (the "S" in the "Data" column in the table represents real data, and the "R+S" part means the mixing of real data and synthetic data; the "D" in the "Mix" column in the table means that the real data and synthetic data are directly mixed after being shuffled. "PCB" in Tables 1 and 2 refers to the Part-based Convolutional Baseline method recorded in "Beyond Part Models: Person Retrieval with Refined PartPooling" on the ResNet50 network. This setting is used in this embodiment to comply with "Simulating Content Consistent Vehicle Datasets with Attribute Descent” for better data comparison. “Baseline” refers to the results obtained by directly training the network using a real dataset. Because the engine-based method “PAMTRI” did not open source its virtual data, and some previous GAN-based methods only reported the results obtained after mixing it with real data and neither the dataset nor the code was open source, the results reported in the paper were directly excerpted for comparison.

[0059] As can be seen from Tables 1 and 2, the virtual data generated by the method of the embodiment of the present invention, compared with all previous vehicle re-identification data generation methods, namely VehicleX, PAMTRI, and VehicleGAN, under different network architectures and different usage settings (used alone and as a data augmentation method), have achieved better retrieval results than the previous methods. It should be noted that the method of the embodiment of the present invention only uses 1% of the number of unlabeled real images in the real data set to train, while other training methods require the use of all labeled real data sets. Although the real data and annotations used are far less than those of other data generation methods, the virtual data generated by the method of the embodiment of the present invention has achieved better performance than other data generation methods under different settings.

[0060] This paper uses FID (Frechet Inception Distance) as an evaluation indicator to measure the difference between the generated data and the real data in the source domain. The lower the FID value, the closer the distribution of the two data sets is, and the higher the similarity between the generated data and the real data is.

[0061] The process of calculating FID is as follows. First, use the pre-trained Inception-V3 network to extract the high-dimensional features of the dataset. These features are considered to represent the content and distribution of the data. Then, the mean of the Gaussian distribution is calculated for the features of the generated dataset and the real dataset. and the covariance matrix Then, the Frechet distance formula is used to measure the difference between the two feature distributions. The formula is as follows: .

[0062] in, and Represents the mean and covariance matrix of the real data set; and Represents the mean and covariance matrix of the generated data set; Represents the trace of the matrix, which is used to measure the difference in the covariance matrix.

[0063] Table 3 shows the difference calculation results of the data generated by different vehicle re-identification data generation methods on FID and the real data in the source domain. For the method described in "Simulating Content Consistent Vehicle Datasets with Attribute Descent", namely VehicleX, 1% of the real annotated data randomly selected from the real data set in the source domain was used to train the method. The quantitative experimental results in the table below show that the virtual data generated by this embodiment is smaller than the data generated by the previous data generation methods, namely VehicleGAN, PTGAN, VehicleX and the real data.

[0064] Table 3

[0065]

[0066] Therefore, the vehicle re-identification dataset generation method and device of the diffusion model proposed in the present invention is a coarse-to-fine cross-modal generation method based on the diffusion model. It uses only 1% of the unlabeled images in the original dataset to produce a synthetic vehicle re-identification dataset for a specific downstream scenario, which significantly narrows the gap between the synthetic data and the real data, thereby improving the performance of the subsequent vehicle re-identification model, and is expected to be applied in fields such as privacy protection and intelligent transportation systems.

[0067] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for generating a vehicle re-identification dataset based on a diffusion model, characterized in that: The following steps are involved: Building a prompt word template based on vehicle attributes, and iteratively optimizing the prompt word template based on a diffusion model to obtain an optimized prompt word template; Taking the real vehicle re-identification unlabeled image as input, using the pre-trained multimodal image description model to predict the image-text pair of the unlabeled vehicle, fine-tuning the diffusion model based on the image-text pair, wherein fine-tuning the diffusion model based on the image-text pair includes: fine-tuning the diffusion model using a low-rank adaptation method, introducing a low-rank matrix into the original parameters of the fine-tuning network layer, calculating the gradient of the parameters of the fine-tuning network layer according to the optimization target, and updating the weights in the decoder; Based on several optimized prompt word templates and several fine-tuned diffusion models, several optimized prompt word templates are randomly extracted from the optimized prompt templates to select the optimal diffusion model, and finally the fine-tuned diffusion model with the text encoder in a frozen state is selected to construct a fine-tuned vehicle re-identification dataset generation model, which is then optimized by combining vehicle re-identification target detection and semantic filtering. The target detection model trained on high-resolution images is used for vehicle detection and cropping. The detection model is configured to detect only vehicle categories, and the number of bounding boxes for each image is limited. Focus is placed on the most prominent vehicles in the scene, and a threshold is set to retain images with high vehicle confidence. After cropping, images with semantic misalignment are screened out, and an optimized vehicle re-identification dataset generation model is constructed to generate a vehicle re-identification dataset.

2. The method for generating a vehicle re-identification dataset based on a diffusion model according to claim 1, characterized in that: The iterative optimization of the prompt word template based on the diffusion model includes: generating an image based on the diffusion model as feedback to optimize the prompt word template, wherein the format of the optimized prompt word template is a car of [color][production year][brand][model][body style] driving on the road.

3. The method for generating a vehicle re-identification dataset based on a diffusion model according to claim 1, characterized in that: The method of constructing a fine-tuned vehicle re-identification dataset generation model includes: selecting prompt words in an optimized prompt word template and inputting them into a selected fine-tuned diffusion model to generate a fine-tuned vehicle re-identification dataset generation model for generating a vehicle re-identification image.

4. The method for generating a vehicle re-identification dataset based on a diffusion model according to claim 1, characterized in that: The method of screening out semantically misplaced images includes: using a cross-modal visual language model, extracting text and image features for fusion, and deleting semantically misplaced images that match wrong colors based on test prompts.

5. The method for generating a vehicle re-identification dataset based on a diffusion model according to claim 4, characterized in that: The method of deleting semantically misplaced images matching wrong colors based on test prompts includes: constructing the test prompts as phrases, in which color terms are dynamically replaced from a predefined color list, calculating the cosine similarity between image features and test text features, comparing the predicted color with the expected color, retaining the image if the predicted color matches the expected color, otherwise discarding the image.

6. A vehicle re-identification data set generation device based on a diffusion model, comprising a memory and a processor, wherein the memory is used to store a computer program, characterized in that: The processor is used to implement the method for generating a vehicle re-identification data set based on a diffusion model as described in any one of claims 1 to 5 when executing the computer program.

Citation Information

Patent Citations

  • Data set enhancement method based on diffusion model low-rank adaptation

    CN117934952A

  • Vehicle image generation method based on stable diffusion model

    CN119107377A