Image data processing method, device, equipment and storage medium
By dynamically adjusting cluster construction based on the similarity comparison between cluster features and image features and cluster-related information in image data processing, the problem of storage and retrieval performance of billions of image data is solved, and efficient image data storage and retrieval is achieved.
Patent Information
- Application Number
- CN202211653875.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-22
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-12-22
AI Technical Summary
With the increase in image scale, especially the processing of image data with a data volume of billions, storage and retrieval performance issues are becoming increasingly prominent, resulting in increased economic costs and low retrieval efficiency.
By comparing the similarity between the first cluster features based on the preset cluster set and the target image features, the target cluster is selected, and the affiliation is established based on the cluster-related information, including judging the actual storage capacity and similarity of the cluster, dynamically adjusting the cluster construction to balance the image scale, and using the target database to store and update image features and cluster features.
It improves the storage efficiency and retrieval efficiency of image data, reduces economic costs, and ensures the efficiency and flexibility of image data processing.
Smart Images

Figure CN115880508B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence, in particular to cloud computing, big data and image search technology, and can be applied in intelligent cloud scenarios. Background Art
[0002] As the size of images continues to increase, the performance issues of image data processing, such as facial images, especially when the data volume is in the billions, are becoming increasingly prominent, often seriously reducing the user experience and bringing a heavy economic burden. Summary of the Invention
[0003] The present disclosure provides a method, apparatus, device, and storage medium for processing image data.
[0004] According to one aspect of the present disclosure, there is provided a method for processing image data, comprising:
[0005] Based on the first cluster features of the first clusters included in the preset cluster set, at least one target first cluster corresponding to the first image features of the target first image is selected; the target first image is one of the multiple first images for which an affiliation relationship is to be established; the preset cluster set includes multiple first clusters, and the first cluster features of the first clusters in the multiple first clusters are obtained based on the image features of multiple second images that have an affiliation relationship with the first cluster;
[0006] determining a target cluster that matches the target first image based on cluster related information of the at least one target first cluster;
[0007] Establishing an affiliation relationship between the target first image and the target cluster.
[0008] According to another aspect of the present disclosure, there is provided an image data processing apparatus, comprising:
[0009] a selection unit configured to select, based on first cluster features of first clusters included in a preset cluster set, at least one target first cluster corresponding to first image features of a target first image; the target first image being one of a plurality of first images for which an affiliation relationship is to be established; the preset cluster set including a plurality of first clusters, the first cluster features of a first cluster among the plurality of first clusters being obtained based on image features of a plurality of second images having an affiliation relationship with the first cluster;
[0010] a determining unit, configured to determine a target cluster matching the target first image based on cluster related information of the at least one target first cluster;
[0011] A relationship establishing unit is configured to establish an affiliation relationship between the target first image and the target cluster.
[0012] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method of any embodiment of the present disclosure.
[0016] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to any embodiment of the present disclosure.
[0017] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the method according to any embodiment of the present disclosure when executed by a processor.
[0018] In this way, the disclosed solution provides an efficient image data processing solution, thereby improving the storage efficiency of massive image data and laying the foundation for improving retrieval efficiency.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0021] Figure 1 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 1 ;
[0022] Figure 2 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 2 ;
[0023] Figure 3 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 3 ;
[0024] Figure 4 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 4 ;
[0025] Figure 5This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 5 ;
[0026] Figure 6(a) to Figure 6(c) This is a flowchart of an image data processing method according to an embodiment of the present application in a specific embodiment;
[0027] Figure 7 This is a flowchart of a face image retrieval method according to an embodiment of the present application in a specific embodiment;
[0028] Figure 8 is a structural diagram of an image data processing device according to an embodiment of the present application;
[0029] Figure 9 It is a block diagram of an electronic device used to implement the image data processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0031] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The term "at least one" in this article means any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C. The terms "first" and "second" in this article refer to multiple similar technical terms and distinguish them, and do not mean to limit the order or to limit to only two. For example, the first feature and the second feature refer to two categories / two features. The first feature can be one or more, and the second feature can also be one or more.
[0032] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.
[0033] As the scale of images continues to increase, the storage and retrieval problems of image data, such as facial images, are becoming increasingly prominent, especially when the data volume is in the billions. This often brings heavy economic costs. Moreover, for retrieval of data volumes in the billions, problems such as long retrieval time and slow request response will also arise.
[0034] Based on this, the present disclosure proposes an image data processing method that can reduce costs and improve retrieval performance.
[0035] Specifically, Figure 1 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 1 The method is optionally applied to electronic devices, such as personal computers, servers, server clusters and other electronic devices with computing capabilities. The method includes at least part of the following contents. Figure 1 Shown, including:
[0036] Step S101 : Based on first cluster features of first clusters included in a preset cluster set, at least one target first cluster corresponding to a first image feature of a target first image is selected.
[0037] Here, the target first image is one of multiple first images with which an affiliation is to be established; the preset cluster set includes multiple first clusters, and the first cluster features of a first cluster within the multiple first clusters are derived based on the image features of multiple second images with which the first cluster has an affiliation. In other words, the multiple second images used to generate the first cluster are images with which the first cluster has an affiliation.
[0038] Step S102: determining a target cluster that matches the target first image based on cluster-related information of the at least one target first cluster.
[0039] Step S103: establishing an affiliation relationship between the target first image and the target cluster.
[0040] In this way, the disclosed solution obtains multiple target first clusters by matching the first image features of the target first image with the first cluster features of the first cluster in the preset cluster set, and then determines the target cluster corresponding to the target first image to establish an affiliation relationship between the target first image and the target cluster, thereby laying the foundation for improving the image data storage efficiency and then improving the retrieval efficiency.
[0041] In a specific example, the cluster-related information of the target first cluster may include the actual storage capacity of the target first cluster, such as the actual number of images currently associated with the target first cluster. It is understood that in actual applications, the cluster-related information may also include other information, such as information adjusted based on actual needs of actual scenarios, and the present disclosure is not limited thereto.
[0042] In a specific example, the target cluster is the first cluster in the preset cluster set, or is a new cluster established based on the target first image, thereby providing support for the storage of any new image, ie, the target first image.
[0043] In a specific example of the disclosed solution, at least one target first cluster can be selected in the following manner. Specifically, the above-described selection of at least one target first cluster corresponding to the first image feature of the target first image based on the first cluster feature of the first cluster included in the preset cluster set includes:
[0044] A similarity comparison is performed between the first cluster feature of the first cluster included in the preset cluster set and the first image feature of the target first image to obtain a similarity comparison result; and based on the similarity comparison result, at least one target first cluster is selected from the preset cluster set.
[0045] For example, the first image feature of the target first image is compared with the first cluster features of each first cluster included in the preset cluster set to obtain a similarity value between the first image feature and the first cluster features of each first cluster, and one or more first clusters with a similarity value greater than a first threshold are selected as the target first cluster; or, after obtaining each similarity value, the similarity values are sorted in descending order, and the first N (a positive integer greater than or equal to 1) first clusters are selected based on the sorting result as the target first cluster.
[0046] Here, the first threshold can be set based on actual needs, and the present disclosure does not limit this.
[0047] In this way, the disclosed solution obtains multiple target first clusters by comparing the similarity between the first image feature of the target first image and the first cluster feature of the first cluster. This method is simple and highly interpretable, laying the foundation for improving the efficiency of image data storage and further improving retrieval efficiency.
[0048] In a specific example of the disclosed solution, the target cluster may be obtained in the following manner. Specifically, the above-mentioned determination of the target cluster matching the target first image based on the cluster-related information of the at least one target first cluster specifically includes:
[0049] Based on the cluster-related information of the at least one target first cluster, if it is determined that there is a target first cluster in the at least one target first cluster that does not meet the first stopping condition, the target first cluster that does not meet the first stopping condition is used as the target cluster that matches the target first image. That is, in this example, the target cluster is one of the multiple first clusters included in the preset cluster set.
[0050] In this way, the cluster-related information of the target first cluster, such as the actual storage capacity of the target first cluster, is used to determine the target cluster that matches the target first image. This method is simple and highly flexible. At the same time, it is convenient to make the first clusters more balanced, further improve the image data storage efficiency, and thus lay the foundation for improving the retrieval efficiency.
[0051] Furthermore, in another specific example, the target cluster may be obtained in the following manner. Specifically, the above-mentioned determination of the target cluster matching the target first image based on the cluster-related information of the at least one target first cluster includes:
[0052] Based on the cluster-related information of the at least one target first cluster, if it is determined that each target first cluster in the at least one target first cluster satisfies the first stopping condition, a second cluster feature of a second cluster is generated based at least on the first image feature of the target first image; here, the second cluster is the target cluster, and the second cluster feature is the target cluster feature of the target cluster. In other words, in this example, the target cluster is a newly established cluster, not one of the multiple first clusters included in the preset cluster set.
[0053] It is understandable that in actual applications, the images used to generate the new cluster, i.e., the second cluster, include not only the target first image but also other first images that do not have an affiliation with the existing first cluster. It should be noted that the target first image and other first images used to generate the second cluster are images that have an affiliation with the second cluster.
[0054] In one example, the first stopping condition is that the actual storage capacity of the target first cluster is greater than or equal to the maximum storage capacity. Here, the actual storage capacity of the target first cluster can specifically refer to the actual number of images that have an affiliation with the target first cluster. In other words, in this example, the actual storage capacity of the target first cluster serves as the criterion for determining whether a target first image can establish an affiliation with the target first cluster. This facilitates balancing the image sizes across different first clusters, laying the foundation for further improving image data storage efficiency and, consequently, retrieval efficiency.
[0055] For example, Figure 2 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 2The method may be optionally applied to electronic devices, such as personal computers, servers, server clusters, and other electronic devices with computing capabilities.
[0056] It is understandable that the above Figure 1 The relevant contents of the method shown can also be applied to this example, and this example will not elaborate on the relevant contents.
[0057] Furthermore, the method includes at least part of the following contents. Figure 2 As shown, the image data processing method includes:
[0058] Step S201: performing a similarity comparison between a first cluster feature of a first cluster included in the preset cluster set and a first image feature of the target first image to obtain a similarity comparison result.
[0059] Step S202: Based on the similarity comparison result, select at least one target first cluster from the preset cluster set.
[0060] Step S203: Based on the actual storage capacity of at least one target first cluster, determine whether there is a target first cluster that does not meet the first stop condition. If there is a target first cluster that does not meet the first stop condition, proceed to step S204; otherwise, proceed to step S205.
[0061] In this example, the first stop condition is that the actual storage capacity of the target first cluster is greater than or equal to the maximum storage capacity.
[0062] Step S204 : when it is determined that there is a target first cluster that does not satisfy the first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster that matches the target first image; and the process proceeds to step S206 .
[0063] For example, there is a target first cluster whose actual storage capacity is less than the maximum storage capacity. At this time, the target first cluster does not meet the first stop condition. The target first cluster whose actual storage capacity is less than the maximum storage capacity is the target cluster that matches the target first image.
[0064] Step S205: When it is determined that each target first cluster satisfies the first stopping condition, a new cluster is generated, for example, a second cluster feature of a second cluster is generated based on at least the first image feature of the target first image, and then the process proceeds to step S206.
[0065] For example, if the actual storage capacity of each target first cluster is equal to or greater than the maximum storage capacity, then the target first image cannot be associated with each target first cluster. In this case, a new cluster can be generated based on the first image feature of the target first image.
[0066] Step S206: establishing an affiliation relationship between the target first image and the target cluster.
[0067] In this way, in the process of judging whether the target first cluster can be used as the target cluster that matches the target first image, the cluster-related information of the target first cluster, such as the actual storage capacity, is used as the judgment criterion. This makes it easier to balance the image sizes of different first clusters, further laying the foundation for improving the image data storage efficiency and thus improving the retrieval efficiency.
[0068] Furthermore, in a specific example, in the process of determining whether the target first cluster can be used as the target cluster that matches the target first image, the similarity value between the first cluster feature of the target first cluster and the first image feature of the target first image may also be referred to. Specifically, Figure 3 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 3 The method may be optionally applied to electronic devices, such as personal computers, servers, server clusters, and other electronic devices with computing capabilities.
[0069] It is understandable that the above Figure 1 and Figure 2 The relevant content of any of the methods shown can also be applied to this example, and this example will not repeat the relevant content.
[0070] Furthermore, the method includes at least part of the following contents. Figure 3 As shown, the image data processing method includes:
[0071] Step S301: performing a similarity comparison between a first cluster feature of a first cluster included in the preset cluster set and a first image feature of the target first image to obtain a similarity comparison result.
[0072] Step S302: Based on the similarity comparison result, select at least one target first cluster from the preset cluster set.
[0073] For example, the first image feature of the target first image is compared with the first cluster features of each first cluster included in the preset cluster set to obtain a similarity value between the first image feature and the first cluster features of each first cluster, and the first clusters with a similarity value greater than a first threshold are selected, such as one or more first clusters with a similarity value greater than 0.6, as the target first cluster.
[0074] Step S303: Based on the similarity comparison result and at least one of the actual storage capacity of the at least one target first cluster, determine whether there is a target first cluster that does not meet the first stop condition. If there is a target first cluster that does not meet the first stop condition, proceed to step S304; otherwise, proceed to step S305.
[0075] In one example, the first stop condition may further include multiple sub-stop conditions; specifically, the first stop condition includes at least one of the following sub-stop conditions:
[0076] The actual storage capacity of the target first cluster is greater than the first storage capacity (the first storage capacity is a preset value less than or equal to the maximum storage capacity);
[0077] The actual storage capacity of the target first cluster is between [second storage capacity, first storage capacity], and the similarity value between the first cluster feature of the target first cluster and the first image feature of the target first image is less than a second threshold (the second threshold is greater than the first threshold, for example, the first threshold is 0.6 and the second threshold is 0.7); here, the second storage capacity is a preset value that is less than the first storage capacity.
[0078] The actual storage capacity of the target first cluster is between [the third storage capacity, the second storage capacity, and the similarity value between the first cluster feature of the target first cluster and the first image feature of the target first image is less than a third threshold (the third threshold is greater than the first threshold and less than the second threshold, for example, the first threshold is 0.6, the second threshold is 0.7, and the third threshold is 0.65); here, the third storage capacity is a preset value that is less than the second storage capacity.
[0079] For example, the first stop condition includes the following sub-conditions:
[0080] The actual storage capacity of the target first cluster is greater than 1000;
[0081] The actual storage capacity of the target first cluster is between (500, 1000], and the similarity value between the first cluster feature of the target first cluster and the first image feature of the target first image is less than the second threshold value of 0.7;
[0082] The actual storage capacity of the target first cluster is between [300, 500], and the similarity value between the first cluster feature of the target first cluster and the first image feature of the target first image is less than 0.65.
[0083] Step S304 : when it is determined that there is a target first cluster that does not satisfy the first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster that matches the target first image; and the process proceeds to step S306 .
[0084] Step S305: When it is determined that each target first cluster satisfies the first stopping condition, a new cluster is generated, for example, a second cluster feature of a second cluster is generated based on at least the first image feature of the target first image, and then step S306 is entered.
[0085] Step S306: establishing an affiliation relationship between the target first image and the target cluster.
[0086] Thus, the disclosed solution uses the similarity between the first image feature of the target first image and the first cluster feature of the target first cluster, as well as the actual storage capacity of the target first cluster, as the criterion for determining whether the target first image can be associated with the target first cluster. This facilitates balancing the image sizes between different first clusters, effectively ensuring a more uniform image size across the first clusters and effectively avoiding the generation of overly large clusters. At the same time, it lays the foundation for further improving image data storage efficiency and, in turn, retrieval efficiency.
[0087] In a specific example of the presently disclosed scheme, a target database can be used to store cluster features, images, image features and other related data; specifically, when it is determined that there is a target first cluster in the at least one target first cluster that does not meet the first stop condition, that is, the target cluster can be determined from the preset cluster set without constructing a new cluster, the following method can be used to update the target database, thereby realizing the storage of a new image, that is, the target first image.
[0088] Specifically, Figure 4 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 4 The method may be optionally applied to electronic devices, such as personal computers, servers, server clusters, and other electronic devices with computing capabilities.
[0089] It is understandable that the above Figures 1 to 3 The relevant content of any of the methods shown can also be applied to this example, and this example will not repeat the relevant content.
[0090] Furthermore, the method includes at least part of the following contents. Figure 4 As shown, the image data processing method includes:
[0091] Step S401 : Based on first cluster features of first clusters included in a preset cluster set, at least one target first cluster corresponding to a first image feature of a target first image is selected.
[0092] Step S402: Based on the cluster-related information of the at least one target first cluster, if it is determined that there is a target first cluster in the at least one target first cluster that does not satisfy a first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster that matches the target first image.
[0093] Step S403: establishing an affiliation relationship between the target first image and the target cluster.
[0094] Step S404: Based on the first type of data in the target database, a plurality of target second images having an affiliation relationship with the target cluster are acquired, wherein the first type of data is used to record the affiliation relationship between cluster features and images.
[0095] In practical applications, the first type of data can record a one-to-many mapping relationship between cluster features and images (such as image identifiers), for example, one cluster feature corresponds to multiple images.
[0096] Step S405: Based on the second type of data in the target database, second image features of a plurality of target second images having an affiliation relationship with the target cluster are obtained; the second type of data is used to record a mapping relationship between images and image features.
[0097] Here, the second type of data may record a one-to-one mapping relationship between an image (such as an image identifier) and an image feature.
[0098] Furthermore, the images recorded in the second category of data are associated with the images recorded in the first category of data, so that the image features of the images in the first category of data that have an attribution relationship with the cluster features can be determined by using the second category of data.
[0099] Step S406: obtaining a new first cluster feature of the target cluster based on the second image features of a plurality of target second images having an affiliation relationship with the target cluster and the first image feature of the target first image;
[0100] Step S407: updating the first category data based on the new first cluster feature of the target cluster; and / or updating the second category data based on the target first image and the first image feature of the target first image.
[0101] For example, the first category data is updated based on the new first cluster features of the target cluster; or, the second category data is updated based on the target first image and the first image features of the target first image; or, the first category data is updated based on the new first cluster features of the target cluster, and the second category data is updated based on the target first image and the first image features of the target first image.
[0102] In one example, the first category of data can be updated based on the new first cluster features of the target cluster in the following manner: the new first cluster features of the target cluster replace the cluster features of the original target cluster in the first category of data, and at the same time, the target first image is added to the corresponding attribution relationship of the target cluster, so that the first category of data is updated.
[0103] In another example, the second category data can be updated based on the target first image and the first image feature of the target first image in the following manner, that is, a piece of data is added to the second category data to record the mapping relationship between the target first image and the first image feature of the target first image, thereby updating the complete second category data.
[0104] In this way, the storage process of the target first image is completed, and the storage process is convenient for retrieval and can greatly improve the retrieval efficiency.
[0105] In a specific example of the presently disclosed scheme, a target database can be used to store cluster features, images, image features and other related data; specifically, when it is determined that there is a target first cluster in the at least one target first cluster that does not meet the first stop condition, that is, the target cluster can be determined from the preset cluster set without constructing a new cluster, the following method can be used to update the preset cluster set, thereby realizing the storage of a new image, that is, the target first image.
[0106] Specifically, Figure 5 This is a schematic flow chart of an image data processing method according to an embodiment of the present application. Figure 5 The method may be optionally applied to electronic devices, such as personal computers, servers, server clusters, and other electronic devices with computing capabilities.
[0107] It is understandable that the above Figures 1 to 3 The relevant content of any of the methods shown can also be applied to this example, and this example will not repeat the relevant content.
[0108] Furthermore, the method includes at least part of the following contents. Figure 5 As shown, the image data processing method includes:
[0109] Step S501 : Based on first cluster features of first clusters included in a preset cluster set, at least one target first cluster corresponding to a first image feature of a target first image is selected.
[0110] Step S502: Based on the cluster-related information of the at least one target first cluster, if it is determined that there is a target first cluster in the at least one target first cluster that does not satisfy a first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster that matches the target first image.
[0111] Step S503: establishing an affiliation relationship between the target first image and the target cluster.
[0112] Step S504: Based on the first type of data in the target database, a plurality of target second images having an affiliation relationship with the target cluster are acquired, wherein the first type of data is used to record the affiliation relationship between cluster features and images.
[0113] In practical applications, the first type of data can record a one-to-many mapping relationship between cluster features and images (such as image identifiers), for example, one cluster feature corresponds to multiple images.
[0114] Step S505: Based on the second type of data in the target database, second image features of a plurality of target second images having an affiliation relationship with the target cluster are obtained; the second type of data is used to record a mapping relationship between images and image features.
[0115] Here, the second type of data may record a one-to-one mapping relationship between an image (such as an image identifier) and an image feature.
[0116] Step S506: obtaining a new first cluster feature of the target cluster based on the second image features of a plurality of target second images having an affiliation relationship with the target cluster and the first image feature of the target first image.
[0117] Step S507: when the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data meets a similarity condition, updating the first cluster feature of the target cluster recorded in the preset cluster set.
[0118] In one example, the similarity condition can specifically be: the similarity between the new first cluster features of the target cluster and the first cluster features of the target cluster recorded in the first category of data is less than a fourth threshold. In other words, if the similarity between the new first cluster features of the target cluster and the first cluster features of the target cluster recorded in the first category of data is less than the fourth threshold, i.e., if the similarity between the new first cluster features of the target cluster and the first cluster features of the target cluster recorded in the first category of data is significantly different, the first cluster features of the target cluster recorded in the preset cluster set need to be promptly updated. This provides data support for the subsequent storage of new images and effectively reduces data processing errors.
[0119] Here, in actual scenarios, the preset cluster set can be stored in memory, so that it is convenient to quickly compare images and then quickly store image data. It should be pointed out that in this scenario, that is, in the scenario where the target cluster is an existing cluster in the preset cluster set, when the target first image establishes an affiliation with the target cluster and obtains a new first cluster feature of the target cluster, the preset cluster set is not updated in a timely manner. Instead, when there is a large gap between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data (that is, the original cluster feature of the target cluster), the data in the preset cluster set needs to be updated in a timely manner. In this way, the problem of excessive memory resource usage caused by frequent updates of the preset cluster set is avoided, memory space is effectively saved, and the foundation is laid for improving the efficiency of image data storage. Based on this, the disclosed solution is more suitable for processing large amounts of image data, and has higher processing efficiency and lower processing costs.
[0120] Furthermore, in a specific example, after obtaining the new first cluster feature of the target cluster, the relevant data in the target database may be updated, and the relevant data in the preset cluster set may also be updated; specifically, the following updates may be performed:
[0121] updating the first category of data based on the new first cluster feature of the target cluster;
[0122] updating the second type of data based on the target first image and the first image feature of the target first image;
[0123] When the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data meets a similarity condition, the first cluster feature of the target cluster recorded in the preset cluster set is updated.
[0124] That is, after obtaining the new first cluster feature of the target cluster, not only the target database is updated, but also the preset cluster set needs to be updated, so as to achieve the storage of the new image, ie, the target first image.
[0125] In a specific example of the disclosed solution, the target database is stored in a solid-state disk (SSD), which greatly saves memory resources and reduces data processing costs.
[0126] It should be noted that, in one scenario, the preset cluster set is stored in the memory, and the target database is stored in the solid-state drive, which greatly saves memory resources and reduces data processing costs.
[0127] Furthermore, in another specific example, when the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data does not meet the similarity condition, when it is determined that the update timing has arrived, the first cluster feature of the target cluster recorded in the preset cluster set is updated;
[0128] Here, the update timing is one of the following:
[0129] Periodic update time;
[0130] The other first images in the plurality of first images (ie, the other first images in the plurality of first images except the target first image) establish a complete belonging relationship.
[0131] That is, if the similarity between the new first cluster features of the target cluster and the first cluster features of the target cluster recorded in the first category of data does not meet the similarity condition, the preset cluster set does not need to be updated immediately, but instead waits for the periodic update time, and then updates when the periodic update time arrives. Alternatively, after all images currently to be attributed, that is, all first images in the plurality of first images have had their attribution established, the update is then performed uniformly.
[0132] For example, if the similarity between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first category of data is greater than or equal to the fourth threshold, that is, if the difference between the two is small, then there is no need to promptly update the preset cluster set, and the update opportunity must be waited for. In this way, while ensuring the similarity comparison error, the problem of low data processing efficiency caused by frequent updates of the preset cluster set is effectively avoided, thereby saving data processing resources to the greatest extent. For example, if the preset cluster set is stored in memory, memory resources can be effectively saved, thereby effectively reducing costs.
[0133] In a specific example of the disclosed solution, when it is determined based on the cluster-related information of the at least one target first cluster that each target first cluster in the at least one target first cluster satisfies the first stopping condition, and after the second cluster features of the second cluster are generated, that is, when a new cluster needs to be constructed and the new cluster is constructed, the target database can be updated in the following manner to achieve storage of a new image, that is, the target first image. Specifically, after the second cluster features of the second cluster are generated, the method further includes:
[0134] Based on the target cluster and related images having an attribution relationship with the target cluster, updating first-category data in the target database, wherein the first-category data is used to record a preset attribution relationship between cluster features and images;
[0135] and / or,
[0136] The second type of data in the target database is updated based on the target first image and the first image feature of the target first image; the second type of data is used to record the mapping relationship between the image and the image feature.
[0137] For example, based on the target cluster and related images that have an affiliation with the target cluster, the first category of data in the target database is updated; or, based on the target cluster and the target cluster features of the target cluster, the second category of data in the target database is updated; or, based on the target cluster and related images that have an affiliation with the target cluster, the first category of data in the target database is updated, and, based on the target cluster and the target cluster features of the target cluster, the second category of data in the target database is updated.
[0138] In one example, based on the target cluster and related images that have an affiliation with the target cluster (for example, the related images include a target first image and other first images that have an affiliation with the target cluster), the first category of data can be updated in the following manner: a piece of data is added to the first category of data to record the mapping relationship between the target cluster features of the target cluster and the images that have an affiliation with the target cluster, thereby completing the update of the first category of data.
[0139] In another example, the second category data can be updated based on the target first image and the first image feature of the target first image in the following manner, that is, a piece of data is added to the second category data to record the mapping relationship between the target first image and the first image feature of the target first image, thereby updating the complete second category data.
[0140] In this way, the storage process of the target first image is completed, and the storage process is convenient for retrieval and can greatly improve the retrieval efficiency.
[0141] Furthermore, in a specific example of the disclosed solution, when it is determined based on the cluster-related information of the at least one target first cluster that each target first cluster in the at least one target first cluster satisfies the first stopping condition, and after the second cluster feature of the second cluster is generated, that is, when a new cluster needs to be constructed and the new cluster is constructed, the preset cluster set can be updated to complete the storage of the new image, that is, the target first image; specifically, after the second cluster feature of the second cluster is generated and the target first image is established with the target cluster (that is, the second cluster), the method further includes:
[0142] Based on the target cluster, the preset cluster set is updated; or, when it is determined that an update opportunity has arrived, the preset cluster set is updated based on the target cluster;
[0143] The update timing is one of the following:
[0144] Periodic update time;
[0145] The other first images in the plurality of first images (ie, the other first images in the plurality of first images except the target first image) establish a complete belonging relationship.
[0146] That is to say, after a new cluster is generated, the preset cluster set is immediately updated, such as adding a piece of data to the preset cluster set to record the new cluster and the cluster features of the new cluster, that is, the target cluster and the target cluster features. In this way, data support is provided for subsequent image storage. Alternatively, after a new cluster is generated, the preset cluster set is not updated directly, but the periodic update time is waited for, and the update is performed when the periodic update time arrives. Alternatively, all images that are currently to establish an affiliation, that is, all first images in the multiple first images have completed the establishment of an affiliation, are then updated uniformly. In this way, the problem of low data processing efficiency caused by frequent updates of the preset cluster set is effectively avoided, and data processing resources are saved to the greatest extent. For example, when the preset cluster set is stored in memory, memory resources can be effectively saved, thereby effectively reducing costs.
[0147] It should be noted that, for the convenience of recording, the preset cluster set may store a mapping relationship between clusters (eg, cluster identifiers) and cluster features, so as to facilitate fast retrieval.
[0148] In a specific example of the disclosed solution, the preset cluster set established based on the above method can be used to perform image retrieval, thereby retrieving a target facial image that matches the facial image to be matched.
[0149] Specifically, in this example, the first image in the plurality of first images and the second image in the second images are both facial images; in this case, the first cluster feature of the first cluster is obtained based on the facial features of the plurality of facial images that have an affiliation relationship with the first cluster;
[0150] Furthermore, the method further comprises:
[0151] Comparing the target facial features of the face image to be matched with the first cluster features of the first cluster among the multiple first clusters to obtain a recall cluster (obtaining one or more recall clusters); the recall cluster is one of the multiple first clusters;
[0152] The target facial features of the face image to be matched are compared with the facial features of multiple face images having an affiliation relationship in the recall cluster for similarity, so as to obtain a target facial image corresponding to the target facial features.
[0153] For example, a target facial feature of the facial image to be matched is compared with the first cluster feature of the first cluster in the multiple first clusters to obtain a similarity value between the target facial feature and the first cluster feature of each first cluster, and the first cluster with a similarity value greater than a specified threshold is selected as the recall cluster, or the first M (a positive integer greater than or equal to 1) first clusters are selected as the recall cluster by sorting in descending order based on the similarity value. Furthermore, a similarity comparison is performed between the target facial feature and multiple facial images that have an affiliation with the recall cluster to obtain one or more target facial images corresponding to the target facial feature.
[0154] In this way, the disclosed solution generates multiple recall clusters by comparing the similarity between the target facial features and the first cluster features of the first cluster. This means that the disclosed solution can use the constructed cluster features as indexes for image retrieval, significantly improving retrieval performance. Furthermore, with the same data size and data processing capabilities, the disclosed solution can retrieve more images, effectively reducing retrieval latency and improving the user experience.
[0155] The following further illustrates the disclosed solution in detail with reference to specific examples. This example proposes an image data processing solution. Specifically, as shown in FIG6( a), the disclosed solution can utilize MySQL (i.e., the target database mentioned above) and a vector index library (i.e., the preset cluster set mentioned above) to quickly store relevant information of the facial image to be processed, such as the facial image to be processed and its facial feature vector. In this way, the storage method of the disclosed solution is also conducive to improving the image retrieval efficiency.
[0156] Here, the MySQL database stores two types of data: a cluster feature-image relationship table (i.e., the first type of data) and an image-image feature relationship table (i.e., the second type of data). Furthermore, to facilitate querying during the storage or retrieval of facial images, the cluster feature-image relationship table not only records the attribution relationship between cluster features and images, but also records cluster-related information (such as actual storage capacity, etc.) of the cluster represented by the cluster features (e.g., a cluster identifier (ID) can be used to represent the cluster). Furthermore, the target database may also include a cluster feature table for storing the mapping relationship between cluster features and cluster IDs.
[0157] Accordingly, the vector index library stores the mapping relationship between cluster IDs and cluster features, which makes it easier to search using cluster IDs and obtain cluster features corresponding to the cluster IDs, thereby further improving search efficiency.
[0158] Specifically, as shown in FIG6( b ), the core steps of the image data processing method include:
[0159] Step 601: For each of the multiple facial images to be processed, a facial feature vector of each facial image is extracted through a face detection and recognition model.
[0160] In actual application scenarios, tens of thousands of facial images may be generated in a short period of time. Therefore, to improve data processing performance, batch processing parameters can be set. This allows multiple facial images to be stored in batches based on these parameters. For example, after extracting facial feature vectors from each facial image, the batch processing parameter can be set to 10,000. In this case, at least some of these 10,000 facial images can be stored in batches in parallel, thus improving data processing efficiency.
[0161] It should be noted that the face detection and recognition model can be a neural network model or other models used for face recognition, and the present disclosure does not limit this.
[0162] Step 602: Perform clustering processing on each facial image in the multiple facial images. Here, the clustering processing includes two parts. The first part is used to determine the recall cluster corresponding to each facial image; the second part is used to perform clustering judgment on the facial image to determine whether it can be added to the recall cluster corresponding to itself.
[0163] Specifically, taking the target face image as an example, the specific steps of performing clustering processing on the target face image are given, as shown in Figure 6(c), including:
[0164] Step 602-1: Compare the facial feature vector of the facial image with the cluster features of each cluster in the vector index library for similarity (e.g., cosine similarity). Clusters with similarity values greater than 0.6 are selected as the recall clusters for the facial image (i.e., the target first cluster described above). In this way, the recall clusters for each facial image are obtained. At this point, the cluster ID of each recall cluster for each facial image can be stored in the list of cluster IDs to be queried.
[0165] The disclosed solution processes cluster features as indexes for image storage, which can greatly improve data processing efficiency.
[0166] That is, the to-be-queried cluster ID list records the recalled clusters of each of the multiple face images that need to be processed.
[0167] Step 602-2: Query the cluster details of each recalled cluster in the list of cluster IDs to be queried. For example, based on the cluster feature-image relationship table in MySQL, query the cluster related information corresponding to each cluster ID in the list of cluster IDs to be queried, that is, obtain the cluster related information corresponding to each recalled cluster.
[0168] Step 602-3: Call the clustering judgment operator to perform clustering judgment on each face image. Here, for each face image, it is judged whether the face image can be added to its corresponding recall cluster in the following manner.
[0169] It should be noted that if a face image corresponds to multiple recall clusters, for example, three recall clusters, then the cluster entry judgment operator is called once for each recall cluster to determine whether the face image can be added to the corresponding recall cluster.
[0170] Further, the cluster entry judgment operator is called, and if it is determined that the cluster entry stop condition is not met, step 602-4 is executed; otherwise, step 602-5 is executed;
[0171] For a recall cluster of face images, the clustering stop conditions include:
[0172] The number of images corresponding to the recall cluster of face images is greater than 1000;
[0173] The number of images corresponding to the recall cluster of face images is greater than 500, and the similarity value between the face image and the recall cluster is less than 0.7;
[0174] The number of images corresponding to the recall cluster of face images is greater than 300, and the similarity value between the face image and the recall cluster is less than 0.65.
[0175] As long as the cluster entry stop conditions are not met, any node can enter the cluster.
[0176] Step 602-4: When the clustering stop condition is not met, that is, for the face image that can be added to the recall cluster, the cluster feature update operator is called to determine whether the vector index library needs to be updated.
[0177] Specifically, here, the target face image among the face images that can be added to the recall cluster is taken as an example for explanation; further, if the recall cluster to which the target face image can be added is determined to be the target recall cluster based on the above-mentioned clustering stop condition, the cluster feature update operator is called to perform the following processing:
[0178] Based on the cluster features of the target recall cluster (which can be called original cluster features) and the facial feature vector of the target face image, a new cluster feature of the target recall cluster is obtained;
[0179] If the similarity between the new cluster features and the original cluster features is less than 0.95, the cluster ID of the target recall cluster and its new cluster features are added to the cluster index dictionary to be updated. Furthermore, the cluster ID, new cluster features, and the target face image and its facial feature vector are added to the MySQL cluster ID list to be updated. The process proceeds to step 603. In other words, at this point, the vector index library and MySQL database must be updated for the target recall cluster.
[0180] If the similarity between the new cluster features and the original cluster features is greater than 0.95, the cluster ID of the recall cluster to be updated, its new cluster features, and the facial image and facial image features to be added to the recall cluster are added to the MySQL list of cluster IDs to be updated. The process then proceeds to step 603. In other words, at this point, there is no need to update the vector index library for the target recall cluster; only MySQL needs to be updated.
[0181] Here, the to-be-updated cluster index dictionary records relevant information of the recalled cluster to be updated, such as the cluster ID of the recalled cluster to be updated, new cluster features, etc. In this way, it is convenient to update the vector index library based on the to-be-updated cluster index dictionary.
[0182] Correspondingly, the MySQL cluster ID list to be updated also records the relevant information of the recall cluster that needs to be updated, such as the cluster ID of the recall cluster that needs to be updated, the new cluster features, and the face images and face vector features newly added to the recall cluster, etc. This makes it convenient to update the cluster feature-image relationship table and the image-image feature relationship table in MySQL based on the MySQL cluster ID list to be updated.
[0183] Step 602-5: If the clustering stop condition is met, that is, if the face image cannot be added to any of its corresponding recall clusters, the relevant information of the face image is added to the list of images to be added to the cluster, and then proceed to step 602-6.
[0184] Here, the list of cluster images to be added records relevant information of face images that cannot be added to any recalled cluster among multiple face images.
[0185] Step 602-6: After the above process has been completed for multiple facial images, cluster the facial feature vectors of each facial image in the list of images to be added to the cluster. A new cluster is generated, i.e., cluster features and a cluster ID for the new cluster are generated. The cluster ID and cluster features of the new cluster are added to the index dictionary of the cluster to be added. Simultaneously, the cluster ID and cluster features of the new cluster, along with all facial images and their facial feature vectors used to generate the new cluster, are added to the MySQL dictionary of clusters to be added. Execute step 603.
[0186] Step 603: Perform an update operation.
[0187] Specifically, update operations are performed on the vector index library and MySQL.
[0188] It is understood that the update described above can specifically be an operation such as replacement or addition. Specifically, for the vector index library, based on the cluster index dictionary to be added, a new data entry is added to the vector index library to record the cluster ID and cluster characteristics of the new cluster. Based on the cluster index dictionary to be updated, the cluster characteristics in the vector index library are updated.
[0189] For MySQL, based on the MySQL cluster ID list to be updated, the cluster features are updated in the cluster feature-image relationship table in MySQL, and the images are added; the cluster features are updated in the cluster feature table, and the image-image feature relationship table is added with related information of the image; based on the MySQL cluster dictionary to be added, the cluster feature-image relationship table, cluster feature table and image-image feature relationship table in MySQL are added accordingly.
[0190] Furthermore, the disclosed solution proposes a face image retrieval method, such as Figure 7 As shown, the specific steps include:
[0191] Step 701: performing image feature extraction on the face image to be retrieved to obtain a target face feature vector of the face image to be retrieved.
[0192] Here, for a face image input by a user (ie, a face image to be retrieved), a target face feature vector of the face image is extracted through a face detection and recognition model.
[0193] Step 702: Based on the vector index library, obtain the recall cluster of the face image to be retrieved.
[0194] For example, the target facial feature vector of the face image to be retrieved is compared with the cluster features in the vector index library for similarity, and the top k clusters with similarity greater than 0.5 are obtained as recall clusters, where k can be 10, that is, 10 recall clusters are obtained.
[0195] Step 703: According to the cluster ID of each recalled cluster, the candidate face image corresponding to each recalled cluster is found in the cluster feature-image relationship table in MySQL to obtain multiple candidate face images.
[0196] Step 704: Find the image feature of each candidate facial image in the plurality of candidate facial images in the image-image feature relationship table in MySQL.
[0197] Step 705: Calculate similarity (e.g., cosine similarity) between the target facial feature vector of the facial image to be retrieved and the image features of each candidate facial image in the plurality of candidate facial images to obtain a plurality (e.g., 100) of target images having similarity values greater than a threshold, e.g., 0.6.
[0198] Step 706: Return the search results.
[0199] The disclosed solution proposes an image data processing solution, which constructs a cluster index by clustering the feature vectors of multiple images, that is, using cluster features as cluster indexes, and performs image storage and retrieval operations. Here, since the disclosed solution is based on cluster features (that is, cluster features are indexed, which can be referred to as cluster indexes) rather than image features during the storage or retrieval operation, it can effectively improve image storage efficiency and image retrieval efficiency; moreover, the vector index library used to store cluster indexes in the disclosed solution is stored in memory, and the cluster feature-image relationship table and the image-image feature relationship table are stored in SSD, that is, memory MySQL is combined, thus combining memory storage with solid-state drive storage, thereby greatly saving machine costs and improving retrieval performance. Specifically, the disclosed solution has the following advantages:
[0200] (1) Compared with the existing methods, the disclosed solution can use the cluster features constructed in the vector index library as indexes, which greatly improves the processing performance and enables a machine to retrieve more images; under the same data scale, the disclosed solution effectively reduces the consumption of machine memory resources while improving data processing performance.
[0201] (2) The disclosed solution combines memory with SSD hard disk to store corresponding information, which can greatly save machine costs and meet the demand for continuous incremental storage of streaming facial image data. It is also suitable for large-scale image retrieval. In addition, after obtaining the recall cluster, the disclosed solution will still use the image features of the image corresponding to the recall cluster to compare the similarity with the facial feature vector of the face image to be retrieved. Therefore, compared with the existing solution, it can improve the retrieval performance without affecting the image recall effect.
[0202] (3) The update strategy used in the disclosed solution can effectively avoid the problem of updating the cluster features (i.e., cluster index) of each image after it is added to the cluster, thereby effectively avoiding the frequent update of the cluster index and further improving the processing efficiency.
[0203] (4) The disclosed solution can also limit the image size of each cluster during the image storage process, so that the size of the images corresponding to the clusters is more uniform, thereby avoiding the problem of generating ultra-large clusters and causing a decrease in image processing performance (such as retrieval performance).
[0204] (5) The disclosed solution can cluster images that cannot be clustered, avoiding the problem of constructing too many new clusters due to the inability to cluster the same batch of data, thereby improving the compression rate of cluster features.
[0205] The present disclosure also provides an image data processing device, such as Figure 8 Shown, including:
[0206] A selection unit 801 is configured to select, based on first cluster features of first clusters included in a preset cluster set, at least one target first cluster corresponding to first image features of a target first image; the target first image is one of a plurality of first images for which an affiliation relationship is to be established; the preset cluster set includes a plurality of first clusters, the first cluster features of a first cluster in the plurality of first clusters being obtained based on image features of a plurality of second images having an affiliation relationship with the first cluster;
[0207] A determining unit 802 is configured to determine a target cluster that matches the target first image based on cluster related information of the at least one target first cluster;
[0208] The relationship establishing unit 803 is configured to establish an affiliation relationship between the target first image and the target cluster.
[0209] In a specific example of the disclosed solution, the selection unit 801 is specifically configured to:
[0210] performing a similarity comparison between a first cluster feature of a first cluster included in the preset cluster set and a first image feature of the target first image to obtain a similarity comparison result;
[0211] Based on the similarity comparison result, at least one target first cluster is selected from the preset cluster set.
[0212] In a specific example of the disclosed solution, the determining unit 802 is specifically configured to:
[0213] When it is determined based on cluster-related information of the at least one target first cluster that there is a target first cluster in the at least one target first cluster that does not satisfy a first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster matched with the target first image.
[0214] In a specific example of the disclosed solution, the system further includes: a first updating unit; wherein the first updating unit is configured to:
[0215] Based on first-category data in a target database, a plurality of target second images having an attribution relationship with the target cluster are acquired, wherein the first-category data is used to record the attribution relationship between cluster features and images;
[0216] Based on the second type of data in the target database, second image features of a plurality of target second images having an affiliation relationship with the target cluster are obtained; the second type of data is used to record a mapping relationship between images and image features;
[0217] Obtaining a new first cluster feature of the target cluster based on second image features of a plurality of target second images having an affiliation relationship with the target cluster and first image features of the target first image;
[0218] The first category data is updated based on the new first cluster feature of the target cluster, and / or the second category data is updated based on the target first image and the first image feature of the target first image.
[0219] In a specific example of the disclosed solution, the system further includes: a second updating unit; wherein the second updating unit is configured to:
[0220] Based on first-category data in a target database, a plurality of target second images having an attribution relationship with the target cluster are acquired, wherein the first-category data is used to record the attribution relationship between cluster features and images;
[0221] Based on the second type of data in the target database, second image features of a plurality of target second images having an affiliation relationship with the target cluster are obtained; the second type of data is used to record a mapping relationship between images and image features;
[0222] Obtaining a new first cluster feature of the target cluster based on second image features of a plurality of target second images having an affiliation relationship with the target cluster and first image features of the target first image;
[0223] When the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data meets a similarity condition, the first cluster feature of the target cluster recorded in the preset cluster set is updated.
[0224] In a specific example of the disclosed solution, the second updating unit is further configured to:
[0225] When it is determined that the update timing has arrived, if the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data does not meet the similarity condition, updating the first cluster feature of the target cluster recorded in the preset cluster set;
[0226] The update timing is one of the following:
[0227] Periodic update time;
[0228] The other first images in the plurality of first images establish a complete belonging relationship.
[0229] In a specific example of the disclosed solution, the determining unit 802 is specifically configured to:
[0230] generating a second cluster feature of a second cluster based on at least a first image feature of the target first image when it is determined based on cluster related information of the at least one target first cluster that each target first cluster in the at least one target first cluster satisfies a first stopping condition;
[0231] The second cluster is the target cluster, and the second cluster feature is the target cluster feature of the target cluster.
[0232] In a specific example of the disclosed solution, the system further includes: a third updating unit; wherein the third updating unit is configured to:
[0233] Based on the target cluster and the related images having an attribution relationship with the target cluster, updating the first type of data in the target database; the first type of data is used to record the preset attribution relationship between the cluster features and the images;
[0234] and / or,
[0235] The second type of data in the target database is updated based on the target first image and the first image feature of the target first image; the second type of data is used to record the mapping relationship between the image and the image feature.
[0236] In a specific example of the disclosed solution, a fourth updating unit is further included; wherein the fourth updating unit is configured to:
[0237] Based on the target cluster, the preset cluster set is updated; or, when it is determined that an update opportunity has arrived, the preset cluster set is updated based on the target cluster;
[0238] The update timing is one of the following:
[0239] Periodic update time;
[0240] The other first images in the plurality of first images establish a complete belonging relationship.
[0241] In a specific example of the disclosed solution, the target database is stored in a solid state drive.
[0242] In a specific example of the disclosed solution, the first image in the plurality of first images and the second image in the plurality of second images are both facial images;
[0243] The apparatus further includes an image retrieval unit, wherein the image retrieval unit is configured to:
[0244] Comparing the target facial features of the face image to be matched with the first cluster features of the first cluster among the multiple first clusters to obtain a recall cluster; the recall cluster is one of the multiple first clusters;
[0245] The target facial features of the face image to be matched are compared with the facial features of multiple face images having an affiliation relationship in the recall cluster for similarity, so as to obtain a target facial image corresponding to the target facial features.
[0246] For the description of specific functions and examples of each unit of the device in the embodiment of the present disclosure, please refer to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0247] In the technical solutions disclosed herein, the acquisition, storage, and application of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0248] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0249] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0250] like Figure 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the device 900 can also be stored in the RAM 903. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0251] Various components in the device 900 are connected to the I / O interface 905, including an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a magnetic disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0252] The computing unit 901 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the image data processing method. For example, in some embodiments, the image data processing method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the image data processing method described above can be performed. Alternatively, in other embodiments, the computing unit 901 can be configured to perform the image data processing method by any other appropriate means (e.g., by means of firmware).
[0253] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0254] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0255] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0256] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0257] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0258] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0259] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not limited herein.
[0260] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A method for processing image data, comprising: Based on the first cluster features of the first clusters included in the preset cluster set, at least one target first cluster corresponding to the first image features of the target first image is selected; the target first image is one of the multiple first images for which an affiliation relationship is to be established; the preset cluster set includes multiple first clusters, and the first cluster features of the first clusters in the multiple first clusters are obtained based on the image features of multiple second images that have an affiliation relationship with the first cluster; determining a target cluster that matches the target first image based on cluster related information of the at least one target first cluster; Establishing an affiliation relationship between the target first image and the target cluster to improve storage efficiency; The determining of a target cluster matching the target first image based on the cluster related information of the at least one target first cluster includes: When it is determined based on cluster-related information of the at least one target first cluster that there is a target first cluster in the at least one target first cluster that does not satisfy a first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster matched with the target first image.
2. The method according to claim 1, wherein The selecting, based on the first cluster features of the first clusters included in the preset cluster set, at least one target first cluster corresponding to the first image features of the target first image comprises: performing a similarity comparison between a first cluster feature of a first cluster included in the preset cluster set and a first image feature of the target first image to obtain a similarity comparison result; Based on the similarity comparison result, at least one target first cluster is selected from the preset cluster set.
3. The method according to claim 1, further comprising: Based on first-category data in a target database, a plurality of target second images having an attribution relationship with the target cluster are acquired, wherein the first-category data is used to record the attribution relationship between cluster features and images; Based on the second type of data in the target database, second image features of a plurality of target second images having an affiliation relationship with the target cluster are obtained; the second type of data is used to record a mapping relationship between images and image features; Obtaining a new first cluster feature of the target cluster based on second image features of a plurality of target second images having an affiliation relationship with the target cluster and first image features of the target first image; The first category data is updated based on the new first cluster feature of the target cluster, and / or the second category data is updated based on the target first image and the first image feature of the target first image.
4. The method according to claim 1, further comprising: Based on first-category data in a target database, a plurality of target second images having an attribution relationship with the target cluster are acquired, wherein the first-category data is used to record the attribution relationship between cluster features and images; Based on the second type of data in the target database, second image features of a plurality of target second images having an affiliation relationship with the target cluster are obtained; the second type of data is used to record a mapping relationship between images and image features; Obtaining a new first cluster feature of the target cluster based on second image features of a plurality of target second images having an affiliation relationship with the target cluster and first image features of the target first image; When the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data meets a similarity condition, the first cluster feature of the target cluster recorded in the preset cluster set is updated.
5. The method according to claim 4, further comprising: When it is determined that the update timing has arrived, if the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data does not meet the similarity condition, updating the first cluster feature of the target cluster recorded in the preset cluster set; The update timing is one of the following: Periodic update time; The other first images in the plurality of first images establish a complete belonging relationship.
6. The method according to claim 1, wherein The determining, based on the cluster related information of the at least one target first cluster, a target cluster matching the target first image includes: generating a second cluster feature of a second cluster based on at least a first image feature of the target first image when it is determined based on cluster related information of the at least one target first cluster that each target first cluster in the at least one target first cluster satisfies a first stopping condition; The second cluster is the target cluster, and the second cluster feature is the target cluster feature of the target cluster.
7. The method according to claim 6, further comprising: Based on the target cluster and the related images having an attribution relationship with the target cluster, updating the first type of data in the target database; the first type of data is used to record the preset attribution relationship between the cluster features and the images; and / or, The second type of data in the target database is updated based on the target first image and the first image feature of the target first image; the second type of data is used to record the mapping relationship between the image and the image feature.
8. The method according to claim 6, further comprising: Based on the target cluster, updating the preset cluster set; Alternatively, when it is determined that the update opportunity has arrived, the preset cluster set is updated based on the target cluster; The update timing is one of the following: Periodic update time; The other first images in the plurality of first images establish a complete belonging relationship.
9. The method according to any one of claims 3 to 5 and 7, wherein: The target database is stored in a solid state drive.
10. The method according to any one of claims 1 to 8, wherein: The first image in the plurality of first images and the second image in the plurality of second images are both facial images; The method further comprises: Comparing the similarity between the target facial features of the face image to be matched and the first cluster features of the first cluster among the multiple first clusters to obtain a recall cluster; The recalled cluster is one of the plurality of first clusters; The target facial features of the face image to be matched are compared with the facial features of multiple face images having an affiliation relationship in the recall cluster for similarity, so as to obtain a target facial image corresponding to the target facial features.
11. An image data processing device, comprising: a selection unit configured to select, based on first cluster features of first clusters included in a preset cluster set, at least one target first cluster corresponding to first image features of a target first image; the target first image being one of a plurality of first images for which an affiliation relationship is to be established; the preset cluster set including a plurality of first clusters, the first cluster features of a first cluster among the plurality of first clusters being obtained based on image features of a plurality of second images having an affiliation relationship with the first cluster; a determining unit, configured to determine a target cluster matching the target first image based on cluster related information of the at least one target first cluster; a relationship establishing unit, configured to establish an affiliation relationship between the target first image and the target cluster to improve storage efficiency; The determining unit is specifically configured to: When it is determined based on cluster-related information of the at least one target first cluster that there is a target first cluster in the at least one target first cluster that does not satisfy a first stop condition, the target first cluster that does not satisfy the first stop condition is used as a target cluster matched with the target first image.
12. The device according to claim 11, wherein The selection unit is specifically configured to: performing a similarity comparison between a first cluster feature of a first cluster included in the preset cluster set and a first image feature of the target first image to obtain a similarity comparison result; Based on the similarity comparison result, at least one target first cluster is selected from the preset cluster set.
13. The apparatus according to claim 11, further comprising: A first updating unit; wherein the first updating unit is used to: Based on the first category of data in the target database, a plurality of target second images having an affiliation with the target cluster are obtained, and the first category of data is used to record the affiliation between cluster features and images; based on the second category of data in the target database, second image features of the plurality of target second images having an affiliation with the target cluster are obtained; the second category of data is used to record the mapping relationship between images and image features; based on the second image features of the plurality of target second images having an affiliation with the target cluster and the first image features of the target first image, new first cluster features of the target cluster are obtained; the first category of data is updated based on the new first cluster features of the target cluster, and / or the second category of data is updated based on the target first image and the first image features of the target first image.
14. The apparatus according to claim 11, further comprising: A second updating unit; wherein the second updating unit is used to: Based on the first category of data in the target database, a plurality of target second images having an affiliation with the target cluster are obtained, and the first category of data is used to record the affiliation between cluster features and images; based on the second category of data in the target database, second image features of the plurality of target second images having an affiliation with the target cluster are obtained; the second category of data is used to record the mapping relationship between images and image features; based on the second image features of the plurality of target second images having an affiliation with the target cluster, and the first image features of the target first image, new first cluster features of the target cluster are obtained; when the similarity relationship between the new first cluster features of the target cluster and the first cluster features of the target cluster recorded in the first category of data meets the similarity condition, the first cluster features of the target cluster recorded in the preset cluster set are updated.
15. The device according to claim 14, wherein The second updating unit is further configured to: When it is determined that the update timing has arrived, if the similarity relationship between the new first cluster feature of the target cluster and the first cluster feature of the target cluster recorded in the first type of data does not meet the similarity condition, updating the first cluster feature of the target cluster recorded in the preset cluster set; The update timing is one of the following: Periodic update time; The other first images in the plurality of first images establish a complete belonging relationship.
16. The device according to claim 11, wherein The determining unit is specifically configured to: generating a second cluster feature of a second cluster based on at least a first image feature of the target first image when it is determined based on cluster related information of the at least one target first cluster that each target first cluster in the at least one target first cluster satisfies a first stopping condition; The second cluster is the target cluster, and the second cluster feature is the target cluster feature of the target cluster.
17. The apparatus according to claim 16, further comprising: The third updating unit is configured to: Based on the target cluster and the related images having an attribution relationship with the target cluster, updating the first type of data in the target database; the first type of data is used to record the preset attribution relationship between cluster features and images; and / or, The second type of data in the target database is updated based on the target first image and the first image feature of the target first image; the second type of data is used to record the mapping relationship between the image and the image feature.
18. The apparatus according to claim 16, further comprising: A fourth updating unit; wherein the fourth updating unit is configured to: Based on the target cluster, the preset cluster set is updated; or, when it is determined that an update opportunity has arrived, the preset cluster set is updated based on the target cluster; The update timing is one of the following: Periodic update time; The other first images in the plurality of first images establish a complete belonging relationship.
19. The device according to any one of claims 13 to 15 or 17, wherein: The target database is stored in a solid state drive.
20. The device according to any one of claims 11 to 18, wherein The first image in the plurality of first images and the second image in the plurality of second images are both facial images; The apparatus further includes an image retrieval unit, wherein the image retrieval unit is configured to: Comparing the target facial features of the face image to be matched with the first cluster features of the first cluster among the multiple first clusters to obtain a recall cluster; the recall cluster is one of the multiple first clusters; The target facial features of the face image to be matched are compared with the facial features of multiple face images having an affiliation relationship in the recall cluster for similarity, so as to obtain a target facial image corresponding to the target facial features.
21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.
23. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Image retrieval method and device, computer equipment and storage medium
CN112784087A
Method and device for generating label information, equipment, medium and product
CN114120410A