Image base library updating method and device, equipment and storage medium
By extracting semi-structured and structured features from images, the images to be updated in the image database are updated, which solves the problem of insufficient image quality improvement in existing technologies and achieves more efficient image updating and recognition accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2026-04-14
AI Technical Summary
Existing image database update methods cannot guarantee improved image quality after updates, resulting in invalid update operations and wasting time and physical resources.
By extracting semi-structured and structured features of the target region image from the image to be processed, the image to be updated in the image database is determined and updated to the image to be processed, ensuring that the image database contains richer and more diverse features.
It improves the image quality of the image database, enhances the accuracy of target recognition, and avoids resource waste caused by invalid update operations.
Smart Images

Figure CN115393903B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, device and storage medium for updating an image database. Background Technology
[0002] With the continuous development of image processing technology, target recognition technology is becoming increasingly mature. In the target recognition process, such as pedestrian recognition, user images are usually processed based on a pre-built image database, and the image database is updated to improve recognition accuracy.
[0003] Current methods for updating the image database typically involve collecting new user images at regular time intervals and updating the image database with the new user images; or selecting the user image with the highest resolution from multiple user images collected within a certain time interval and updating the image database with the highest resolution user image.
[0004] However, since the new user image or the highest resolution user image may be no different from the user image in the image library, the method of updating the image library cannot guarantee that the image quality of the updated image library will be improved. That is, there are invalid update operations, which cause the consumption of time and physical resources. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, device, and storage medium for updating an image database, so as to solve the problem that existing image database updating methods cannot guarantee the improvement of image quality after updating the image database.
[0006] This application provides a method for updating an image database, including:
[0007] Obtain the target region image from the image to be processed;
[0008] The target region image is processed by performing a first feature extraction method to obtain semi-structured features of the target region image. The semi-structured features include unstructured features within two or more preset structured regions in the target region image.
[0009] The target region image is processed by a second feature extraction method to obtain the structured features of the target region image, wherein the structured features include preset structured features.
[0010] If it is determined from the semi-structured features and the structured features that there is an image to be updated in the image database, then the image to be updated is updated to the image to be processed.
[0011] This application provides an image library update device, comprising: a processor, a memory electrically connected to the processor, the memory storing a computer program, and the processor being configured to call and execute the computer program from the memory to implement the steps of any of the methods described herein.
[0012] In this embodiment, a target region image is obtained from an image to be processed; a first feature extraction process is performed on the target region image based on a first feature extraction method to obtain semi-structured features of the target region image; a second feature extraction process is performed on the target region image based on a second feature extraction method to obtain structured features of the target region image; if it is determined that an image to be updated exists in the image database based on the obtained semi-structured features and structured features, then the image to be updated is updated to the image to be processed. Thus, by extracting the semi-structured features and structured features of the target region image, multiple features of the target corresponding to the target region image can be comprehensively reflected through these features. Therefore, when it is determined that an image to be updated exists in the image database based on these features, the image to be updated is updated to the image to be processed, so that the updated image database can contain richer and more diverse features of the target. This not only improves the image quality of the image database and provides a guarantee for improving the accuracy of target recognition, but also ensures the effectiveness of the image database update operation, avoiding the waste of time and physical resources caused by invalid update operations. Attached Figure Description
[0013] Figure 1 This is a schematic diagram of a first process for updating an image database, provided in an embodiment of this specification.
[0014] Figure 2 A schematic diagram illustrating a method of dividing the human body into regions, as provided in an embodiment of this specification;
[0015] Figure 3 A second flowchart illustrating an image database update method provided in an embodiment of this specification;
[0016] Figure 4 A schematic diagram of a third method for updating an image database provided in an embodiment of this specification;
[0017] Figure 5 A schematic diagram of a fourth method for updating an image database provided in an embodiment of this specification;
[0018] Figure 6A fifth flowchart illustrating an image database update method provided in an embodiment of this specification;
[0019] Figure 7 A schematic diagram of the module composition of an image database updating device provided in the embodiments of this specification;
[0020] Figure 8 A schematic diagram illustrating the composition of an image database update device provided in an embodiment of this specification;
[0021] Figure 9 This is a flowchart illustrating an image database update method provided in Embodiment 2.
[0022] Figure 10 This is a schematic diagram of performing first feature extraction processing on a human body region image based on a first feature extraction method.
[0023] Figure 11 This is another flowchart illustrating the image library update method provided in Embodiment 2. Detailed Implementation
[0024] To make the objectives, technical means, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings.
[0025] In the following embodiments, the updating of the human image database is used as an example for illustration. It should be understood that this application is not limited to the updating of the human image database, and the updating of other target image databases such as vehicles, faces, and text can also be applied.
[0026] Example 1
[0027] Figure 1 This specification provides a flowchart illustrating a method for updating an image database according to one or more embodiments. The method is applied to an image database updating device, which can be deployed in a terminal device or a server. The terminal device can be a mobile phone, tablet computer, desktop computer, laptop, etc.; the server can be a standalone server or a server cluster consisting of multiple servers.
[0028] See Figure 1 The method may specifically include the following steps:
[0029] Step 102: Obtain the human body region image from the image to be processed;
[0030] Specifically, the process involves acquiring an image to be processed, performing human body region detection processing on the image according to a preset detection algorithm to obtain the human body region, and then cropping the human body region image from the image to be processed based on the obtained human body region. The method of acquiring the image to be processed can be customized according to the needs of the actual application. For example, the image database update device may have an image acquisition function, allowing it to acquire and process images to obtain the image to be processed; alternatively, the image database update device may receive the image to be processed sent by an acquisition device, or receive images to be processed sent by other devices. The preset detection algorithm can be any algorithm from SSD, YoloV3, YoloV5, etc., or it can be an algorithm specifically designed for human body region detection, which is improved from any algorithm from SSD, YoloV3, YoloV5. This application does not impose specific limitations on this. It should be noted that the human body region in the image to be processed can be the user's face, upper body, full body, etc.; there can be one or multiple human body regions in the image to be processed. When there are multiple human body regions in the image to be processed, subsequent processing is performed separately for each human body region.
[0031] Step 104: Perform first feature extraction processing on the human body region image based on the first feature extraction method to obtain the semi-structured features of the human body region image;
[0032] The first feature extraction method can be person re-identification. In one implementation, a pre-trained PCB (Part-based Convolutional Baseline) network can be used to perform the first feature extraction processing on the human region image. That is, the human region image is input into the PCB network for first feature extraction processing, and the output is a semi-structured feature of the human region image. In another implementation, a pre-trained MGN (Multiple Granularity Network) network can be used to perform the first feature extraction processing on the human region image. That is, the human region image is input into the MGN network for first feature extraction processing, and the output is a semi-structured feature of the human region image. The training process of the PCB network and the MGN network can refer to existing training methods, which will not be detailed in this specification. It should be noted that the first feature extraction method is not limited to the above methods and can be set according to needs in practical applications.
[0033] Semi-structured features can include local features of each local region of the human body obtained by dividing the human body region according to two or more pre-defined structured region division methods, such as local features of the upper body, local features of the lower body, etc.; semi-structured features can also include global features of the entire human body region. Since the first feature extraction method extracts features from pre-defined structured regions in the human body image, compared to the feature extraction method for unstructured regions, this makes each local feature have a certain structured characteristic as a whole, while the individual features within each local feature are unstructured. Therefore, semi-structured features include: unstructured features within two or more pre-defined structured regions in the target region image.
[0034] This application uses the example of employing an MGN network to perform first feature extraction processing on a human body region image, where the human body region image includes the user's entire body. The method for dividing the human body region is as follows: Figure 2 As shown, Figure 2 (1) in the figure represents the entire human body region, corresponding to the global feature p0; Figure 2 (2) is to divide the human body region into two local regions, upper and lower, by half the height of the human body region, which correspond to local features p1 and p2 respectively; Figure 2 In (3), the human body region is divided into three local regions—upper, middle, and lower—based on 1 / 3 of its height, corresponding to local features p3, p4, and p5, respectively. Correspondingly, the semi-structured features of the resulting human body region image can include p0, p1, p2, p3, p4, and p5. Where p0, p1, p2, p3, p4, and p5 can all be 1*128 dimensional vectors. It should be noted that... Figure 2 For illustrative purposes only and not for limitation.
[0035] Step 106: Perform second feature extraction processing on the human body region image based on the second feature extraction method to obtain the structured features of the human body region image;
[0036] The second feature extraction method can be a human orientation recognition method. In one implementation, a pre-trained DeepSAR-DeepMAR network can be used to perform second feature extraction processing on the human region image to obtain the structured features of the human region image. That is, the human region image is input into the DeepSAR-DeepMAR network for second feature extraction processing, and the structured features of the human region image are output. The training process of the DeepSAR-DeepMAR network can refer to existing training methods, which will not be detailed in this specification. It should be noted that the second feature extraction method is not limited to the above-mentioned method and can be set according to needs in practical applications.
[0037] Structured features can include multiple pre-defined structured sub-features, each of which can include at least one fixed feature and at least one non-fixed feature. Fixed features are those that do not change within a certain timeframe, such as age or gender; non-fixed features are those that change within a certain timeframe, such as clothing color, style, color, style, hairstyle, and hair color. Since the second feature extraction method extracts pre-defined features from human images, the structured features include pre-defined structured features.
[0038] In this embodiment of the application, the second feature extraction processing of the human body region image is performed using the DeepSAR-DeepMAR network. The fixed features include age and gender, and the non-fixed features include upper garment color, upper garment style, lower garment color, and lower garment style. The structured features of the human body region image can be obtained as follows: age a0, gender a1, upper garment color a2, lower garment color a3, upper garment style a4, and lower garment style a5. Among them, a0, a1, a2, a3, a4, and a5 are all 1*1 dimensional vectors.
[0039] Step 108: If it is determined from the obtained semi-structured features and structured features that there is an image to be updated in the image base library, then the image to be updated is updated to the image to be processed.
[0040] The image database in this application can be used for identity recognition processing such as pedestrian recognition and face recognition. In order to improve the accuracy of recognition, the image database in this application may include at least one user image of each user and semi-structured features and structured features of each user image. At least one user image of the same user can be associated with the user's user identifier. The user identifier may be an identifier assigned to the user when the user's first user image is saved to the image database, which is used to uniquely identify the user.
[0041] In this embodiment, a human body region image is obtained from an image to be processed; a first feature extraction process is performed on the human body region image based on a first feature extraction method to obtain semi-structured features of the human body region image; a second feature extraction process is performed on the human body region image based on a second feature extraction method to obtain structured features of the human body region image; if it is determined that an image to be updated exists in the image database based on the obtained semi-structured features and structured features, then the image to be updated is updated to the image to be processed. Therefore, by extracting the semi-structured features and structured features of the human body region image, multiple user characteristics of the target user corresponding to the human body region image can be comprehensively reflected through these semi-structured features and structured features. Thus, when it is determined that an image to be updated exists in the image database based on these semi-structured features and structured features, the image to be updated is updated to the image to be processed, so that the updated image database can contain richer and more diverse user characteristics of the target user. This not only improves the image quality of the image database, providing a guarantee for improving the accuracy of pedestrian recognition, but also ensures the effectiveness of the image database update operation, avoiding the waste of time and physical resources caused by invalid update operations.
[0042] Since the image database includes user images from multiple users, and at least one user image from each user, in order to improve the effectiveness of updating the image database, one or more embodiments of this application, such as Figure 3 As shown, step 107-2 and step 107-4 may also be included before step 108:
[0043] Step 107-2: Determine whether there is a target image of the target user corresponding to a human body region image in the image database;
[0044] Furthermore, if it is determined that there is no target image of the target user corresponding to the human body region image in the image database, then it is determined that the user corresponding to the human body region image is a new user. The image database update device can display the image to be processed marked with the human body region through the display module and prompt the user to identify the human body region belonging to themselves. After the image database update device obtains the user's confirmation information, it extracts the human body region image of the user from the image to be processed and assigns a user identifier to the user. Then, it extracts the semi-structured features and structured features of the user's human body region image in accordance with the methods of steps 104 and 106, and saves the user's human body region image, the assigned user identifier, and the semi-structured features and structured features of the human body region image in association to the image database.
[0045] Step 107-4: If yes, add the user identifier associated with the target image to the human body region image.
[0046] Specifically, if it is determined that there are multiple target images of the target user corresponding to the human body region image in the image database, the number of target images is counted and it is determined whether the number of target images has reached the preset number; if so, a user identifier associated with the target image is added to the human body region image.
[0047] Furthermore, if the number of target images is determined to be less than the preset number, the image to be processed, its semi-structured and structured features, and the user identifier associated with the target image are saved to the image database. The preset number can be set as needed in practical applications, for example, a preset number of 10.
[0048] It should be noted that the execution order of steps 107-2 and 107-4 is not limited to [specific order]. Figure 3 As shown in the sequence, for different implementations of step 107-2, steps 107-2 and 107-4 can also be executed between steps 102 and 104, as can be seen in the relevant description in the specific embodiments section below.
[0049] Corresponding to steps 107-2 and 107-4, such as Figure 3 As shown, step 108 may include the following step 108-2:
[0050] Step 108-2: If, based on the semi-structured features and structured features, it is determined that there is an image to be updated among the target images included in the image base library, then the image to be updated is updated to the image to be processed.
[0051] To accurately determine the image to be updated, in one or more embodiments of this application, calculations are performed based on the semi-structured and structured features of the target image and the semi-structured and structured features of the image to be processed, and the calculation results determine that the target image contains the image to be updated. Specifically, as shown... Figure 4 As shown, steps 107-6 to 107-10 may also be included before step 108-2:
[0052] Step 107-6: Based on the user identifier added to the human body region image, obtain the semi-structured features and structured features of each associated target image;
[0053] Specifically, based on the user identifier added to the human body region image, the semi-structured and structured features of each target image associated with it are obtained from the image database.
[0054] It should be noted that the semi-structured and structured features of each user image in the image base library can also be associated with the image identifier of each user image and stored in the image feature library. Accordingly, step 107-6 may include: obtaining the associated image identifier of each target image stored in the image base library based on the user identifier added to the human body region image, and obtaining the associated semi-structured and structured features from the image feature library based on the image identifier.
[0055] Steps 107-8: For each target image, calculate the first Euclidean distance between each local feature in the semi-structured features of the target image and the image to be processed, and obtain multiple first Euclidean distances corresponding to each target image;
[0056] Taking the semi-structured features p1, p2, p3, p4, and p5 from the aforementioned example as an example, the first Euclidean distance between each local feature of the image to be processed and the target image can be calculated using the following formula:
[0057]
[0058] Where n is used to represent local features, n∈{p1, p2, p3, p4, p5}; Characterizing the target image f g Local features n, The target image f g The local feature of n is an element; Characterize the image f to be processed q Local features n, The image to be processed is f q The local feature of n is an element.
[0059] Taking a preset quantity of 10 as an example, for ease of description, the 10 target images are respectively labeled as target image 1, target image 2, target image 3... target image 10. It can be understood that, for target image 1, the first Euclidean distance 1 between the local feature p1 of target image 1 and the local feature p1 of the image to be processed, the first Euclidean distance 2 between the local feature p2 of target image 1 and the local feature p2 of the image to be processed, the first Euclidean distance 3 between the local feature p3 of target image 1 and the local feature p3 of the image to be processed, the first Euclidean distance 4 between the local feature p4 of target image 1 and the local feature p4 of the image to be processed, and the first Euclidean distance 5 between the local feature p5 of target image 1 and the local feature p5 of the image to be processed are calculated. That is, target image 1 corresponds to 5 first Euclidean distances; similarly, each of the other target images corresponds to 5 first Euclidean distances.
[0060] Steps 107-10: For each target image, calculate the XOR value between each sub-feature included in the structured features of the target image and the image to be processed, and obtain multiple XOR values corresponding to each target image;
[0061] For example, the structured features include four sub-features, which can be understood as each target image corresponding to four XOR values.
[0062] Corresponding to steps 107-6 to 107-10, such as Figure 4 As shown, step 108-2 may include the following step 108-22:
[0063] Steps 108-22: If it is determined that there is an image to be updated in the target image based on the first Euclidean distance and XOR value corresponding to each target image, then the image to be updated is updated to the image to be processed.
[0064] Specifically, for each target image, a first number of first Euclidean distances less than a first threshold are determined among multiple first Euclidean distances corresponding to the target image, and a second number of XOR values equal to a preset value are determined among multiple XOR values corresponding to the target image. For each target image, it is determined whether the first number of the target image is not less than a first preset number, and whether the second number of the target image is not less than a second preset number; if both determinations are yes, the corresponding target image is determined as a candidate image; based on the multiple first Euclidean distances of the candidate images, the image to be updated among the candidate images is determined; the image to be updated is updated as the image to be processed. The first threshold, the first preset number, the preset XOR value, and the second preset number can all be set as needed in practical applications; for example, the first threshold is 0.3, the first preset number is 2, the preset XOR value is 0, and the second preset number is 1.
[0065] Furthermore, determining the image to be updated among the candidate images based on the first Euclidean distance of the candidate images may include: determining whether the number of candidate images is greater than one; if so, for each candidate image, summing the multiple first Euclidean distances of the candidate images to obtain the total distance of each candidate image; sorting the total distances to obtain the minimum total distance, and determining the candidate image corresponding to the minimum total distance as the image to be updated; if not, determining the candidate image as the image to be updated.
[0066] Furthermore, updating the image to be updated to the image to be processed may include: deleting the image to be updated, its semi-structured features and structured features from the image base library, and associating and saving the image to be processed, its semi-structured features and structured features, and the user identifier of the target user into the image base library.
[0067] Therefore, based on semi-structured features, the first Euclidean distance between each local feature of each target image and the image to be processed is calculated; and based on structured features, the XOR value between each sub-feature of each target image and the image to be processed is calculated; and based on the first Euclidean distance and XOR value corresponding to each target image, the image to be updated is determined, and the image to be updated is updated to the image to be processed. This image database update method allows the image database to include richer and more diverse features of the same user, ensuring greater intraclass diversity among user images of the same user in the image database, and improving the image quality of the image database.
[0068] In one specific embodiment, before performing the first feature extraction process, it can be determined whether multiple target images of the target user corresponding to human body regions exist in the image database based on face recognition. Furthermore, the multiple sub-features included in the structured features can all be non-fixed features, meaning that multiple XOR values corresponding to the target images are calculated based on these non-fixed features. Specifically, for example... Figure 5 As shown, the method may include:
[0069] Step 202: Obtain the human body region image from the image to be processed;
[0070] The implementation method of this step is the same as that of step 102 mentioned above, and you can refer to the relevant description above.
[0071] Step 204: Perform face detection processing on the human body region image according to the preset face detection method. If the result of the face detection processing is that a face is detected, then the detected face is identified as the face to be identified.
[0072] In one implementation, the RetinaFace algorithm can be used to perform face detection processing on human body region images. It should be noted that the face detection method is not limited to the aforementioned method, and can be set according to the needs of practical applications.
[0073] Furthermore, the process ends when the face detection results in no detected face.
[0074] Step 206: Determine whether a target face matching the face to be identified exists in the image database according to the preset face recognition method;
[0075] In one implementation, FaceNet can be used to match the face to be identified with the faces included in each user image in the image database. It should be noted that the face recognition method is not limited to the aforementioned method and can be customized as needed in practical applications.
[0076] Step 208: If yes, then determine that there is a target image of the target user corresponding to the human body region image in the image base library, and determine each user image associated with the user identifier of the user image including the target face as the target image;
[0077] In other words, the aforementioned step 107-2 can be achieved through steps 204 to 208.
[0078] Step 210: Count the number of target images and determine whether the number of target images has reached the preset number; if so, add the user identifier associated with the target image to the human body region image.
[0079] Step 212: Perform first feature extraction processing on the human body region image based on the first feature extraction method to obtain the semi-structured features of the human body region image;
[0080] The semi-structured features in this embodiment may include only local features of local areas of the human body, such as p1, p2, p3, p4 and p5 in the aforementioned example.
[0081] Step 214: Perform second feature extraction processing on the human body region image based on the second feature extraction method to obtain the structured features of the human body region image;
[0082] The structured features in this embodiment may include only non-fixed specific features, such as a2, a3, a4, and a5 in the aforementioned examples.
[0083] Step 216: Based on the user identifier added to the human body region image, obtain the semi-structured features and structured features of each associated target image;
[0084] Step 218: For each target image, calculate the first Euclidean distance between each local feature included in the semi-structured features of the target image and the image to be processed, and obtain multiple first Euclidean distances corresponding to each target image;
[0085] Step 220: For each target image, calculate the XOR value between each non-fixed feature included in the structured features of the target image and the image to be processed, and obtain multiple XOR values corresponding to each target image;
[0086] Taking the non-fixed features a2, a3, a4, and a5 from the aforementioned examples as an example, the XOR value between each non-fixed feature of the target image and the image to be processed can be calculated using the following formula:
[0087]
[0088] Where m is a non-fixed feature in the structured features, i.e., m∈{a2, a3, a4, a5}; Represents the target image fg The non-fixed feature m; The image to be processed is f q The non-fixed feature m.
[0089] Step 222: For each target image, determine the first number of first Euclidean distances greater than the first threshold among the multiple first Euclidean distances corresponding to the target image, and determine the second number of XOR values equal to the preset value among the multiple XOR values corresponding to the target image.
[0090] Step 224: For each target image, determine whether the first number of target images is not less than the first preset number, and determine whether the second number of target images is not less than the second preset number; if the determination results are both yes, then the corresponding target image is determined as a candidate image.
[0091] Step 226: Determine whether the number of candidate images is greater than one. If yes, proceed to step 228; otherwise, proceed to step 230.
[0092] Step 228: For each candidate image, sum the multiple first Euclidean distances of the candidate image to obtain the total distance of each candidate image; determine the candidate image corresponding to the minimum total distance among the total distances as the image to be updated, and execute step 232;
[0093] Step 230: The candidate images are determined as the images to be updated;
[0094] Step 232: Update the image to be updated to the image to be processed.
[0095] The specific implementation process of steps 210 to 218 and steps 222 to 232 can be found in the relevant descriptions above, and the repeated parts will not be repeated here.
[0096] In this embodiment, multiple target images of the target user corresponding to the image to be processed are determined in the image database based on face recognition, which improves the accuracy of the target images and thus ensures the accuracy of image updates.
[0097] In another specific embodiment, after obtaining the semi-structured features of the image to be processed, it can be determined, based on these semi-structured features, whether there are multiple target images of the target user corresponding to human body regions in the image database. Furthermore, the structured features include multiple sub-features that can be both fixed and non-fixed features; that is, multiple XOR values corresponding to each target image are calculated based on these fixed and non-fixed features. Specifically, for example... Figure 6 As shown, the method may include:
[0098] Step 302: Obtain the human body region image from the image to be processed;
[0099] Step 304: Perform first feature extraction processing on the human body region image based on the first feature extraction method to obtain the semi-structured features of the human body region image;
[0100] The semi-structured features in this embodiment may include global features and local features, such as p0, p1, p2, p3, p4 and p5 in the aforementioned example.
[0101] Step 306: Perform second feature extraction processing on the human body region image based on the second feature extraction method to obtain the structured features of the human body region image;
[0102] The structured features in this embodiment may include at least one fixed feature and at least one non-fixed feature, such as a0, a1, a2, a3, a4 and a5 in the aforementioned examples.
[0103] Step 308: Merge the global features and local features included in the semi-structured features of the human body region image to obtain the first merged feature;
[0104] Specifically, the semi-structured features of the human body region image, including global features and local features, are stitched together to obtain the first merged feature. The stitching order of each feature can be set as needed in practical applications.
[0105] Taking the semi-structured features p0, p1, p2, p3, p4, and p5 from the previous example as an example, since p0, p1, p2, p3, p4, and p5 are all 1*128 dimensional vectors, the first merged feature is a 1*768 dimensional vector.
[0106] Step 310: Obtain the second merged feature for each user image in the image base database;
[0107] Specifically, the semi-structured and structured features of each user image in the image database are obtained. These features are then merged to obtain a second merged feature for each user image. The process of merging the semi-structured and structured features of each user image is the same as the process described above for merging the semi-structured and structured features of the image to be processed; please refer to the aforementioned description. It is understood that the second merged feature is also a 1*768 dimensional vector.
[0108] Step 312: Calculate the second Euclidean distance between the human body region image and each user image based on the first merging feature and the second merging feature;
[0109] Specifically, based on the first and second merging features, the second Euclidean distance between the human body region image and each user image is calculated using the following formula:
[0110]
[0111] Among them, f g Characterizes the user image, f q Using an image representing a human body region, d(f) g f q f is the second Euclidean distance between the human body region image and the user image. g ={x1, x2, ..., x 768}, x1, x2, ..., x 768 For each element in the second merge feature, f q ={y1, y2, ..., y 768}, y1, y2, ..., y 768 These are the elements in the first merge feature.
[0112] It is understandable that the number of first Euclidean distances can be obtained as many times as the number of user images included in the image database; for example, if the image database includes 100 user images, 100 first Euclidean distances can be calculated.
[0113] Step 314: Sort the second Euclidean distances to obtain the minimum second Euclidean distance; if the minimum second Euclidean distance is greater than the second threshold, then the user image corresponding to the minimum second Euclidean distance is determined as the image to be matched.
[0114] Step 316: Obtain the fixed features in the structured features of the image to be matched, and determine whether the fixed features of the image to be processed are the same as the fixed features of the image to be matched.
[0115] Taking the structured features of the aforementioned example, including a0, a1, a2, a3, a4, and a5, as an example, we obtain a0 and a1 from the structured features of the image to be matched, determine whether a0 of the image to be matched is the same as a0 of the image to be processed, and determine whether a1 of the image to be matched is the same as a1 of the image to be processed.
[0116] Step 318: If yes, then determine that there is a target image of the target user corresponding to the human body region image in the image base database, and identify the user of the image to be matched in each base database image associated with it in the image base database, and determine it as the target image;
[0117] Specifically, if it is determined that a0 of the image to be matched is the same as a0 of the image to be processed, and it is determined that a1 of the image to be matched is the same as a1 of the image to be processed, then it is determined that there is a target image of the target user corresponding to the human body region image in the image base database, and the user identifier of the image to be matched is associated with each base database image in the image base database and determined as the target image.
[0118] In other words, the aforementioned step 107-2 can also be achieved through steps 308 to 318.
[0119] Step 320: Count the number of target images and determine whether the number of target images has reached the preset number; if so, add the user identifier associated with the target image to the human body region image.
[0120] Step 322: Based on the user identifier added to the human body region image, obtain the semi-structured features and structured features of each associated target image;
[0121] Step 324: For each target image, calculate the first Euclidean distance between each local feature of the target image and the image to be processed, and obtain multiple first Euclidean distances corresponding to each target image;
[0122] Step 326: For each target image, calculate the XOR value between each fixed feature of the target image and the image to be processed, and the XOR value between each non-fixed feature, to obtain multiple XOR values corresponding to each target image;
[0123] Step 328: For each target image, determine the first number of first Euclidean distances greater than the first threshold among the multiple first Euclidean distances corresponding to the target image, and determine the second number of XOR values equal to the preset value among the multiple XOR values corresponding to the target image.
[0124] Step 330: For each target image, determine whether the first number of target images is not less than the first preset number, and determine whether the second number of target images is not less than the second preset number; if the determination results are both yes, then the corresponding target image is determined as a candidate image.
[0125] Step 332: Determine whether the number of candidate images is greater than one. If yes, proceed to step 334; otherwise, proceed to step 336.
[0126] Step 334: For each candidate image, sum the multiple first Euclidean distances of the candidate image to obtain the total distance of each candidate image; determine the candidate image corresponding to the minimum total distance among the total distances as the image to be updated, and proceed to step 338.
[0127] Step 336: The candidate images are determined as the images to be updated;
[0128] Step 338: Update the image to be updated to the image to be processed.
[0129] The implementation process of steps 302 to 306 and steps 320 to 338 can be found in the aforementioned descriptions, and the repeated parts will not be repeated here.
[0130] In this embodiment, the second Euclidean distance between the human body region image and each user image in the image database is calculated based on semi-structured features. Based on the second Euclidean distance, multiple target images of the target user corresponding to the image to be processed in the image database are determined. This not only ensures the accuracy of the target images and provides a guarantee for the accuracy of image updates, but also realizes the automatic updating of the image database without the need for face recognition.
[0131] In summary, it can be seen that in this embodiment, by extracting semi-structured and structured features from human body region images, multiple user characteristics of the target user corresponding to the human body region image can be comprehensively reflected through these semi-structured and structured features. Therefore, when it is determined that there is an image to be updated in the image database based on these semi-structured and structured features, the image to be updated is updated to the image to be processed, so that the updated image database can contain richer and more diverse user characteristics of the target user. This not only improves the image quality of the image database and provides a guarantee for improving the accuracy of pedestrian recognition, but also ensures the effectiveness of the image database update operation and avoids the waste of time and physical resources caused by invalid update operations.
[0132] Based on the same technical concept, one or more embodiments of this specification also provide an image database updating device. Figure 7 This specification provides a schematic diagram of the module composition of an image database updating device according to one or more embodiments, such as... Figure 7 As shown, the device includes:
[0133] Memory 401 is used to store the image base library;
[0134] The processor 402 is configured to acquire a human body region image from an image to be processed; perform a first feature extraction process on the human body region image based on a first feature extraction method to obtain a semi-structured feature of the human body region image; perform a second feature extraction process on the human body region image based on a second feature extraction method to obtain a structured feature of the human body region image; and if it is determined that there is an image to be updated in the image database based on the semi-structured feature and the structured feature, then update the image to be updated to the image to be processed.
[0135] Optionally, the device further includes: a determining module;
[0136] The determining module is used to determine whether there is a target image of the target user corresponding to the human body region image in the image database; if so, it adds a user identifier associated with the target image to the human body region image; the user identifier is used to identify the target user.
[0137] Accordingly, the processor 402 is specifically used for:
[0138] If, based on the semi-structured features and the structured features, it is determined that there exists an image to be updated in the target image associated with the user identifier in the image database, then the image to be updated is updated to the image to be processed.
[0139] Optionally, the semi-structured features include local features of multiple local human body regions obtained by dividing the human body region according to a preset region division method; the structured features include multiple sub-features; the device further includes: a first calculation module;
[0140] The first calculation module is configured to obtain the semi-structured features and the structured features of each associated target image based on the user identifier added to the human body region image; and,
[0141] For each target image, calculate the first Euclidean distance between each local feature of the target image and the image to be processed, and obtain multiple first Euclidean distances corresponding to each target image;
[0142] For each target image, calculate the XOR value between each sub-feature of the target image and the image to be processed to obtain multiple XOR values corresponding to each target image;
[0143] Accordingly, the processor 402 is further specifically used for:
[0144] If, based on the first Euclidean distance and the XOR value, it is determined that there is an image to be updated in the target image, then the image to be updated is updated to the image to be processed.
[0145] Optionally, the processor 402 is further specifically used for:
[0146] For each target image, a first number of first Euclidean distances less than a first threshold are determined among a plurality of first Euclidean distances corresponding to the target image, and a second number of XOR values equal to a preset value are determined among a plurality of XOR values corresponding to the target image.
[0147] For each target image, determine whether the first number of target images is not less than a first preset number, and determine whether the second number of target images is not less than a second preset number;
[0148] If all the results are yes, then the corresponding target image is determined as a candidate image;
[0149] Based on the plurality of first Euclidean distances between the candidate images, determine the image to be updated among the candidate images;
[0150] Update the image to be updated to the image to be processed.
[0151] Optionally, the processor 402 is further specifically used for:
[0152] Determine whether the number of candidate images is greater than one;
[0153] If so, for each candidate image, the multiple first Euclidean distances of the candidate image are summed to obtain the total distance of each candidate image; the candidate image corresponding to the minimum total distance among the total distances is determined as the image to be updated;
[0154] If not, the candidate image is determined as the image to be updated.
[0155] Optionally, the user images in the image database include faces, and the determining module is specifically used for:
[0156] The human body region image is processed for face detection according to a preset face detection method;
[0157] If the face detection process results in a detected face, then the detected face is identified as the face to be identified.
[0158] Determine whether a target face matching the face to be identified exists in the image database according to a preset face recognition method;
[0159] If so, then it is determined that there is a target image of the target user corresponding to the human body region image in the image base library, and each user image associated with the user identifier of the user image including the target face is determined as the target image.
[0160] Accordingly, the sub-feature includes at least one non-fixed feature; the processor 402 is further specifically used for:
[0161] For each target image, the XOR value between each non-fixed feature of the target image and the image to be processed is calculated to obtain multiple XOR values corresponding to each target image.
[0162] Optionally, the semi-structured features further include global features of the human body region, and the sub-features include at least one fixed feature; the determining module is specifically used for:
[0163] The global features and local features of the human body region image are merged to obtain a first merged feature;
[0164] Obtain the second merged feature of each user image in the image base library;
[0165] Based on the first merging feature and the second merging feature, calculate the second Euclidean distance between the human body region image and each of the user images;
[0166] The second Euclidean distance is sorted to obtain the minimum second Euclidean distance;
[0167] If the minimum second Euclidean distance is greater than the second threshold, then the user image corresponding to the minimum second Euclidean distance is determined as the image to be matched;
[0168] Obtain the fixed features of the image to be matched;
[0169] Determine whether the fixed features of the image to be processed are the same as the fixed features of the image to be matched;
[0170] If so, then it is determined that there is a target image of the target user corresponding to the human body region image in the image base library, and the user identifier of the image to be matched is identified as the target image in each base library image associated with the image base library.
[0171] Accordingly, the sub-feature also includes at least one non-fixed feature; the processor 402 is further specifically used for:
[0172] For each target image, the XOR value between each fixed feature of the target image and the image to be processed, and the XOR value between each non-fixed feature are calculated to obtain multiple XOR values corresponding to each target image.
[0173] Optionally, the determining module is further specifically used for:
[0174] Count the number of target images to determine whether the number of target images has reached a preset number;
[0175] If so, then add the user identifier associated with the target image to the human body region image.
[0176] The image database updating apparatus provided in this specification acquires a human body region image from an image to be processed; performs a first feature extraction process on the human body region image based on a first feature extraction method to obtain semi-structured features of the human body region image; performs a second feature extraction process on the human body region image based on a second feature extraction method to obtain structured features of the human body region image; if it is determined that there is an image to be updated in the image database based on the obtained semi-structured features and structured features, then the image to be updated is updated as the image to be processed. Therefore, by extracting the semi-structured features and structured features of the human body region image, multiple user characteristics of the target user corresponding to the human body region image can be comprehensively reflected through these semi-structured features and structured features. Thus, when it is determined that there is an image to be updated in the image database based on these semi-structured features and structured features, the image to be updated is updated as the image to be processed, so that the updated image database can contain richer and more diverse user characteristics of the target user. This not only improves the image quality of the image database, ensuring the accuracy of pedestrian recognition, but also ensures the effectiveness of the image database update operation, avoiding the waste of time and physical resources caused by invalid update operations.
[0177] Furthermore, since the above-described apparatus embodiments are basically similar to the method embodiments, the description is relatively simple, and relevant details can be found in the description of the method embodiments. Moreover, it should be noted that the various components of the apparatus of the present invention are logically divided according to their intended functions; however, the present invention is not limited to this, and the various components can be re-divided or combined as needed.
[0178] Based on the same technical concept, embodiments of this application also provide an image database update device, such as... Figure 8 As shown. The image library update device can vary considerably due to differences in configuration or performance, and may include one or more processors 501 and memory 502. Memory 502 may store one or more application programs or data. Memory 502 may be temporary or persistent storage. The application programs stored in memory 502 may include one or more modules (not shown), each module may include a series of computer-executable instructions for the image library update device. Furthermore, processor 501 may be configured to communicate with memory 502 and execute the series of computer-executable instructions in memory 502 on the image library update device. The image library update device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input / output interfaces 505, and one or more keyboards 506.
[0179] Specifically, in this embodiment, the image database update device includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the image database update device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following:
[0180] Obtain human body region images from the image to be processed;
[0181] The human body region image is processed by first feature extraction based on the first feature extraction method to obtain the semi-structured features of the human body region image.
[0182] The human body region image is processed by performing a second feature extraction based on the second feature extraction method to obtain the structured features of the human body region image;
[0183] If it is determined from the semi-structured features and the structured features that there is an image to be updated in the image database, then the image to be updated is updated to the image to be processed.
[0184] Example 2
[0185] In this embodiment, a sub-feature for characterizing the human body view orientation is added to the structured features, and this sub-feature information is used to improve the update efficiency of the image base library.
[0186] See Figure 9 As shown, Figure 9 This is a flowchart illustrating an image database update method provided in Embodiment 2. The method includes:
[0187] Step 901: Obtain the human body region image from the image to be processed;
[0188] Step 902: Based on the human body region image, use a human head detection algorithm, such as SSD, YoloV3, YoloV5, etc., to obtain the head region. If the head region is detected, proceed to step 903. If the human head region is not detected, it is determined to be an invalid human body region, and the process ends.
[0189] This step filters out low-quality image data.
[0190] Step 903: Perform first feature extraction processing on the human body region image based on the first feature extraction method to obtain the semi-structured features of the human body region image;
[0191] See Figure 10 As shown, Figure 10This diagram illustrates a method for extracting first features from a human body image using a first feature extraction approach. It takes image data of the entire human body region, or the human body region excluding the head region, and image data of the head region as input. The Reid algorithm is used for feature extraction, which achieves higher Reid metrics in clothing-changing tasks. The algorithm uses two CNN structures, such as ResNet and MobileNet, to compute features for the human body region and head region respectively, outputting two types of features: unstructured fusion features and unstructured head features. The fusion features are obtained by adding the results of the two CNNs bitwise, while the head features are directly obtained from the CNN used for head region feature extraction. As an example, the fusion feature vector is 1024-dimensional, and the head feature vector is also 1024-dimensional.
[0192] In this embodiment, the fusion feature may include the fusion of local features 1 of the human body region other than the head region and local features 2 of the head region. For example, in the aforementioned example, p4 and p5 constitute local feature 1, and p3 is local feature 2. It may also include the fusion of global features of the entire human body region and local features of the head region, such as p0 and p3 in the aforementioned example. Since local features 1 and local features 2 are feature extractions performed on a preset structured region, from an overall perspective, local features 1, local features 2, or global features and local features of the head region are structured. Therefore, the fusion feature and local features have semi-structured features.
[0193] It should be understood that, not generally, the semi-structured features include: fused features and local features, wherein,
[0194] Local features include: local features of at least one local region obtained by dividing the target region according to a preset structured region division method.
[0195] The fusion features include: the fusion features of the local features and the global features of the entire target region, or the fusion features of the local features and the local features of other regions in the target region other than the local region corresponding to the local feature.
[0196] Step 904: Perform second feature extraction processing on the human body region image based on the second feature extraction method to obtain the structured features of the human body region image;
[0197] The structured features in this embodiment may include at least one fixed feature and at least one non-fixed feature, such as a0, a1, a2, a3, a4 and a5, a6 in the aforementioned examples. Among them, a6 is a sub-feature used to characterize the human body's view orientation. In this embodiment, given the left-right symmetry of the human body and the limited image information available from top-down and bottom-up views, the human body's view orientation includes side view, front view, and back view. This sub-feature vector is one-dimensional and belongs to the category of non-fixed features.
[0198] Not generally, the view orientation may include one or any combination of the left view, right view, front view, rear view, top view, bottom view, or any combination thereof.
[0199] The steps 903 and 904 above do not have a strict order and can be executed in parallel.
[0200] Step 905: Based on the sub-features in the structured features used to characterize the human body view orientation, identify the view orientation of the acquired human body region image. If the acquired human body region image is a frontal view, proceed to step 906; otherwise, determine it as an invalid human body feature and end the process.
[0201] Step 906: Obtain the semi-structured features and structured features of each image in the image database. The semi-structured features include fused features and local features.
[0202] Step 907: For each base database image, determine the first similarity between the semi-structured features of the human body region image and the semi-structured features of the base database image.
[0203] Specifically,
[0204] The third Euclidean distance between the fused features of the human body region image and the fused features of the base database image is calculated mathematically as follows:
[0205]
[0206] in, Indicates fused features in the base database images The elements in Fusion features representing human body region images The elements in This is the third Euclidean distance;
[0207] The fourth Euclidean distance between the local features of the head region in the human body region image and the head features in the base image is calculated mathematically as follows:
[0208]
[0209] in, Representing head features in the base database image The elements in Head features representing human body regions in an image The elements in This is the fourth Euclidean distance;
[0210] The first similarity is obtained by weighted summation of the third and fourth Euclidean distances, expressed mathematically as follows:
[0211]
[0212]
[0213] Where df is the weighted summation of the Euclidean distance, and α is the weighting coefficient used for weighting, which is determined according to the human body view direction in the identified human body region image, and the value ranges from 0 to 1. α1 is greater than α2. For example, α1 is 0.5 and α2 is 0.2.
[0214] Step 908: Determine the second similarity between the structured features of the human body region image and the structured features of the base database image.
[0215] Specifically,
[0216] The XOR value between each structured feature of the human region image and the baseline image is calculated. This XOR value characterizes the similarity between the structured features of the baseline image and the structured features of the image to be processed. A higher XOR value of 1 indicates a greater number of distinct sub-features, lower similarity, and a greater difference in structured features between the human region image and the baseline image. Mathematically, this can be expressed as:
[0217]
[0218] Where m represents each sub-feature of the structured feature, and These represent the structured features of the base image and the human body region image, respectively, such as age, gender, upper garment color, lower garment color, upper garment style, lower garment style, and human body view orientation.
[0219] The steps 907 and 908 above do not have a strict order and can be processed in parallel.
[0220] Step 909: Based on the first similarity and the XOR value, determine whether the base image and the human body region image are images of the same target.
[0221] As an example, determine whether the first similarity is greater than the set first similarity threshold, and whether the third number of fixed feature XOR values in the XOR value equal to the preset value is not less than the third preset number;
[0222] If so, determine that the base image and the image to be processed belong to the same user, and proceed to step 910.
[0223] Otherwise, it is determined that the image in the database and the image to be processed are not from the same user. The next image in the database is searched, and the process returns to step 907 until all images in the database have been compared. Otherwise, the process ends.
[0224] Step 910: Based on the similarity of non-fixed features in the structured features, determine whether the conditions for updating the base database image are met.
[0225] In this step, the XOR value is used to determine whether the update condition is met. For example, it is determined whether the fourth number of non-fixed feature XOR values among the XOR values equal to the preset value is not less than the fourth preset number.
[0226] If so, it means that the non-fixed features of the image to be processed are significantly different from the non-fixed features of the base image, which meets the trigger update condition, and step 911 is executed.
[0227] Otherwise, it means that the non-fixed features of the image to be processed are not significantly different from the non-fixed features of the base image, so the base image update is not triggered and the process ends.
[0228] Step 911: Given that the same user may have multiple images in the image database, retrieve the target image of the same user associated with the image in the image database.
[0229] Step 912: Determine the image to be updated from the target image and replace the image to be processed with the image to be updated.
[0230] In this step, for each target image, the similarity between the semi-structured features of the target image and the semi-structured features of the image to be processed is calculated, resulting in multiple similarity values. The target image corresponding to the minimum similarity value is then updated and determined as the image to be updated, and replaced with the image to be processed, thereby completing the update of the target image.
[0231] Through the above steps 909-912, the image to be updated is determined based on the first similarity and the second similarity.
[0232] In this embodiment, step 905 determines whether to perform subsequent processing, which can filter out undesirable images to be processed and reduce the amount of computation. Step 909 can identify users without face recognition, thereby updating the base image database. This not only improves the efficiency of image database updates but also reduces the complexity of the base image update process.
[0233] As another implementation method, see Figure 11 As shown, Figure 11 This is another flowchart illustrating the image database update method provided in Embodiment 2. The method includes:
[0234] Steps 1101 to 1105 are the same as steps 901 to 905.
[0235] Step 1106: Merge the semi-structured features and structured features of the human body region image to obtain the third merged feature;
[0236] Specifically, the fusion feature, head feature, and structured feature are concatenated to obtain the third merged feature. The concatenation order of each feature can be set as needed in practical applications.
[0237] Taking a fusion feature vector of 1024 dimensions, a head feature vector of 1024 dimensions, and a second feature vector of 7 dimensions as an example, the third merged feature is a 2055-dimensional vector.
[0238] Step 1107: Obtain the fourth merged feature of each base image in the image base database;
[0239] Specifically, the semi-structured and structured features of each image in the image database are obtained. These features are then merged to obtain a fourth merged feature for each image. The process of merging the semi-structured and structured features of each image is the same as the process of merging the semi-structured and structured features of the image to be processed, as described above. It is understood that the fourth merged feature is also a 2055-dimensional vector.
[0240] Step 1108: Based on the third merging feature and the fourth merging feature, calculate the fifth Euclidean distance between the human body region image and each base database image to obtain multiple fifth Euclidean distances; sort the fifth Euclidean distances to obtain the minimum fifth Euclidean distance;
[0241] Step 1109: Determine whether the minimum fifth Euclidean distance is greater than the third threshold. If so, determine the target image corresponding to the minimum fifth Euclidean distance as the image to be matched; otherwise, end this process.
[0242] Step 1110: Obtain the fixed features of the image to be matched, and determine whether the fixed features of the human body region image are the same as the fixed features of the image to be matched.
[0243] If so, then the target image corresponding to the human body region image exists in the image base database, and the identifier of the image to be matched is associated with each base database image in the image base database and determined as the target image;
[0244] Otherwise, end this process.
[0245] Steps 1108 to 1110 above are used to determine whether there is a target image corresponding to a human body region image in the image base library.
[0246] Step 1111 is the same as step 912.
[0247] In this application, the memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0248] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0249] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described image database update method.
[0250] For the device / network-side equipment / storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and relevant parts can be referred to in the description of the method embodiments.
[0251] In this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0252] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method of updating an image library, characterized by, include: Obtain the target region image from the image to be processed, wherein the target region image is a human body region image; The target region image is processed by performing a first feature extraction based on the first feature extraction method to obtain the semi-structured features of the target region image. The semi-structured features include features in one or more regions obtained by dividing the human body region according to a preset human body region height division method. The target region image is processed by the second feature extraction method to obtain the structured features of the target region image. The structured features include multiple sub-features, including at least one fixed feature that does not change within a certain time and / or at least one non-fixed feature that changes within a certain time. If it is determined from the semi-structured features and the structured features that there is an image to be updated in the image database, then the image to be updated is updated to the image to be processed.
2. The method as described in claim 1, characterized in that, The step of determining that an image to be updated exists in the image database based on the semi-structured features and the structured features includes: Determine the first similarity between the semi-structured features of the target region image and the semi-structured features of the base database image. Determine the second similarity between the structured features of the target region image and the structured features of the base database image. Based on the first similarity and the second similarity, the image to be updated is determined.
3. The method of claim 2, wherein, If, based on the semi-structured features and the structured features, it is determined that an image to be updated exists in the image database, before updating the image to be updated to the image to be processed, the method further includes: Determine whether a target image corresponding to the target region exists in the image database; If so, then add an identifier associated with the target image to the target region image, the identifier being used to identify the target corresponding to the target region image; If it is determined from the semi-structured features and the structured features that an image to be updated exists in the image database, then updating the image to be updated to the image to be processed includes: If, based on the semi-structured features and structured features, it is determined that there is an image to be updated among the target images included in the image base library, then the image to be updated is updated to the image to be processed.
4. The method of claim 3, wherein, The semi-structured features are: local features of multiple local regions obtained by dividing the target region; If, based on the semi-structured features and the structured features, it is determined that there is an image to be updated among the target images included in the image base library, before updating the image to be updated to the image to be processed, the method further includes: Based on the identifier added to the target region image, obtain the semi-structured feature and the structured feature of each associated target image; Determining the first similarity between the semi-structured features of the target region image and the semi-structured features of the base image includes: For each target image, a first Euclidean distance is calculated between each local feature of the target image and the target region image, resulting in multiple first Euclidean distances corresponding to each target image. The first Euclidean distance is determined as the first similarity. Determining the second similarity between the structured features of the target region image and the structured features of the base image includes: For each target image, the XOR value between the target image and each sub-feature of the target region image is calculated to obtain multiple XOR values corresponding to each target image. The XOR value is determined as the second similarity. The step of determining the image to be updated based on the first similarity and the second similarity includes: Based on the first Euclidean distance and the XOR value, if it is determined that there is an image to be updated in the target image, then the image to be updated is updated to the image to be processed.
5. The method of claim 4, wherein, The step of determining that there is an image to be updated in the target image based on the first Euclidean distance and the XOR value, and then updating the image to be updated to the image to be processed, includes: For each target image, a first number of first Euclidean distances less than a first threshold are determined among a plurality of first Euclidean distances corresponding to the target image, and a second number of XOR values equal to a preset value are determined among a plurality of XOR values corresponding to the target image. For each target image, determine whether the first number of target images is not less than a first preset number, and determine whether the second number of target images is not less than a second preset number; If all the results are yes, then the corresponding target image is determined as a candidate image; Based on the plurality of first Euclidean distances between the candidate images, determine the image to be updated among the candidate images; Update the image to be updated to the image to be processed.
6. The method of claim 5, wherein, The step of determining the image to be updated among the candidate images based on the plurality of first Euclidean distances of the candidate images includes: Determine whether the number of candidate images is greater than one; If so, for each candidate image, the multiple first Euclidean distances of the candidate image are summed to obtain the total distance of each candidate image; the candidate image corresponding to the minimum total distance among the total distances is determined as the image to be updated; If not, the candidate image is determined as the image to be updated.
7. The method of claim 4, wherein, The image database contains images of human faces. Determining whether a target image corresponding to the target region image exists in the image database includes: The target region image is processed for face detection according to a preset face detection method; If the face detection process results in a detected face, then the detected face is identified as the face to be identified. Determine whether a target face matching the face to be identified exists in the image database according to a preset face recognition method; If so, then it is determined that there is a target image of the target user corresponding to the human body region image in the image base library, and each user image associated with the user identifier of the user image including the target face is determined as the target image.
8. The method of claim 4, wherein, When the sub-feature includes at least one non-fixed feature, the step of calculating the XOR value between each sub-feature of the target image and the target region image for each target image, to obtain multiple XOR values corresponding to each target image, includes: For each target image, the XOR value between the target image and each non-fixed feature of the target region image is calculated to obtain multiple XOR values corresponding to each target image.
9. The method of claim 4, wherein, When the semi-structured features also include global features of the entire target region and the sub-features include at least one fixed feature, determining whether a target image corresponding to the target region image exists in the image database includes: The global features and local features of the target region image are merged to obtain a first merged feature; Obtain the second merged feature of each image in the image database, wherein the second merged feature includes global features and local features of the image database; Based on the first merging feature and the second merging feature, calculate the second Euclidean distance between the target region image and each of the base database images; The second Euclidean distance is sorted to obtain the minimum second Euclidean distance; If the minimum second Euclidean distance is greater than the second threshold, then the base image corresponding to the minimum second Euclidean distance is determined as the image to be matched; Obtain the fixed features of the image to be matched; Determine whether the fixed features of the target region image are the same as the fixed features of the image to be matched; If so, then it is determined that there is a target image of the target region image in the image base library, and the identifier of the image to be matched is identified as the target image in each base library image associated with the image base library.
10. The method of claim 9, wherein, When the sub-feature further includes at least one non-fixed feature, the step of calculating the XOR value between each sub-feature of the target image and the target region image for each target image, to obtain multiple XOR values corresponding to each target image, includes: For each target image, calculate the XOR value between each fixed feature of the target image and the target region image, and the XOR value between each non-fixed feature, to obtain multiple XOR values corresponding to each target image.
11. The method of claim 3, wherein, Adding the identifier associated with the target image to the target region image includes: Count the number of target images to determine whether the number of target images has reached a preset number; If so, then add the identifier associated with the target image to the target region image.
12. The method of claim 3, wherein, The semi-structured features are: Fusion features and local features, among which, Local features include: local features of at least one local region obtained by dividing the target region. The fusion features include: fusion features of the local feature and global features of the entire target region, or fusion features of the local feature and local features of other regions in the target region besides the local region corresponding to the local feature. The structured features also include sub-features for characterizing the target view orientation; If, based on the semi-structured features and the structured features, it is determined that an image to be updated exists in the image database, before updating the image to be updated to the image to be processed, the method further includes: The view orientation of the target region image is identified based on the sub-features used to characterize the view orientation of the target. If the identified view orientation matches the set view orientation, then the step of determining that an image to be updated exists in the image database based on the semi-structured features and the structured features is executed. Otherwise, stop processing the image to be processed.
13. The method of claim 12, wherein, Determining the first similarity between the semi-structured features of the target region image and the semi-structured features of the base image includes: Calculate the third Euclidean distance between each local feature of the base image and the target region image. Calculate the fourth Euclidean distance between the fusion features of the base image and the target region image. The third Euclidean distance and the fourth Euclidean distance are weighted and summed, and the result of the weighted sum is determined as the first similarity. The weighting coefficients used for weighting are determined based on the identified view orientation; Determining the second similarity between the structured features of the target region image and the structured features of the base image includes: Calculate the XOR value between each sub-feature of the base image and the target region image, and determine the XOR value as the second similarity; The step of determining the image to be updated based on the first similarity and the second similarity includes: Based on the first similarity and the XOR value, it is determined whether the base image and the target region image are images of the same target. If so, determine whether the update condition is met based on the XOR value. If the update conditions are met, retrieve the target image of the same target associated with the image in the image database. Identify the image to be updated from the target image.
14. The method according to claim 13, characterized in that, When the sub-feature is a fixed feature and a non-fixed feature, and the sub-feature used to characterize the target view direction is a non-fixed feature, determining whether the base image and the target region image are images of the same target based on the first similarity and the XOR value includes: If the first similarity is greater than the set first similarity threshold and the third number of fixed feature XOR values in the XOR values equal to the preset value is not less than the third preset number, then the base image and the target region image are images of the same target. The step of determining whether the update condition is met based on the XOR value includes: If the fourth number of non-fixed feature XOR values among the XOR values equal to the preset value is not less than the fourth preset number, then the update condition is met; The step of determining the image to be updated from the target image includes: For each target image, a first similarity score is calculated between the target image and the semi-structured features of the target region image, resulting in multiple first similarity scores. The target image corresponding to the minimum similarity value is determined as the image to be updated.
15. The method according to claim 12, characterized in that, When the sub-features include fixed features and non-fixed features, determining whether a target image corresponding to the target region image exists in the image database includes: The fusion feature and the local feature of the target region image are merged to obtain a third merged feature; Obtain the fourth merging feature of each image in the image database, wherein the fourth merging feature includes the fusion feature and local features of the database images; Based on the third and fourth merging features, calculate the fifth Euclidean distance between the target region image and each of the base database images; The fifth Euclidean distance is sorted to obtain the minimum fifth Euclidean distance; If the minimum fifth Euclidean distance is greater than the third threshold, then the target image corresponding to the minimum fifth Euclidean distance is determined as the image to be matched; Obtain the fixed features of the image to be matched; Determine whether the fixed features of the target region image are the same as the fixed features of the image to be matched; If so, then it is determined that there is a target image corresponding to the target region image in the image base library, and the identifier of the image to be matched is identified as the target image in each base library image associated with it in the image base library.
16. An image database update device, characterized in that, include: A processor, a memory electrically connected to the processor, the memory storing a computer program, the processor being configured to call and execute the computer program from the memory to implement the steps of the method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Facial image dynamic database storage method and device, electronic equipment, medium and program
CN108228871A
Recognition method and system
CN108491773A
Face recognition method, device, electronic device and computer-readable medium
CN109117808A
Image base library updating method and device, equipment and storage medium
CN114429644A