Image processing method, platform, electronic device and storage medium
By clustering and deduplication processing for each sub-base, the problems of long calculation time and high resource consumption of super-large-scale library deduplication in the existing technology are solved, and efficient image deduplication efficiency is achieved.
Patent Information
- Application Number
- CN202411930901.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-01
AI Technical Summary
The existing Faiss-based image deduplication method requires high computing time for super-large-scale galleries, and as the scale of the gallery increases, the computing volume increases exponentially, resulting in huge consumption of computing resources.
By acquiring the features of each image in the image library, selecting a predetermined number of target images to form a cluster training library, performing clustering training to obtain multiple clustering centers, dividing the image library into multiple sub-stores according to the image characteristics and clustering centers, and deduplication processing is performed on each sub-store separately.
It effectively improves the deduplication efficiency of ultra-large-scale images, reduces the consumption of computing resources, avoids the problem of limited resources on stand-alone machines, and realizes efficient image deduplication processing.
Smart Images

Figure CN119741521A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer application technology, and in particular to an image processing method, platform, electronic device and storage medium. Background Art
[0002] For large-scale or ultra-large-scale image libraries, data deduplication technology is one of the key methods to improve storage and maintenance efficiency and reduce costs.
[0003] In the related art, a Faiss-based image deduplication method is proposed. The specific process is: the images in the gallery (e.g., N images) are obtained through an algorithm model to obtain the features of each image. Taking the extraction of M-dimensional features from each image as an example, the above gallery obtains a total of N*M dimensions. The deduplication method is to set a similarity threshold and then perform a similarity search, that is, the features of each image are compared with a specified search feature for similarity, and then the similarity comparison results of each image are compared with the set similarity threshold one by one, and images with a similarity less than the similarity threshold are deduplicated.
[0004] The above-mentioned Faiss-based image deduplication method requires N*N retrieval calculations if there are N images in the gallery. For deduplication of ultra-large-scale galleries, the required calculation time is very long. Moreover, as the number of images in the gallery continues to increase, the amount of calculation will increase exponentially, increasing the consumption of computing resources. Summary of the invention
[0005] In view of this, the embodiments of the present application provide at least one image processing method, platform, electronic device and storage medium to overcome at least one of the above-mentioned defects.
[0006] In a first aspect, an embodiment of the present application also provides an image processing method, the method comprising: obtaining image features of each image in a gallery; selecting a predetermined number of target images from the gallery to form a cluster training library; obtaining multiple cluster centers by performing cluster training on all target images in the cluster training library; dividing all images in the gallery into multiple sub-libraries according to the image features of each image in the gallery and the multiple cluster centers, so as to perform deduplication processing on each sub-library separately.
[0007] In a second aspect, an exemplary embodiment of the present application provides an image processing platform, which includes a node cluster, wherein a first computing node in the node cluster performs the following processing: acquiring image features of each image in a gallery; selecting a predetermined number of target images from the gallery to form a cluster training library; obtaining multiple cluster centers by performing cluster training on all target images in the cluster training library; and dividing all images in the gallery into multiple sub-gallery according to the image features of each image in the gallery and the multiple cluster centers, so as to perform deduplication processing on each sub-gallery separately.
[0008] In the third aspect, an embodiment of the present application also provides an image processing device, which includes: a gallery acquisition module, which acquires image features of each image in the gallery; an image selection module, which selects a predetermined number of target images from the gallery to form a cluster training library; a clustering module, which obtains multiple cluster centers by performing cluster training on all target images in the cluster training library; and a division module, which divides all images in the gallery into multiple sub-libraries according to the image features of each image in the gallery and the multiple cluster centers, so as to perform deduplication processing on each sub-library separately.
[0009] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the above-mentioned image processing method.
[0010] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned image processing method are executed.
[0011] The image processing method, platform, electronic device and storage medium provided in the embodiments of the present application can effectively improve the deduplication efficiency for ultra-large-scale images.
[0012] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0014] Figure 1 A flowchart showing an image processing method provided by an exemplary embodiment of the present application;
[0015] Figure 2 A flowchart showing the steps of deduplication processing of sub-libraries provided by an exemplary embodiment of the present application;
[0016] Figure 3 A schematic diagram showing the structure of an image processing device provided by an exemplary embodiment of the present application is shown;
[0017] Figure 4 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0018] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art, under the guidance of the content of the present application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.
[0019] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0020] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0021] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0022] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0023] With the continuous development of computer and Internet technology, image data is usually provided to users based on a picture library. At present, in order to meet users' comprehensive, diversified and personalized needs for images, the construction of picture libraries is developing in the direction of increasing the data scale.
[0024] For large-scale or ultra-large-scale image libraries, data deduplication technology is one of the key methods to improve storage and maintenance efficiency and reduce costs.
[0025] In the related art, a Faiss-based image deduplication method is proposed. The specific process is: the images in the gallery (e.g., N images) are obtained through an algorithm model to obtain the features of each image. Taking the extraction of M-dimensional features for each image as an example, the above gallery is processed to obtain a total of N×M dimensions. The deduplication method is to set a similarity threshold and then perform a similarity search, that is, to compare the features of each image for similarity, and then compare the similarity comparison results with the set similarity threshold one by one, and deduplicate the images that are less than the similarity threshold.
[0026] The above-mentioned Faiss-based image deduplication method requires N×N retrieval calculations if there are N images in the gallery. For deduplication of ultra-large-scale galleries, the required calculation time is very long. Moreover, as the number of images in the gallery continues to increase, the amount of calculation will increase exponentially, greatly increasing the consumption of computing resources.
[0027] In response to at least one of the above problems, the present application proposes an image deduplication processing solution that can effectively improve the deduplication efficiency for large-scale / ultra-large-scale images.
[0028] To facilitate understanding of the present application, the image processing method and platform provided in the embodiments of the present application are introduced in detail below.
[0029] See also Figure 1 , which is a flow chart of an image processing method provided in an exemplary embodiment of the present application. In an embodiment of the present application, an image processing platform for building and / or maintaining a gallery may be provided, the image processing platform including a node cluster, the node cluster including a plurality of computing nodes, and optionally, the image processing method of the present application may be executed in a first computing node in the node cluster. Exemplarily, the first computing node may be any computing node in the above-mentioned node cluster, or it may be a dedicated computing node pre-configured in the node cluster for performing image deduplication processing, or it may be a computing node selected from the node cluster based on the node status and / or node resources, and the present application does not impose any restrictions on this. As an example, the node status may refer to whether the computing node is in an idle state or an occupied state, and the node resources may include the computing power of the node.
[0030] Reference Figure 1 , in step S101, the image features of each image in the gallery are obtained.
[0031] In a preferred example, for each image, an image feature vector of the image may be obtained by an image feature extraction model. Exemplarily, the image feature vector may be a 1×M-dimensional vector, and each element in the image feature vector corresponds to an image feature.
[0032] Optionally, the image feature extraction model may be Dinov2 inference, for example, using the Dinov2 model to perform Embedding inference on all images in the gallery to obtain D_Embeddings. Exemplarily, one D_Embedding vector is obtained for each image, and the vectors corresponding to all images in the gallery are represented as D_Embeddings.
[0033] Here, Embedding technology may refer to: using Embedding technology to map high-dimensional data (for example, text, pictures, audio) to a low-dimensional space, that is, converting pictures, sounds, and text into vectors for representation. Embedding can usually be implemented using a neural network model.
[0034] In a preferred embodiment, before step S101 , the image processing method of the embodiment of the present application may further include step S1011 : determining a library D_Dataset.
[0035] Here, the above-mentioned gallery data set D_Dataset may refer to the total amount of gallery data. The image processing solution of the embodiment of the present application is more effective in improving the deduplication efficiency of ultra-large-scale images. In this regard, the gallery D_Dataset may be an image data set of billions of scale.
[0036] The image deduplication processing solution proposed in the embodiment of the present application can be applied to a variety of technical scenarios. Two cases are listed below for introduction, but it should be understood that the present application is not limited to this.
[0037] In the first embodiment, it is adapted to the construction scene of the gallery.
[0038] Here, the construction scenario of the gallery may refer to: forming a new gallery from multiple sub-gallery obtained after subsequent deduplication processing. The new gallery is a gallery after data cleaning, and related functions of the online gallery can be provided based on the new gallery.
[0039] In this case, the image library D_Dataset in the above step S1011 may include multiple images collected from the Internet and / or open source datasets, may include original images drawn by oneself, and may also include images searched with the help of search engines, and this application does not impose any restrictions on this.
[0040] The second embodiment is applicable to the maintenance scenario of the gallery.
[0041] Here, the maintenance scenario of the above-mentioned gallery may refer to: updating the newly acquired multiple images into the constructed gallery, or may refer to: periodically updating the constructed gallery, and performing deduplication processing on the above-mentioned periodically updated gallery when the set maintenance time is reached.
[0042] In this case, the gallery to be maintained may be determined in the following manner: receiving a gallery maintenance request. Here, the gallery maintenance request may include a first gallery identifier for indicating a gallery to be maintained and a second gallery identifier for indicating an updated gallery. The gallery to be maintained may refer to a constructed gallery, and the updated gallery may refer to a gallery formed by multiple images that need to be loaded into the gallery to be maintained during this maintenance.
[0043] In response to the above library maintenance request, multiple first images in the library to be maintained indicated by the first library identifier are obtained, and multiple second images in the update library indicated by the second library identifier are obtained, and the library D_Dataset is formed by the multiple first images and the multiple second images.
[0044] In step S102, a predetermined number of target images are selected from the image library to form a cluster training library.
[0045] In the embodiment of the present application, the predetermined number of target images can be extracted from the image library in a random manner. For example, a portion of data is randomly selected from the image library D_Dataset to construct a cluster training library. If the image library D_Dataset includes billions of images, the cluster training library T_Dataset constructed at this time can be about 10 million to 100 million in size.
[0046] In a preferred example, the principle of the random selection is to make the data distribution of the cluster training library T_Dataset consistent with that of the image library D_Dataset, that is, all images in the formed cluster training library can well maintain the data distribution characteristics of the image library.
[0047] In a preferred embodiment, after step S102, the image processing method of the embodiment of the present application may further include step S1021: determining an image feature vector of each image in the cluster training library T_Dataset.
[0048] In an optional example, an image feature extraction model can be used to obtain an image feature vector for each image in the cluster training library T_Dataset. Here, the image feature extraction model can select any existing model that can extract image features. Assume that the Dinov2 model is used to perform Embedding inference on all images in the cluster training library T_Dataset, and each image obtains a corresponding T_Embedding vector. The vectors corresponding to all images in the cluster training library T_Dataset can be expressed as T_Embeddings.
[0049] In addition, other methods can also be used to obtain the image features of each image. This application does not limit the method of obtaining image features and the method of constructing an image feature extraction model.
[0050] In step S103, cluster training is performed on all target images in the cluster training library to obtain multiple cluster centers.
[0051] Here, various methods may be used to perform clustering processing on all target images in the clustering training library T_Dataset, and this application does not impose any limitation on this.
[0052] In a preferred embodiment of the present application, the K-means clustering method can be used to cluster all target images in the cluster training library T_Dataset to obtain K cluster centers. Exemplarily, Faiss-Kmeans clustering training is performed on T_Embeddings of all images in the cluster training library T_Dataset to obtain K cluster centers.
[0053] After obtaining K cluster centers, the cluster feature vector TC_Embedding corresponding to each cluster center may be further determined, that is, the image feature vector of each cluster center.
[0054] In the above K-means clustering method, the selection of K value will affect the number of subsequent sub-libraries and the deduplication processing of sub-libraries on each computing node. In other words, the selection of K value will affect the image duplication between sub-libraries and the consumption of computing resources.
[0055] For example, if the value of K is too large, the distance between multiple cluster centers will be close, which may result in a high degree of image duplication between the sub-libraries constructed based on each cluster center. However, if the value of K is too small, the savings in computing benefits will not be obvious. For example, if K is equal to 2, for a dataset of billions of images, billions of images were originally processed by one computing node. When K=2, each computing node shares the deduplication task, and billions of images still need to be processed on a single computing node, which still consumes a huge amount of computing resources.
[0056] Based on the above considerations, in a preferred embodiment of the present application, the method for determining the K value can be determined according to the computing power of a single computing node and the image scale in the image library D_Dataset. For example, from the perspective of image scale, the selection of the K value can reduce the data scale in each sub-library to a certain extent relative to the data scale in the image library D_Dataset. At the same time, the amount of data that a single computing node can process can also be taken into consideration, that is, by selecting a suitable K value, the data scale in a single sub-library matches the amount of data that a single computing node can process, that is, preferably, a single computing node can bear the task of independently processing the deduplication of a sub-library, which can control the number of occupied computing nodes to a certain extent, and can also reduce the hardware requirements for a single computing node to a certain extent.
[0057] In step S104, all images in the gallery are divided into a plurality of sub-galleries according to the image features of each image in the gallery and a plurality of cluster centers, so as to perform deduplication processing on each sub-galleries respectively.
[0058] For example, the image features of each image in the image library D_Dataset may be compared with the cluster features of each cluster center one by one, and based on the feature similarity, the image may be classified under a cluster center with the highest feature similarity.
[0059] For example, for each image in the image library D_Dataset, the image feature vector corresponding to the image is matched with each cluster feature vector to determine the cluster center to which the image is clustered, and multiple images clustered to the same cluster center are formed into a sub-library SD_Dataset.
[0060] Combination Figure 1, taking the above-mentioned case where a corresponding D_Embedding vector is determined for each image in the gallery D_Dataset as an example, each of the K cluster centers corresponds to a TC_Embedding vector. Exemplarily, the D_Embedding vector of each image can be compared with the TC_Embedding vectors of the K cluster centers respectively to determine the feature similarity between the feature vectors. For example, the D_Embedding vector and the cluster center vector TC_Embedding of each image in the gallery are clustered by Faiss-Kmeans, and the gallery D_Dataset is divided into K sub-gallery SD_Datasets according to the distance from the cluster center, and each image in each sub-gallery corresponds to an image feature vector SD_Embedding. The above-mentioned clustering process can be implemented based on vector indexing. The vector index is a more time- and space-efficient data structure constructed for vectors based on a certain mathematical model, which can efficiently query several vectors similar to the target vector. However, it should be understood that the clustering methods listed above for the gallery are only examples, and the present application is not limited thereto.
[0061] like Figure 1 As shown, there are K sub-libraries in total, and the number of sub-libraries is consistent with the number of cluster centers. Through the above image processing method, the image library is divided into K non-repeating sub-libraries based on Kmeans clustering, that is, it can be considered that the images between the K sub-libraries are not similar.
[0062] In a preferred embodiment of the present application, after obtaining multiple sub-databases, a distributed deduplication method can be used to perform parallel deduplication processing on the multiple sub-databases.
[0063] In this case, the first computing node may further perform the following processing: determine multiple second computing nodes from the node cluster, issue a processing task notification to all the second computing nodes, and perform deduplication processing on each sub-database in parallel on the multiple second computing nodes. Preferably, the number of the multiple second computing nodes may be the same as the number of the multiple sub-databases, so that a single computing node can independently handle the deduplication task of one sub-database.
[0064] The above-mentioned clustering and distributed image processing method can achieve deduplication of ultra-large-scale images. In addition, since the image library is divided into K sub-libraries to perform deduplication on the sub-libraries themselves, deduplication can be performed in a distributed and parallel manner on multiple machines, avoiding the problem of limited resources on a single machine and accelerating the deduplication efficiency in parallel.
[0065] In an optional embodiment of the present application, each second computing node can be Figure 2 The method shown in the figure performs deduplication processing on the sub-library. Here, Figure 2The method for deduplication within the cluster sub-library shown is only an example, and the present application is not limited thereto. Other deduplication means may also be used to perform deduplication processing on each sub-library.
[0066] Figure 2 A flowchart showing the sub-library deduplication processing steps provided by an exemplary embodiment of the present application is shown.
[0067] like Figure 2 As shown, in step S401, the task notification is parsed to obtain a path identifier and a task identifier. Here, the path identifier is used to indicate the storage path of a sub-library SD_Dataset, and the task identifier is used to indicate that deduplication processing is performed on the sub-library.
[0068] In step S402, the image feature vectors SD_Embedding of all images in the sub-library are determined.
[0069] In step S403 and step S404, the sub-library is traversed to extract the image feature vector SD_Embedding(i) of the i-th image from the sub-library.
[0070] Here, 1≤i≤n, n is the total number of images in the sub-library, and i represents the i-th image in the sub-library.
[0071] In step S405, vector similarities between the image feature vector of the i-th image and the plurality of image feature vectors in step S402 are calculated respectively.
[0072] Here, the similarity calculation method between vectors is the basis of vector retrieval, which is used to measure the similarity between vector data. If two embedding vectors are very similar, it means that the original data sources are also similar. Exemplarily, various existing vector similarity calculation methods can be used, and this application does not limit this.
[0073] In a preferred example, the image feature vector SD_Embedding(i) of the i-th image is included in step S402. In this case, the vector similarity may not be calculated for two identical images in step S405.
[0074] In step S406, it is determined whether the vector similarity is less than a threshold value Th. Here, a threshold value Th may be pre-set as a threshold parameter for deduplication within SD_Dataset.
[0075] If the vector similarity is less than the threshold Th, the two images are considered similar or identical. At this time, step S407 is executed: deduplication is performed on the i-th image, that is, the i-th image is deleted from the sub-library.
[0076] If the vector similarity is not less than (i.e., greater than or equal to) the threshold value Th, the two images are considered to be dissimilar or different. At this time, the i-th image is retained in the sub-library, and i=i+1 is set to continue calculating the vector similarity between the image feature vector of the i+1-th image and the multiple image feature vectors in step S402, and then based on the comparison result of the vector similarity and the threshold value Th, it is determined whether to perform deduplication for the i+1-th image, and this cycle is repeated until the retrieval of n images in the sub-library is completed.
[0077] In related technologies, such as the Faiss-based image deduplication solution, if the image library contains N images, then N×N vector search calculations are required, which takes a very long time for deduplication of ultra-large-scale image libraries. In addition, the above Faiss is a stand-alone solution. Due to limited video memory, it is difficult to load all D_Embedding into the video memory at once.
[0078] In addition to the above methods, you can also perform image deduplication based on Milvus. The specific process is: use the algorithm model to obtain the Embedding vectors of all images in the gallery (e.g., N images), including N*M dimensions, and store them in the Milvus vector database. Set the deduplication vector similarity threshold, and then perform vector similarity retrieval based on Milvus, that is, traverse the Embedding of each image and deduplicate images whose vector similarity distance is less than the similarity threshold.
[0079] The above-mentioned Milvus-based image deduplication solution also requires N×N vector retrieval calculations for N images in the gallery, which takes a very long time for ultra-large-scale gallery deduplication. In addition, Milvus also consumes a lot of resources to import D_Embedding vectors.
[0080] Under the above-mentioned existing deduplication method, when the size of the image increases, its computational complexity increases exponentially. The deduplication processing scheme of the embodiment of the present application has an overall computational complexity of: K×(N / K)×(N / K)=N×N / K, that is, through the image processing method of the present application, when the size of the image increases, its computational complexity becomes linear growth.
[0081] In the clustering and distributed image deduplication solution of the embodiment of the present application, by taking the following aspects into consideration, it is possible to efficiently implement ultra-large-scale image library deduplication under resource constraints.
[0082] First, the number of computing nodes is saved. In the existing deduplication scheme, as the size of the image library data increases, the computational complexity increases exponentially, and the number of computing nodes occupied by it also increases sharply. In the embodiment of the present application, the number of multiple sub-libraries is determined by considering the computing power of a single computing node and the size of the images in the image library, so as to reduce the number of computing nodes used in the image deduplication process to a certain extent.
[0083] Second, the image deduplication processing scheme is not limited to GPU or CPU. In the embodiment of the present application, the image deduplication processing can be performed on GPU or CPU. Preferably, the deduplication efficiency of the image processing scheme is higher when it is performed on GPU.
[0084] Third, the equipment requirements for a single computing node are reduced. In the embodiment of the present application, a single computing node can handle the image scale of a sub-library, so that the equipment requirements for a single computing node (such as video memory size, GPU usage, video memory usage, and / or CPU usage, etc.) are reduced, which helps to reduce costs.
[0085] Based on the same application concept, an image processing device corresponding to the method provided in the above embodiment is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the image processing method in the above embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0086] Figure 3 The schematic diagram of the structure of the image processing device provided by the exemplary embodiment of the present application is shown in FIG. Figure 3 As shown, the image processing device 200 includes:
[0087] The image library acquisition module 210 acquires the image features of each image in the image library;
[0088] An image selection module 220 selects a predetermined number of target images from the image library to form a cluster training library;
[0089] A clustering module 230, which performs clustering training on all target images in the clustering training library to obtain multiple cluster centers;
[0090] The division module 240 divides all the images in the gallery into a plurality of sub-galleries according to the image features of each image in the gallery and the plurality of cluster centers, so as to perform deduplication processing on each sub-galleries respectively.
[0091] In a possible implementation manner of the present application, the data distribution of the cluster training library is consistent with that of the image library, and / or the predetermined number of target images are extracted from the image library in a random selection manner.
[0092] In a possible implementation manner of the present application, the image library acquisition module 210 is further used to: for each image, obtain an image feature vector of the image through an image feature extraction model, where each element in the image feature vector corresponds to an image feature.
[0093] In a possible implementation of the present application, the partitioning module 240 is further used to: determine the cluster feature vector corresponding to each cluster center; for each image in the gallery, match the image feature vector corresponding to the image with each cluster feature vector to determine the cluster center to which the image is clustered; and form multiple images clustered to the same cluster center into a sub-library.
[0094] In a possible implementation of the present application, the partitioning module 240 is further used to: determine a plurality of second computing nodes from the node cluster, the number of the plurality of second computing nodes being the same as the number of the plurality of sub-libraries; and publish a processing task notification to all second computing nodes so as to perform deduplication processing on each sub-library in parallel on the plurality of second computing nodes.
[0095] In one possible implementation of the present application, each second computing node performs deduplication processing on the sub-library in the following manner: parse the processing task notification to obtain a path identifier and a task identifier, the path identifier is used to indicate a storage path of a sub-library, and the task identifier is used to indicate that deduplication processing is to be performed on the sub-library; read multiple images in the sub-library from the storage path, and perform deduplication processing on the multiple images in the sub-library.
[0096] In a possible implementation of the present application, it also includes a gallery determination module, which is used to: receive a gallery maintenance request, the gallery maintenance request including a first gallery identifier for indicating a gallery to be maintained and a second gallery identifier for indicating an updated gallery; obtain a plurality of first images in the gallery to be maintained indicated by the first gallery identifier; obtain a plurality of second images in the updated gallery indicated by the second gallery identifier; and form the gallery from the plurality of first images and the plurality of second images.
[0097] In one possible implementation of the present application, the clustering module is further used to: use the K-means clustering method to cluster all target images in the clustering training library to obtain K cluster centers, wherein the value of K is determined based on the computing power of a single computing node and the scale of images in the library.
[0098] Based on the above device, the deduplication efficiency for ultra-large-scale images can be effectively improved.
[0099] See also Figure 4 , Figure 4 The schematic diagram of the structure of the electronic device provided by the exemplary embodiment of the present application. Figure 4 As shown, the electronic device 300 includes a processor 310 , a memory 320 and a bus 330 .
[0100] The memory 320 stores machine-readable instructions executable by the processor 310. When the electronic device 300 is running, the processor 310 communicates with the memory 320 via the bus 330. When the machine-readable instructions are executed by the processor 310, the steps of the image processing method in any of the above embodiments can be performed, which are specifically as follows:
[0101] The method comprises the following steps: obtaining image features of each image in a gallery; selecting a predetermined number of target images from the gallery to form a cluster training gallery; obtaining a plurality of cluster centers by performing cluster training on all target images in the cluster training gallery; and dividing all images in the gallery into a plurality of sub-gallery according to the image features of each image in the gallery and the plurality of cluster centers, so as to perform deduplication processing on each sub-gallery respectively.
[0102] Based on the above electronic devices, the deduplication efficiency for large-scale images can be effectively improved.
[0103] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image processing method in any of the above embodiments can be executed, which are as follows:
[0104] The method comprises the following steps: obtaining image features of each image in a gallery; selecting a predetermined number of target images from the gallery to form a cluster training gallery; obtaining a plurality of cluster centers by performing cluster training on all target images in the cluster training gallery; and dividing all images in the gallery into a plurality of sub-gallery according to the image features of each image in the gallery and the plurality of cluster centers, so as to perform deduplication processing on each sub-gallery respectively.
[0105] Based on the above computer-readable storage medium, the deduplication efficiency for ultra-large-scale images can be effectively improved.
[0106] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0107] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0108] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0109] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0110] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: The method comprises: Get the image features of each image in the gallery; Selecting a predetermined number of target images from the image library to form a cluster training library; By performing clustering training on all target images in the clustering training library, a plurality of clustering centers are obtained; According to the image features of each image in the gallery and the multiple cluster centers, all images in the gallery are divided into multiple sub-galleries, so as to perform deduplication processing on each sub-galleries respectively.
2. The method according to claim 1, characterized in that The data distribution of the cluster training library is consistent with that of the image library. And / or, the predetermined number of target images are extracted from the image library in a random selection manner.
3. The method according to claim 1, characterized in that The image features of each image are determined by: For each image, an image feature vector of the image is obtained through an image feature extraction model, and each element in the image feature vector corresponds to an image feature.
4. The method according to claim 3, characterized in that The step of dividing all images in the gallery into a plurality of sub-galleries according to the image features of each image in the gallery and the plurality of cluster centers comprises: Determine the cluster feature vector corresponding to each cluster center; For each image in the gallery, matching the image feature vector corresponding to the image with each cluster feature vector to determine the cluster center to which the image is clustered; Multiple images clustered to the same cluster center are formed into a sub-library.
5. The method according to claim 1, characterized in that The method further comprises: Determine a plurality of second computing nodes from the node cluster, the number of the plurality of second computing nodes being the same as the number of the plurality of sub-databases; A processing task notification is issued to all second computing nodes, so that deduplication processing is performed on each sub-database in parallel on the plurality of second computing nodes.
6. The method according to claim 5, characterized in that Each second computing node performs deduplication processing on the sub-database in the following way: Parsing the processing task notification to obtain a path identifier and a task identifier, wherein the path identifier is used to indicate a storage path of a sub-library, and the task identifier is used to indicate to perform deduplication processing on the sub-library; The plurality of images in the sub-library are read from the storage path, and deduplication processing is performed on the plurality of images in the sub-library.
7. The method according to claim 1, characterized in that The method further comprises: receiving a gallery maintenance request, the gallery maintenance request including a first gallery identifier for indicating a gallery to be maintained and a second gallery identifier for indicating an updated gallery; Acquire a plurality of first images in the gallery to be maintained indicated by the first gallery identifier; Acquire a plurality of second images in the updated gallery indicated by the second gallery identifier; The gallery is formed by the plurality of first images and the plurality of second images.
8. The method according to claim 1, characterized in that The method of obtaining a plurality of cluster centers by clustering all target images in the cluster training library includes: Using the K-means clustering method, all target images in the clustering training library are clustered to obtain K cluster centers. The value of K is determined according to the computing power of a single computing node and the scale of images in the image library.
9. An image processing platform, characterized in that: The image processing platform includes a node cluster, wherein a first computing node in the node cluster performs the following processing: Get the image features of each image in the gallery; Selecting a predetermined number of target images from the image library to form a cluster training library; By performing clustering training on all target images in the clustering training library, a plurality of clustering centers are obtained; According to the image features of each image in the gallery and the multiple cluster centers, all images in the gallery are divided into multiple sub-galleries, so as to perform deduplication processing on each sub-galleries respectively.
10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of any method as claimed in claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are executed.