Target re-identification model training method, target re-identification method and control device
By sharing the backbone network in the target re-identification model training and using the homography estimation module and detection head for feature fusion, the problem of decreased recognition accuracy caused by changes in camera perspective is solved, and better perspective adaptability and recognition effect are achieved.
Patent Information
- Application Number
- CN202310851116.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2043-07-12
AI Technical Summary
The target re-identification scheme in the existing technology has inaccurate recognition results when the camera viewing angle changes, resulting in a decrease in recognition effect.
By training the homography model and the target re-identification model to share the same backbone network for feature extraction, using the homography estimation module for perspective correction, and combining the detection head and neck network for feature fusion, the model's recognition ability under different perspectives is improved.
The recognition accuracy and generalization ability of the target re-identification model under different perspectives are improved, and the recognition ability of the same target is enhanced.
Smart Images

Figure CN116863303B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and specifically provides a target re-identification model training method, a target re-identification method and a control device. Background Art
[0002] In the target re-identification scheme in the prior art, when the camera perspective changes, even if it is the same target, the final similarity often decreases, resulting in inaccurate recognition results.
[0003] Accordingly, a new target re-identification solution is needed in this field to solve the above problems. Summary of the Invention
[0004] In order to overcome the above defects, the present invention is proposed to provide a solution or at least partially solve the problems in the prior art.
[0005] In a first aspect, the present invention provides a method for training a target re-identification model, the method comprising: training a homography model; training a target re-identification model; wherein the homography model and the target re-identification model use the same backbone network for feature extraction during training.
[0006] As an alternative or supplement to the above scheme, in a method according to one embodiment of the present invention, the homography model includes a backbone network and a homography estimation module, and the training of the homography model includes: inputting the associated image into the backbone network for feature extraction to obtain a first feature map and a second feature map, wherein the associated image is obtained for the same target under different camera perspectives; inputting the first feature map and the second feature map into the homography estimation module for homography estimation to obtain a third image, wherein the third image is a perspective-corrected image of one of the associated images.
[0007] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the target re-identification model is trained, including: inputting the third image into the target re-identification model composed of at least the backbone network and the detection head to train the model; and / or inputting the sample image in the sample library into the target re-identification model composed of the backbone network and the detection head to train the model.
[0008] As an alternative or supplement to the above scheme, in a method according to one embodiment of the present invention, the third image is input into a target re-identification model composed of at least the backbone network and the detection head to train the model, including: inputting the third image into the backbone network for feature extraction to obtain a third feature map; inputting the third feature map into the detection head to obtain a training result.
[0009] As an alternative or supplement to the above scheme, in a method according to one embodiment of the present invention, the target re-identification model also includes a neck network; the third image is input into the target re-identification model composed of at least the backbone network and the detection head to train the model, including: inputting the third image into the backbone network for feature extraction to obtain a third feature map; inputting the third feature map into the neck network for feature fusion to obtain a fused feature map; inputting the fused feature map into the detection head to obtain a training result.
[0010] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the homography estimation module also includes a homography neural network model; the first feature map and the second feature map are input into the homography estimation module for homography estimation to obtain a third picture, including: the first feature map and the second feature map are respectively divided into blocks, and the block division divides any one of the first feature map and the second feature map into at least two blocks, wherein the blocks of the first feature map and the blocks in the second feature map are corresponding to each other; the first feature map and the second feature map after block division are input into the homography neural network model to obtain a homography matrix corresponding to the block; based on the homography matrix, the associated picture and the first feature map after block division or the second feature map after block division, the third picture is obtained.
[0011] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the homography estimation module also includes a homography neural network model; the first feature map and the second feature map are input into the homography estimation module for homography estimation to obtain a third image, including: the first feature map and the second feature map are feature maps with at least two scales; the feature maps of different scales in the first feature map and the second feature map are respectively merged to obtain a first merged feature map and a second merged feature map; the first merged feature map and the second merged feature map are respectively block-divided, and the block division divides any one of the first merged feature map and the second merged feature map into at least two blocks, wherein the blocks of the first merged feature map correspond to the blocks in the second merged feature map; the first merged feature map and the second merged feature map after block division are input into the homography neural network model to obtain the homography matrix corresponding to the blocks; based on the homography matrix, the associated image and the first merged feature map after block division or the second merged feature map after block division, the third image is obtained.
[0012] As an alternative or supplement to the above solution, in a method according to an embodiment of the present invention,
[0013] In a second aspect, the present invention provides a target re-identification method, comprising: obtaining a target image to be identified; inputting the target image to be identified into a target re-identification model to obtain a recognition result, wherein the target re-identification model is composed of at least the backbone network and the detection head, and the target re-identification model is trained by the target re-identification model training method described in the first method.
[0014] In a third aspect, a control device is provided, which includes a processor and a storage device, wherein the storage device is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the target re-identification model training method described in any one of the technical solutions of the target re-identification model training method described in the first aspect or the target re-identification method described in any one of the technical solutions of the target re-identification method described in the second aspect.
[0015] In a fourth aspect, a computer-readable storage medium is provided, which stores a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the target re-identification model training method described in any one of the technical solutions of the target re-identification model training method described in the first aspect above, or the target re-identification method described in any one of the technical solutions of the target re-identification method described in the second aspect above.
[0016] The above one or more technical solutions of the present invention have at least one or more of the following
[0017] Beneficial effects:
[0018] In the technical solution of the present invention, by using the homography model and the target re-identification model to share the same backbone network for feature extraction during the training process, the target re-identification model has better generalization ability when processing target images under different camera perspectives, thereby improving the target re-identification model's ability to recognize the same target under different perspectives. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The disclosure of the present invention will be more easily understood with reference to the accompanying drawings. Those skilled in the art will readily appreciate that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Furthermore, similar numbers in the drawings represent similar components, wherein:
[0020] Figure 1 1 is a flow chart showing the main steps of a method for training an object re-identification model according to an embodiment of the present invention;
[0021] Figure 2 is a flowchart of the secondary steps of a method for training a target re-identification model according to an embodiment of the present invention;
[0022] Figure 3 is a flowchart of the secondary steps of a method for training a target re-identification model according to an embodiment of the present invention;
[0023] Figure 4 1 is a flowchart of the secondary steps of a method for training a target re-identification model according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] Some embodiments of the present invention are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0025] In the description of the present invention, "module" and "processor" may include hardware, software, or a combination of both. A module may include hardware circuitry, various suitable sensors, communication ports, and memory. It may also include software components, such as program code, or a combination of software and hardware. A processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. A processor has data and / or signal processing capabilities. A processor may be implemented in software, hardware, or a combination of both. Non-transitory computer-readable storage media include any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, and the like. The term "A and / or B" refers to all possible combinations of A and B, such as only A, only B, or both A and B. The terms "at least one of A or B" or "at least one of A and B" have similar meanings to "A and / or B" and may include only A, only B, or both A and B. The singular forms "one" and "the" may also include the plural forms.
[0026] Here we first explain some terms involved in the present invention.
[0027] Object re-identification (ReID) is commonly used in computer vision. It aims to re-identify a specific object (e.g., a person, vehicle, etc.) from a collection of images captured under different camera viewpoints, lighting conditions, and poses. Simply put, the task of object re-identification is to establish a cross-view similarity measure between multiple images, thereby identifying the same object in different images.
[0028] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart showing the main steps of a target re-identification model training method according to an embodiment of the present invention. Figure 1As shown, the target re-identification model training method in the embodiment of the present invention mainly includes the following steps S10 to S20.
[0029] Step S10: training the homography model.
[0030] In this embodiment, the homography model is trained primarily to enable the neural network to better estimate the homography between two images of the same object from different camera perspectives. This reduces the impact of perspective changes, thereby improving subsequent object re-identification performance. In this embodiment, the homography model includes a backbone network and a homography estimation module.
[0031] In one embodiment, the homography model is trained through steps S101-S102, such as Figure 2 shown.
[0032] Step S101: Input the associated image into the backbone network for feature extraction to obtain a first feature map and a second feature map.
[0033] In this embodiment, the associated images are taken from different camera perspectives of the same target. The associated images are sample images used for homography training. In this embodiment, there are at least two associated images, i.e., at least two images of the same target taken from different camera perspectives.
[0034] In one embodiment, the same object is a car. In this embodiment, the associated images are a first image and a second image. The first image is taken from perspective A, showing the front of the car. The second image is taken from perspective B, showing the side of the car. The first and second images are input into the backbone network to extract their features. These features may include information such as the car's color, shape, and outline.
[0035] Specifically, this embodiment performs feature extraction through steps S1011 to S1013 to obtain corresponding first feature maps and second feature maps.
[0036] Step S1011: Preprocess the associated pictures.
[0037] In this embodiment, the associated images are the first image and the second image. The purpose of preprocessing the associated images is to eliminate the differences between different images, reduce noise, and adapt to the requirements of the backbone network, thereby improving the accuracy and robustness of feature extraction.
[0038] In one embodiment, the associated images are preprocessed by performing operations such as image scaling, pixel mean subtraction, and division by pixel standard on the associated images. The specific operations are as follows.
[0039] Image Scaling: Scale the first and second images to the same resolution. The backbone network typically requires input images of the same size. Image scaling can be achieved through methods such as bilinear interpolation and nearest neighbor interpolation. It is important to ensure that the aspect ratio of the original image is maintained during scaling to avoid distortion. Images can also be cropped based on actual needs. For example, if an object in an image is occluded, consider cropping the occluded portion. The cropped images need to be resized to the same size to meet the backbone network input requirements.
[0040] Subtract pixel mean: For each color channel, calculate the mean of the pixels in that channel in the entire training dataset and subtract the corresponding mean from each pixel in the current image. This can eliminate the overall offset within the dataset, making the distribution of input data more uniform, which is beneficial for neural network training.
[0041] Divide by pixel standard deviation: Similar to subtracting the pixel mean, calculate the pixel standard deviation for each color channel and divide each pixel in the current image by the corresponding standard deviation. This can make the scale of the input data more consistent, prevent gradient vanishing or gradient exploding phenomena, and improve training stability.
[0042] In addition to the above operations, it is preferred that data augmentation operations be performed on the image to improve the generalization ability of the model, such as rotation, flipping, scaling, cropping, brightness and contrast adjustment, etc. This can increase the diversity of training samples and avoid model overfitting. Color space conversion can also be performed to convert the image from RGB color space to other color spaces (such as HSV, LAB, etc.). This helps to extract features whose colors are not affected by lighting conditions.
[0043] After the above preprocessing operations, the associated images have met the input requirements of the backbone network and have good feature extraction conditions.
[0044] Step S1012: extracting features from the associated images.
[0045] In this embodiment, the associated images are input into the backbone network for feature extraction. The purpose is to extract useful features from the pre-processed associated images so that the subsequent homography estimation module can learn the key information of the target under different perspectives.
[0046] In one embodiment, a backbone network suitable for feature extraction is selected, such as ResNet, VGG, or other similar network structures. These networks perform well in tasks such as image classification and object detection and can effectively extract image features. The preprocessed first and second images are then input into the backbone network. These images have already undergone preprocessing operations such as scaling, cropping, and color space conversion in step S1011 to meet the input requirements of the backbone network.
[0047] The convolutional layers in the backbone network use at least one set of convolution kernels to perform a sliding window operation on the input image to extract local features. As the number of network layers increases, the convolutional layers are able to capture higher-level abstract features.
[0048] To introduce nonlinearity, the convolutional layer is preferably followed by an activation function, such as ReLU, LeakyReLU, or other similar nonlinear activation functions. Activation functions enhance the network's expressiveness, enabling it to fit complex functional relationships. The backbone network then includes a pooling layer, which downsamples the feature maps output by the convolutional layer to reduce their size. This helps reduce computational complexity, mitigates the risk of overfitting, and improves feature translation invariance.
[0049] Step S1013: Output feature map.
[0050] In this embodiment, the first feature map and the second feature map are finally output.
[0051] After feature extraction, the first and second feature maps are fed into the subsequent homography estimation module to calculate the perspective transformation parameters. Through these steps, the model can learn the shared features of the target under different perspectives, supporting homography estimation and target reconstruction.
[0052] Step S102: Input the first feature map and the second feature map into a homography estimation module to perform homography estimation to obtain a third image.
[0053] In this embodiment, the third image is a perspective-corrected image of one of the associated images. The third image is a perspective-corrected image of one of the associated images, i.e., an image obtained by homography transformation of the first image or the second image. The homography estimation module includes a homography neural network model.
[0054] In one embodiment, when the first feature map and the second feature map are feature maps having at least two scales, homography estimation is performed through steps S1021-S1024, such as Figure 3 shown.
[0055] Step S1021: Merging the feature maps of different scales in the first feature map and the second feature map respectively to obtain a first merged feature map and a second merged feature map.
[0056] In this embodiment, feature maps of different scales in the first feature map and the second feature map are merged respectively. The purpose of merging is to integrate multi-scale information to capture the diversity of the target at the spatial level, thereby improving the accuracy of homography estimation.
[0057] In one embodiment, the first feature map and the second feature map are processed separately. First, feature maps of different scales are identified from the first feature map and the second feature map. These feature maps are generated at different levels of the convolutional neural network and contain low-level information (such as edges, textures, and colors) and high-level information (such as overall shape).
[0058] The identified feature maps of different scales are then fused. This fusion method can use techniques such as Feature Pyramid Network (FPN) to combine feature maps of different scales through upsampling and downsampling operations. This ensures that the fused feature map contains both local and global structural information.
[0059] After the feature maps are fused, a first merged feature map and a second merged feature map are obtained. These two merged feature maps contain multi-scale information of the objects in the first and second images, which is helpful for subsequent homography estimation.
[0060] Step S1022: Divide the first merged feature map and the second merged feature map into blocks respectively.
[0061] In this embodiment, the block partitioning divides either the first merged feature map or the second merged feature map into at least two blocks, wherein the blocks of the first merged feature map correspond to the blocks of the second merged feature map. Local matching is performed on features in different regions, thereby improving the accuracy and robustness of homography estimation.
[0062] In one embodiment, an appropriate partitioning strategy is selected based on the actual application scenario and requirements. The partitioning strategy may include equal partitioning, adaptive partitioning based on feature distribution, etc. For example, the feature map may be divided into four equal blocks, or adaptive partitioning may be performed based on feature density and distribution.
[0063] Then, based on the determined partitioning strategy, the first and second merged feature maps are partitioned into blocks. Each feature map is divided into at least two blocks. The divided blocks contain local feature information, which facilitates subsequent matching and homography estimation.
[0064] During the block division process, it is ensured that the blocks in the first merged feature map correspond to the blocks in the second merged feature map. In this way, in the subsequent homography estimation process, feature matching and geometric transformation calculation can be performed for each pair of corresponding blocks.
[0065] In this embodiment, the equal division strategy of 4 blocks is taken as an example:
[0066] The first merged feature map is divided into four equal blocks, assuming that the four blocks are A1, A2, A3 and A4. These four blocks contain local feature information of different regions on the first merged feature map.
[0067] Similarly, the second merged feature map is divided into four equal blocks, assuming that the four blocks are B1, B2, B3 and B4. These four blocks contain local feature information of different regions on the second merged feature map.
[0068] Preferably, during the block division process, it is necessary to ensure that the blocks in the first merged feature map correspond to the blocks in the second merged feature map, for example, A1 corresponds to B1, A2 corresponds to B2, A3 corresponds to B3, and A4 corresponds to B4.
[0069] Through the above steps, the first and second merged feature maps are divided into multiple blocks, and the corresponding relationships between them are established. In the subsequent homography estimation process, feature matching and geometric transformation calculations are performed for each pair of corresponding blocks (such as A1 and B1, A2 and B2, etc.), thereby more accurately estimating the geometric relationship of the target under different viewpoints. This helps to eliminate the influence of viewpoint differences and improve the accuracy of the target re-identification task.
[0070] Step S1023: Input the first merged feature map and the second merged feature map after the block division into the homography neural network model to obtain the homography matrix corresponding to the block.
[0071] In this embodiment, the homography matrix describes how to map one block to another block under a planar geometric transformation.
[0072] In one embodiment, the homography neural network model is primarily used to learn and estimate the geometric transformation relationship between blocks under different viewpoints. It can be a fully connected network, a convolutional neural network, or other types of neural network structures.
[0073] In this embodiment, each pair of corresponding blocks (such as A1 and B1, A2 and B2, etc.) of the first merged feature map and the second merged feature map after block division is used as input and sent to the homography neural network model.
[0074] In the neural network model, feature matching is performed on each pair of input patches to calculate the similarity between them. Based on these similarities, the model will estimate the corresponding geometric transformation relationship, namely the homography matrix.
[0075] The neural network model will output a homography matrix corresponding to each block. For example, for input blocks A1 and B1, the model will output a homography matrix H1 representing the transformation relationship from A1 to B1; for input blocks A2 and B2, the model will output a homography matrix H2 representing the transformation relationship from A2 to B2, and so on.
[0076] The above homography matrix can be used for subsequent perspective correction and target re-identification tasks, which helps to eliminate the differences in geometric transformations under different perspectives and improve recognition accuracy.
[0077] Step S1024: Obtain a third image based on the homography matrix, the associated image, and the first merged feature map after block division or the second merged feature map after block division.
[0078] In this embodiment, the third image is a perspective-corrected image of one of the associated images. Perspective correction means that the third image is transformed from one of the associated images, using the other image as a reference. The transformed perspective is the same as that of the reference image.
[0079] In one embodiment, when block division is performed, the homography matrix corresponding to each block is applied to the corresponding block of the associated image (eg, the first image or the second image), and then a new perspective image is obtained.
[0080] In this embodiment, the blocks that have undergone homography transformation are reassembled into a complete picture by splicing the pixel values of each block according to their positions in the original picture.
[0081] The image after homography transformation and block merging is output as the third image. This corrected image can be used for subsequent object re-identification tasks because it changes the perspective, which is equivalent to adding samples to the sample library.
[0082] In this embodiment, when the first picture is the reference picture, the third picture is the second picture in perspective A. When the second picture is the reference picture, the third picture is the first picture in perspective B. In this embodiment, only the third picture is output; however, the third and fourth pictures can also be output. The third and fourth pictures correspond to different associated pictures. Still assuming that the associated pictures are the first and second pictures, the third picture output here is the second picture in perspective A, and the fourth picture is the first picture in perspective B. This allows two pictures to be output simultaneously, increasing the number of samples.
[0083] Preferably, the third image contains the common area of the associated images, that is, the area with the same objects and scene structure in the associated images after the perspective transformation. To ensure that the third image only contains the common area of the associated images, the perspective-corrected image needs to be cropped or resized. This removes any overlapping or irrelevant areas and ensures that the third image only contains areas with the same objects and scene structure. This helps eliminate the influence of perspective differences in subsequent object re-identification tasks, thereby improving recognition accuracy.
[0084] The homography model generally uses L2 loss in supervised methods during training, and photometric consistency loss, content alignment loss, and shape preservation loss in unsupervised methods.
[0085] Step S20: training the target re-identification model.
[0086] In this embodiment, the object re-identification model is composed of at least a backbone network and a detection head, wherein the homography model and the object re-identification model use the same backbone network for feature extraction during training.
[0087] In one embodiment, samples including the third image are selected for training the target re-identification model. The selection of samples including the third image is primarily intended to increase the number of samples. As described above, by placing the first and second images into the homography estimation module, two images, the third and fourth images, can be generated. Compared to the single training sample consisting of the first and second images, the above steps allow for the free generation of six pairs of samples, significantly enriching the training sample set and enhancing the training effect.
[0088] In this embodiment, the target re-identification model is trained through steps S201-202.
[0089] Step S201: Input the third image into the backbone network for feature extraction to obtain a third feature map.
[0090] In this embodiment, the backbone network is the same as the backbone network in step S1021 and will not be described in detail here. It should be noted that, during the training of the target re-identification model, the same feature map as that used in the homography model training is used.
[0091] In one embodiment, preferably, generating the third feature map also requires steps such as preprocessing and feature extraction, which will not be described in detail here.
[0092] Step S202: Input the third feature map into the detection head to obtain a training result.
[0093] In this embodiment, the detection head generally includes a pooling layer and a convolutional or linear layer, which is responsible for further extracting features and generating the results required for the target re-identification task.
[0094] In one embodiment, the third feature map is input into a pooling layer. The pooling layer can be global average pooling (GAP) or global maximum pooling (GMP). The pooling layer helps reduce the spatial dimension of the feature map and reduces computational complexity. In addition, the pooling operation also helps extract more robust and discriminative features. The pooled feature map is then input into a convolutional or linear layer. These layers can further extract useful feature information and transform the features into a form suitable for the object re-identification task.
[0095] After being processed by the detection head, a training result is obtained. Preferably, in the target re-identification training, a loss function such as triplet loss, classification loss (such as softmax cross entropy loss), arcface loss, etc. is used.
[0096] By training for object re-identification, the object re-identification model's generalization capabilities are enhanced, improving its ability to recognize the same object from different perspectives. One of the key capabilities of the homography model is to increase the diversity of samples used in object re-identification. Furthermore, because the homography model and the object re-identification model use the same backbone network for feature extraction during training, the object re-identification model possesses a certain degree of recognition capability under different perspectives after training. This ability to recognize the same object from different perspectives is largely due to the parameters of the backbone network.
[0097] Preferably, during the training process, data enhancement can be used to determine the parameters that have a stronger impact on the homography to avoid overfitting, which will not be described in detail here.
[0098] In the training process of this embodiment, training can be performed separately or in an end-to-end training manner.
[0099] Example 2:
[0100] In this embodiment, most of the steps are the same as those in Example 1, except that this embodiment uses steps S201, S203, and S204 to train the target re-identification model. The details are as follows:
[0101] Step S201: Input the third image into the backbone network for feature extraction to obtain a third feature map.
[0102] In this embodiment, this step is the same as that in Embodiment 1 and will not be repeated here.
[0103] Step S203: Input the third feature map into the neck network for feature fusion to obtain a fused feature map.
[0104] In this embodiment, the Neck Network is responsible for performing feature fusion on the feature maps extracted from the backbone network. Feature fusion is the process of integrating features from different levels to improve the model's performance in object re-identification tasks. The Neck Network can improve the object re-identification model's ability to recognize the same object under different viewpoints, poses, lighting conditions, and other conditions.
[0105] In one embodiment, the neck network includes submodules consisting of convolutional layers, pooling layers, activation functions, etc. These submodules help extract richer features and enhance the expressive power of the model.
[0106] The convolutional layer is used to extract local features. In the neck network, the convolutional layer can capture higher-level features in the input feature map, such as the overall shape of the target, key parts, etc.
[0107] The pooling layer can reduce the spatial resolution of the feature map and reduce the amount of computation. In the neck network, the pooling layer can extract features of different scales, which helps to capture the diversity of the target at the spatial level.
[0108] The activation function introduces nonlinearity to the neural network. In the neck network, the activation function can enhance the expressive power of the model, enabling it to capture more complex features.
[0109] Finally, the fused feature map is output, which contains richer information about pedestrians.
[0110] Step S204: Input the fused feature map into the detection head to obtain the training result.
[0111] In this embodiment, this step is similar to step S202 and will not be described again here.
[0112] Example 3:
[0113] In this embodiment, most of the steps are the same as those in Example 1, except for steps S1021-S1024, that is, the first feature map and the second feature map are not merged. The rest are the same as in Example 1 and will not be repeated here.
[0114] In this embodiment, the first feature map and the second feature map have only a single scale. In this embodiment, homography estimation is performed through steps S1025-S1027, such as Figure 4 shown.
[0115] Step S1025: Divide the first feature map and the second feature map into blocks respectively.
[0116] In this embodiment, the method of performing block division is similar to step S1022 and will not be repeated here.
[0117] Step S1026: Input the first feature map and the second feature map after the block division into the homography neural network model to obtain the homography matrix corresponding to the block.
[0118] In this embodiment, the method of obtaining the homography matrix is similar to step S1023 and will not be repeated here.
[0119] Step S1027: Obtain a third picture based on the homography matrix, the associated picture, and the first feature map after block division or the second feature map after block division.
[0120] In this embodiment, the method of obtaining the third image is similar to step S1024 and will not be repeated here.
[0121] Example 4:
[0122] Step S103: Input the sample images in the sample library into the target re-identification model composed of the backbone network and the detection head to train the model.
[0123] In this embodiment, the object re-identification model, consisting of a backbone network and a detection head, is trained using sample images from a sample library. Preferably, the sample images in the sample library include images of the same object taken from different angles, poses, and lighting conditions, as well as images of different objects. By training on these diverse sample images, the generalization capability of the object re-identification model is improved, enabling it to better handle diverse scenarios in real-world applications.
[0124] During training, the homography model and the object re-identification model share a backbone network for feature extraction. This means that during training, the two models jointly optimize the backbone network parameters, giving it stronger perspective discrimination capabilities. This shared backbone network strategy helps improve the model's recognition capabilities when dealing with the same object from different perspectives.
[0125] In this embodiment, by training the target re-identification model composed of the backbone network and the detection head on sample images in the sample library, the generalization ability of the model is enhanced, and its recognition ability when facing the same target from different perspectives is improved.
[0126] It should be noted here that the training process of the target re-identification model is usually to input paired samples into the target re-identification model for training. Preferably, in this embodiment, each training is performed using two pictures in the sample library. In comparison, the training using the third picture in Example 1 is usually also performed using the third picture and other pictures together. During training, different pictures combined with the third picture will have more training samples. For example, the number of samples under the same target is 300% of the original number by only combining the first picture, the second picture and the third picture. Accordingly, the training results are also more outstanding.
[0127] Example 5:
[0128] In this embodiment, a target re-identification method is proposed, including: obtaining a target image to be identified; inputting the target image to be identified into a target re-identification model to obtain a recognition result, wherein the target re-identification model is composed of at least a backbone network and a detection head.
[0129] In this embodiment, a specific recognition process of a target re-identification model is given, which consists of multiple steps: preprocessing, feature extraction, feature processing, target matching, and outputting recognition results, as shown below.
[0130] First, an image of the target to be identified is acquired. In this embodiment, an image of the target to be identified is acquired from a camera or other image source. The acquired image is preprocessed, such as scaling, cropping, or other image enhancement methods, to meet the input requirements of the target re-identification model.
[0131] The preprocessed target image is then fed into the backbone network of the object re-identification model. The backbone network extracts useful features from the input image, which are then used for subsequent object recognition tasks. The feature map output by the backbone network is fed into the detection head. The detection head can be trained using different loss functions and optimization strategies based on the specific task requirements.
[0132] The feature vector output by the detection head is compared with a library of known target feature vectors to find the closest match. This comparison typically involves calculating similarity between the image features of the target being identified and each known target feature in the library, such as Euclidean distance or cosine similarity. Based on this similarity score, the degree of association between the target being identified and the known targets can be determined.
[0133] Finally, based on the target matching results, the recognition result is output. The recognition result can be a known target label, confidence score, or other related information. If no sufficiently similar known target is found, the method can mark the target to be recognized as an unknown target.
[0134] The target re-identification model is trained using the target re-identification model training method of one of Examples 1-4.
[0135] It should be noted that the object re-identification method and its training method have certain correlations and interchangeability. For example, during training, Euclidean distance and cosine similarity can also be used to compare images. A number of methods are described in different embodiments. Given the same output requirements, these methods can be interchanged to form a new neural network, and will not be detailed here.
[0136] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.
[0137] It will be understood by those skilled in the art that all or part of the processes in the method of the above embodiment of the present invention can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium can include: any entity or device, medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.
[0138] Furthermore, the present invention also provides a control device. In one embodiment of the control device according to the present invention, the control device includes a processor and a storage device. The storage device can be configured to store a program for executing the target re-identification method of the above-mentioned method embodiment, and the processor can be configured to execute the program in the storage device, which includes but is not limited to a program for executing the target re-identification method of the above-mentioned method embodiment. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The control device can be a control device device formed by various electronic devices.
[0139] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the target re-identification method of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned target re-identification method. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-transitory computer-readable storage medium.
[0140] Furthermore, it should be understood that since the configuration of each module is merely for the purpose of illustrating the functional units of the apparatus of the present invention, the physical devices corresponding to these modules may be the processor itself, or a portion of the software in the processor, a portion of the hardware, or a combination of software and hardware. Therefore, the number of modules in the figure is merely illustrative.
[0141] Those skilled in the art will appreciate that the various modules in the device can be adaptively split or merged. Such splitting or merging of specific modules does not cause the technical solution to deviate from the principles of the present invention. Therefore, the technical solutions after splitting or merging will fall within the scope of protection of the present invention.
[0142] Thus far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present invention.
Claims
1. A method for training a target re-identification model, characterized in that: include: Train the homography model; Training a target re-identification model; wherein the homography model and the target re-identification model use the same backbone network for feature extraction during training; The homography model includes a backbone network and a homography estimation module. The training of the homography model includes: inputting associated images into the backbone network for feature extraction to obtain a first feature map and a second feature map, wherein the associated images are obtained from the same target under different camera perspectives; inputting the first feature map and the second feature map into the homography estimation module for homography estimation to obtain a third image, wherein the third image is a perspective-corrected image of one of the associated images; The training of the target re-identification model includes: inputting the third image into the target re-identification model composed of the backbone network and the detection head to train the target re-identification model; and / or inputting the sample image in the sample library into the target re-identification model composed of the backbone network and the detection head to train the target re-identification model; Inputting the third image into the target re-identification model composed of the backbone network and the detection head to train the target re-identification model includes: inputting the third image into the backbone network to extract features to obtain a third feature map; inputting the third feature map into the detection head to obtain a training result; The homography estimation module also includes a homography neural network model, and the first feature map and the second feature map are input into the homography estimation module for homography estimation to obtain a third image, including: dividing the first feature map and the second feature map into blocks respectively, and the block division divides any one of the first feature map and the second feature map into at least two blocks, wherein the blocks of the first feature map and the blocks in the second feature map are in a corresponding relationship; inputting the first feature map and the second feature map after block division into the homography neural network model to obtain a homography matrix corresponding to the blocks; and obtaining the third image based on the homography matrix, the associated image, and the first feature map after block division or the second feature map after block division.
2. The object re-identification model training method according to claim 1, characterized in that The target re-identification model also includes a neck network; Inputting the third image into an object re-identification model composed of at least the backbone network and the detection head to train the model includes: Inputting the third image into the backbone network for feature extraction to obtain a third feature map; Inputting the third feature map into the neck network for feature fusion to obtain a fused feature map; The fused feature map is input into the detection head to obtain a training result.
3. The object re-identification model training method according to claim 1, characterized in that The homography estimation module further includes a homography neural network model; inputting the first feature map and the second feature map into the homography estimation module for homography estimation to obtain a third image, including: The first feature map and the second feature map are feature maps having at least two scales; Merging the feature maps of different scales in the first feature map and the second feature map to obtain a first merged feature map and a second merged feature map; Performing block division on the first merged feature map and the second merged feature map, respectively, wherein the block division divides any one of the first merged feature map and the second merged feature map into at least two blocks, wherein the blocks of the first merged feature map correspond to the blocks in the second merged feature map; Input the first merged feature map and the second merged feature map after block division into the homography neural network model to obtain the homography matrix corresponding to the block; The third picture is obtained based on the homography matrix, the associated picture, and the first merged feature map after block division or the second merged feature map after block division.
4. A target re-identification method, characterized in that: include: Obtain the target image to be identified; Inputting the target image to be identified into a target re-identification model to obtain a recognition result, wherein the target re-identification model is composed of at least the backbone network and the detection head, The target re-identification model is trained by the target re-identification model training method according to claim 1.
5. A control device comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by the processor to execute the target re-identification model training method described in any one of claims 1-3 or the target re-identification method described in claim 4.
6. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the target re-identification model training method described in any one of claims 1-3 or the target re-identification method described in claim 4.
Citation Information
Patent Citations
Twin network structure target tracking method fusing target re-identification
CN113963032A
Target re-identification method, target re-identification model acquisition method and device, and terminal equipment
CN115424090A