Methods, apparatus, storage media, and electronic devices for determining the archive to which an image belongs.
By determining the similarity between images and archives, the problem of inaccurate archives to which the image belongs is solved, and more accurate image archiving is achieved.
Patent Information
- Application Number
- CN202111088385.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-16
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2041-09-16
AI Technical Summary
In the prior art, it is inaccurate to determine the archive to which the image belongs, especially in multiple images, and some images cannot be accurately classified into the corresponding archive.
By acquiring the plurality of images to be archived, a first similarity between each image and a predetermined archive is determined, and a second similarity between the two images in the plurality of images, and each image and the archive is determined based on these similarities. The target similarity of each file included in the finalize the target archive to which each image belongs.
It improves the similarity accuracy between images and archives, solves the problem of inaccurate archives to which the image belongs, and achieves more accurate image archiving.
Smart Images

Figure CN113762202B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a method, device, storage medium and electronic device for determining a file to which an image belongs. Background Art
[0002] In the related art, when establishing a personnel file, usually only the main file portrait of the file is selected, and the identified portrait is compared with the main file portrait features. If the relevant threshold is reached, it is considered to be the same person, otherwise a new file is created. Some file creation schemes involve updating the main file portrait. For example, the main file portrait is updated by setting weights through one or more quality parameters of the photo (the main file portrait represents the representative portrait in the file, and the latest snapshot photo features will be compared with the main file portrait to determine whether it should be included in the file). However, when the three pictures A, B, and C are all of the same person, A and B reach the threshold, B and C reach the threshold, and A and C do not reach the threshold. If A is the main file portrait, C cannot be included in the file where A is.
[0003] It can be seen from this that the related art has the problem of inaccurately determining the file to which the image belongs.
[0004] Currently, no effective solution has been proposed for the above-mentioned problems existing in the related technologies. Summary of the invention
[0005] The embodiments of the present invention provide a method, device, storage medium and electronic device for determining the file to which an image belongs, so as to at least solve the problem of inaccurate determination of the file to which an image belongs in the related art.
[0006] According to one embodiment of the present invention, there is provided a method for determining the archive to which an image belongs, comprising: acquiring a plurality of images to be archived, wherein each of the images includes a target object; determining a first similarity between each of the images and a predetermined archive; determining a second similarity between any two of the plurality of images; determining a target similarity between each of the images and each archive included in the archive based on the first similarity and the second similarity; and determining a target archive to which each of the images belongs based on the target similarity.
[0007] According to another embodiment of the present invention, there is provided a device for determining the archive to which an image belongs, comprising: an acquisition module, for acquiring a plurality of images to be archived, wherein each of the images includes a target object; a first determination module, for determining a first similarity between each of the images and a predetermined archive; a second determination module, for determining a second similarity between any two of the plurality of images; a third determination module, for determining a target similarity between each of the images and each archive included in the archive based on the first similarity and the second similarity; and a fourth determination module, for determining the target archive to which each of the images belongs based on the target similarity.
[0008] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of any of the above methods when executed by a processor.
[0009] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0010] Through the present invention, multiple images to be archived are obtained, a first similarity between each image and a predetermined archive is determined, a second similarity between two images in the multiple images is determined, a target similarity between each image and each archive included in the archive is determined based on the first similarity and the second similarity, and a target archive to which each image belongs is determined based on the target similarity. Since the target similarity between an image and each archive can be determined based on the similarity between images and the similarity between an image and an archive, the accuracy of the similarity between an image and an archive is improved, and therefore, the problem of inaccurate determination of an archive to which an image belongs in the related art can be solved, achieving the effect of improving the accuracy of determining an archive to which an image belongs. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 It is a hardware structure block diagram of a mobile terminal of a method for determining a file to which an image belongs according to an embodiment of the present invention;
[0012] Figure 2 is a flow chart of a method for determining a file to which an image belongs according to an embodiment of the present invention;
[0013] Figure 3 is a schematic diagram of an operating device of a method for determining a file to which an image belongs according to a specific embodiment of the present invention;
[0014] Figure 4 is a flow chart of a method for determining the archive to which an image belongs according to a specific embodiment of the present invention;
[0015] Figure 5 4 is a structural block diagram of a device for determining a file to which an image belongs according to an embodiment of the present invention. DETAILED DESCRIPTION
[0016] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.
[0017] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0018] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for determining the archive to which an image belongs according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0019] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining the archive to which the image belongs in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0020] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0021] In this embodiment, a method for determining the file to which an image belongs is provided. Figure 2 FIG. 4 is a flow chart of a method for determining a file to which an image belongs according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0022] Step S202, obtaining a plurality of images to be archived, wherein each of the images includes a target object;
[0023] Step S204, determining a first similarity between each of the images and a predetermined file;
[0024] Step S206, determining a second similarity between any two of the images;
[0025] Step S208, determining a target similarity between each of the images and each of the files included in the files based on the first similarity and the second similarity;
[0026] Step S210: determining the target profile to which each of the images belongs based on the target similarity.
[0027] In the above embodiment, the image captured by the front-end device can be obtained, and the captured image can be filtered to filter out the images that do not meet the requirements. For example, images with a clarity less than a predetermined threshold value can be filtered out, images that do not contain the target object can be filtered out, etc. The filtered image is determined as the image to be archived. The target object can be a person, a vehicle, etc.
[0028] In the above embodiment, multiple archives can be predetermined, and each archive stores images of the same object. After acquiring multiple images to be archived, the first similarity between each image and the predetermined archive can be determined respectively, and the second similarity between two images in the multiple images can be determined. The target similarity between each image and each archive is determined based on the first similarity and the second similarity, and the target archive to which each image belongs is determined based on the target similarity. In particular, when determining the similarity, the features of the image can be proposed, and the similarity of the image can be determined based on the similarity of the features.
[0029] In the above embodiment, multiple images to be archived can be acquired in batches according to a predetermined time period, wherein the multiple images to be archived include images that fail to be archived, wherein the number of times the images that fail to be archived are archived is less than a predetermined number, and when the number of times the images that fail to be archived are archived is greater than or equal to the predetermined number, a new archive can be created for each image that fails to be archived.
[0030] Optionally, the executor of the above steps may be a background processor, or other devices with similar processing capabilities, or a machine that integrates at least an image acquisition device and a data processing device, wherein the image acquisition device may include a graphics acquisition module such as a camera, and the data processing device may include a computer, a mobile phone or other terminal, but is not limited thereto.
[0031] Through the present invention, multiple images to be archived are obtained, a first similarity between each image and a predetermined archive is determined, a second similarity between two images in the multiple images is determined, a target similarity between each image and each archive included in the archive is determined based on the first similarity and the second similarity, and a target archive to which each image belongs is determined based on the target similarity. Since the target similarity between an image and each archive can be determined based on the similarity between images and the similarity between an image and an archive, the accuracy of the similarity between an image and an archive is improved, and therefore, the problem of inaccurate determination of an archive to which an image belongs in the related art can be solved, achieving the effect of improving the accuracy of determining an archive to which an image belongs.
[0032] In an exemplary embodiment, determining the target similarity between each of the images and each of the archives included in the archive based on the first similarity and the second similarity includes: determining a target order based on the first similarity and the second similarity; and determining the target similarity between each of the images and each of the archives included in the archive in sequence based on the first similarity and the second similarity according to the target order. In this embodiment, after determining the first similarity and the second similarity, the target order can be determined according to the first similarity and the second similarity. The target order is used to indicate the order of confirming the target similarity of the images. After determining the target order, the target similarity between each of the images and each of the archives can be determined in sequence according to the first similarity and the second similarity according to the target order.
[0033] In an exemplary embodiment, determining the target order based on the first similarity and the second similarity includes: determining the maximum similarity corresponding to each of the images from the first similarity and the second similarity to obtain multiple maximum similarities; sorting each of the images according to a predetermined rule based on the multiple maximum similarities to obtain the target order. In this embodiment, the maximum similarity corresponding to each image can be determined from the first similarity and the second similarity to obtain multiple maximum similarities, and the images can be sorted according to the predetermined rule based on the multiple maximum similarities to obtain the target order. The predetermined rule can be an order from large to small similarities. After obtaining the target order, the target similarity of each image can be determined in sequence according to the target order, the first similarity, and the second similarity.
[0034] In an exemplary embodiment, determining the target similarity between each image and each archive included in the archive based on the first similarity and the second similarity in the target order includes: determining the target similarity between each image and each archive included in the archive in the target order by the following formula:
[0035] Among them, S ik represents the target similarity between image i and file k, s ij represents the similarity between image i and image j, s jk Indicates the similarity between image j and file k, flag j Represents the assigned label value of image j; based on the target similarity, the similarity of the target similarity that has been confirmed in the first similarity is updated; based on the updated first similarity, the second similarity and the target order, the target similarity is determined until the target similarities of all images are determined. In this embodiment, when determining the target similarity, the target similarity of each image with each archive can be determined in sequence according to the target order. That is, first determine the target similarity of the image ranked first with the maximum similarity and each archive, and then determine the target similarity of the image ranked second with each archive...
[0036] In the above embodiment, according to Determine the target similarity between image i and file k, where flag j Indicates the assigned label value of image j. When image j is an image whose target similarity has not been determined, the label value of image j is 0. When image j is an image whose target similarity has been determined or is being determined, the label value of image j is 1.
[0037] In the above embodiment, the second similarity between the acquired images and the first similarity between the image and the archive can be periodically determined according to the interval time, and the similarity SMAX can be used to calculate the similarity between the acquired images and the archive. i Sort by descending size (i.e. ascending Euclidean distance). Initially, the first similarity and the second similarity can be expressed as Among them, the initial S is composed of s ij Since the similarity between data features is mutual, s ij =s ji ;SMAX i Indicates the maximum value of the i-th column and the main file (including the main file of the established archive and the main file obtained by the initial cluster analysis), excluding the similarity of the feature data itself (the similarity itself is 100%); flag i The i-th column is 0, which means it is not processed; class i Indicates the category to which data i belongs, that is, k represents the characteristic serial number of the cluster analysis data, which is an established master file or a newly added master file for the initial cluster analysis.
[0038] In the above embodiment, according to SMAX i The method of sorting (i.e., starting from the data with the highest probability of being archived) is to select the i-th column data in turn, process the selected i-th column data, and determine the target similarity between the i-th column image and the file k as follows: For example, when there are three images A, B, and C and two files X and Y, the determined first similarity and second similarity can refer to Table 1.
[0039] Table 1
[0040]
[0041]
[0042] Determining the maximum similarity of each image, we can obtain Table 2.
[0043] Table 2
[0044] data A B C Maximum similarity of columns 95% 92% 86%
[0045] Then the similarity between A, B, C and X, Y can be determined in the order of A, B, C. According to the above formula, the similarity between A and X, Y can be seen in Table 3.
[0046] Table 3
[0047] data A X 95%+0%=95% Y 80%+0%=80%
[0048] The determined similarity is used to update the first similarity. Then, based on the first similarity, the second similarity and the target similarity of the next image in the target sequence (i.e., image B), the determined similarity between B and X and Y can be seen in Table 4.
[0049] Table 4
[0050] data A B X 95% (84%+92%*95%) / 2=85.7% Y 80% (80%+92%*80%) / 2=76.8%
[0051] The determined similarity is then used to update the first similarity, and then the target similarity of the next image in the target sequence (i.e., image C) is determined. The determined similarity between C and X and Y can be seen in Table 5.
[0052] Table 5
[0053] data A B C X 95% 85.7% (80%+95%*75%+85.7%*80%) / 3=73.27% Y 80% 76.8% (86%+80%*75%+76.8%*80%) / 3=69.14%
[0054] In the above embodiment, the target file to which the image belongs can be determined by the following formula: Among them, if data j has been processed and clearly belongs to class j , then calculate the data i and class j Whether data j has been processed is indicated by flag j Control, flag j = 0 means unprocessed; k range is Z, where Z represents the previously established master file feature serial number or the master file feature serial number set newly generated in the cluster analysis module. During the calculation process, if multiple data belong to the same category k, then s are accumulated in sequence. ik Sum; when i=j, flag j is 1, indicating that no matter whether data i is processed or not, the initial attribution of the data itself should be calculated; finally, the maximum s iv Determine whether data i belongs to category v. Modify flag i = 1. Continue to traverse the column data until all column data are traversed and processed, and get Therefore, the neighbor data information in the undirected graph can be used to obtain the optimized clustering results.
[0055] In an exemplary embodiment, before determining the target similarity between each of the images and each of the archives included in the archive, the method further includes: determining the processing status of each of the images; and assigning a label value to each of the images based on the processing status. In this embodiment, before determining the target similarity, the processing status of each image can be first determined, and the assigned label value for each image can be determined based on the processing status. Wherein, when the processing status is an unprocessed state, that is, when the target similarity of the image has not been determined, the label value of the image is 0, and when the processing status is a processed state, that is, when the target similarity of the image has been determined, the label value of the image is 1.
[0056] In an exemplary embodiment, determining the target profile to which each image belongs from the profile based on the target similarity includes: determining whether there is a first profile that meets a first predetermined condition in the profile based on the target similarity; if the first profile exists, determining the first profile as the target profile; if the first profile does not exist, creating a second profile and determining the second profile as the target profile. In this embodiment, after determining the target similarity between each image and each profile, it can be determined based on the target similarity whether there is a first profile that meets the first predetermined condition in the profile, and if so, determining the first profile as the target profile. The first predetermined condition can be that the similarity with the image is greater than a predetermined threshold. If the first profile does not exist, a second profile can be created and determined as the profile of the image.
[0057] In the above embodiment, creating a second archive includes: when there is no archive that satisfies the first predetermined condition with the first image included in the image in the predetermined archive, the first image can be determined as the image to be archived, and the number of re-archiving times is allocated to the first image, and the first image can be used together with the image acquired in the next cycle to determine the target similarity. If there is an archive that satisfies the first predetermined condition with the first image in the predetermined archive in the next archive, the archive is determined as the target archive. If it still does not exist, the next archive is performed. When the number of archives exceeds the number of re-archiving times, a second archive is created and the second archive is determined as the target archive. The number of re-archiving times can be set according to the user's accuracy requirements or the server performance configuration.
[0058] In an exemplary embodiment, the method further includes: sequentially determining the third similarity of two archives included in the archive; determining the target archive similarity between each archive and other archives based on the first similarity and the third similarity; determining the third archive and the fourth archive that meet the second predetermined condition based on the target archive similarity; merging the third archive and the fourth archive. In this embodiment, the third similarity between archives can also be determined, and the target archive similarity between each archive and other archives is determined based on the first similarity and the third similarity. Among them, other archives are archives other than the current archive included in the archive, that is, the archive includes multiple archives, and the similarity between one archive and other archives is determined each time, and then the similarity between the next archive and other archives is determined. The archive with similarity determined each time is the current archive, and the archives other than the current archive are other archives. Determine the third archive and the fourth archive that meet the second predetermined condition based on the target archive similarity. Merge the third archive and the fourth archive into one archive. That is, according to S' obtained in the secondary processing module, the belonging category of each data is obtained by similarity sorting; if the two main archives are processed to belong to the same category, the two archives are directly merged. The second predetermined condition is that the similarity between the two files is greater than a predetermined threshold. If the flag for performing the secondary processing multiple times is not set, the data is directly stored in the database for archiving; if the data is returned to the secondary processing module for processing, the operation of determining the similarity of the target file is performed again. The method for determining the similarity of the target file is the same as the method for determining the target similarity.
[0059] In an exemplary embodiment, determining the first similarity between each of the images and a predetermined archive includes: performing a first clustering process on each of the images included in the images and the images included in the archive to obtain a first clustering result, and determining the first similarity based on the first clustering result; determining the second similarity between the two images in the plurality of images includes: performing a second clustering process on the two images included in the images to obtain a second clustering result, and determining the second similarity based on the second clustering result. In this embodiment, when determining the similarity, it can be determined by clustering image features. Among them, the clustering process can include partition clustering, hierarchical clustering, density clustering, K-means clustering, etc. That is, the first clustering process and the second clustering process can be partition clustering, hierarchical clustering, density clustering, K-means clustering, etc. It should be noted that the clustering process can be filtered using default parameters, and can also be modified according to customer requirements.
[0060] The following is a description of a method for determining the archive to which an image belongs in conjunction with a specific implementation method:
[0061] Figure 3The invention is an operating device of a method for determining the archive to which an image belongs according to a specific embodiment of the invention. The device comprises: a snapshot processing module, a cluster analysis module, a secondary processing module and an archiving module.
[0062] The snapshot processing module is used to obtain front-end snapshots, filter out pictures that do not meet the clustering analysis requirements, and extract features from pictures that meet the requirements.
[0063] The cluster analysis module is used to obtain the features obtained by the snapshot processing module, perform cluster analysis periodically at intervals t, and classify the features according to the similarity SMAX. i Sort by descending size (i.e. ascending Euclidean distance). Cluster analysis methods include but are not limited to partition clustering, hierarchical clustering, density clustering, etc. Here, the K-means clustering method is taken as an example to obtain the following data:
[0064] The clustering analysis results are constructed into an undirected graph with each data point as the vertex set and S as the edge set.
[0065] Among them, the initial S is composed of s ij Since the similarity between data features is mutual, s ij =sji;SMAX i Indicates the maximum value of the i-th column and the main file (including the main file of the established archive and the main file obtained by the initial cluster analysis), excluding the similarity of the feature data itself (the similarity itself is 100%); flag i The i-th column is 0, which means it is not processed; class i Indicates the category to which data i belongs, that is, k represents the characteristic serial number of the cluster analysis data, which is an established master file or a newly added master file for the initial cluster analysis.
[0066] Secondary processing module for SMAX i The data in the i-th column are sorted (i.e., the data with the highest probability of being archived are processed first), and the i-th column data are selected in turn; the i-th column data selected are processed, and the category attribution of the data i is calculated as follows:
[0067]
[0068] Modify flag i =1, continue to traverse the column data until all column data are traversed and processed, and get:
[0069]
[0070] Therefore, the optimized clustering result is obtained by utilizing the neighbor data information in the undirected graph.
[0071] The archiving module is used to obtain the category of each data by sorting the similarity according to S' obtained in the secondary processing module; if the two main files are processed to belong to the same category, the two files are directly merged. If the flag of performing secondary processing multiple times is not set, the data is directly stored and archived; if it is set, the data is returned to the secondary processing module for further processing.
[0072] Figure 4 is a flow chart of a method for determining the archive to which an image belongs according to a specific embodiment of the present invention. Figure 4 As shown, the process includes:
[0073] Step S402, obtaining a front-end captured image;
[0074] Step S404, extracting features from the captured image;
[0075] Step S406, cluster analysis is performed on the features and the existing master file features;
[0076] Step S408, arranging the preliminary clustering results in descending order of similarity;
[0077] Step S410, traverse in sequence according to the sorting results and recalculate each data point;
[0078] Step S412, forming a to-be-filed file according to the recalculated result;
[0079] Step S414, traverse each file type to be archived and perform archiving processing.
[0080] The following is an example with specific examples:
[0081] There are captured portraits A, B, C, and master files X, Y. Assume that the data of A-C are in the same period. The similarity of 85% is the set threshold for the same person.
[0082] The execution steps are as follows:
[0083] 1. Periodically obtain snapshot data to obtain A-C;
[0084] 2. Obtain the similarity between each snapshot and the main file as shown in Table 6. No new main file is added in this round of cluster analysis:
[0085] Table 6
[0086] data A B C X Y A 100% 92% 75% 95% 80% B 92% 100% 80% 84% 80% C 75% 80% 100% 80% 86% X 95% 84% 80% 100% 80% Y 80% 80% 86% 80% 100%
[0087] 3. Calculate the maximum similarity of each column, as shown in Table 7.
[0088] Table 7
[0089]
[0090] 4. Calculate the target similarity of each image in turn based on the maximum column similarity.
[0091] Among them, the target similarity calculation method of A is shown in Table 7.
[0092] Table 7
[0093] data A X 95%+0%=95% Y 80%+0%=80%
[0094] The target similarity calculation method of B is shown in Table 8.
[0095] Table 8
[0096] data A B X 95% (84%+92%*95%) / 2=85.7% Y 80% (80%+92%*80%) / 2=76.8%
[0097] The target similarity calculation method of C is shown in Table 9.
[0098] Table 9
[0099] data A B C X 95% 85.7% (80%+95%*75%+85.7%*80%) / 3=73.27% Y 80% 76.8% (86%+80%*75%+76.8%*80%) / 3=69.14%
[0100] Similarly, calculate the similarity between each data and the existing master file and the newly added master file in turn:
[0101] data A B C X Y X 95% 85.7% 73.27% 100% 68.25% Y 80% 76.8% 69.14% 68.25% 100%
[0102] The secondary processing module is not executed multiple times here, and the archiving result is obtained from the new table result: A and B belong to X; C does not find a suitable master file and becomes a new file; the archiving result is stored in the database for the next round of operations.
[0103] In the above embodiments, the portrait information of the same person can be optimized based on the graph theory neighbor information, and the portrait information can be merged into the same file by utilizing the aggregation between snapshots, which effectively avoids the problem of multiple files for the same person, simplifies the difficulty of data management, and effectively establishes the file of the same person.
[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0105] In this embodiment, a device for determining the archive to which an image belongs is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are omitted. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0106] Figure 5 is a structural block diagram of a device for determining the archive to which an image belongs according to an embodiment of the present invention. Figure 5 As shown, the device comprises:
[0107] An acquisition module 502 is used to acquire a plurality of images to be archived, wherein each of the images includes a target object;
[0108] A first determination module 504, configured to determine a first similarity between each of the images and a predetermined profile;
[0109] A second determination module 506, configured to determine a second similarity between any two of the images;
[0110] A third determination module 508, configured to determine a target similarity between each of the images and each of the archives included in the archive based on the first similarity and the second similarity;
[0111] The fourth determination module 510 is configured to determine the target profile to which each of the images belongs based on the target similarity.
[0112] Among them, the acquisition module 502 corresponds to the above-mentioned snapshot processing module, the first determination module 504 and the second determination module 506 correspond to the above-mentioned cluster analysis module, the third determination module 508 corresponds to the above-mentioned secondary processing module, and the fourth determination module 510 corresponds to the above-mentioned archiving module.
[0113] In an exemplary embodiment, the third determination module 508 can determine the target similarity between each of the images and each of the archives included in the archive based on the first similarity and the second similarity in the following manner: sort each of the images based on the first similarity and the second similarity to obtain a target order; and determine the target similarity between each of the images and each of the archives included in the archive in sequence based on the first similarity and the second similarity according to the target order.
[0114] In an exemplary embodiment, the third determination module 508 can determine the target order based on the first similarity and the second similarity in the following manner: determine the maximum similarity corresponding to each of the images from the first similarity and the second similarity to obtain multiple maximum similarities; and sort each of the images according to a predetermined rule based on the multiple maximum similarities to obtain the target order.
[0115] In an exemplary embodiment, the third determination module 508 can determine the target similarity between each image and each archive included in the archive based on the first similarity and the second similarity in the target order in the following manner: determine the target similarity between each image and each archive included in the archive in the target order in the following formula: Among them, S ik represents the target similarity between image i and file k, s ij represents the similarity between image i and image j, s jk Indicates the similarity between image j and file k, flag j Representing the assigned label value of image j; updating the similarities that have confirmed the target similarity included in the first similarity based on the target similarity; determining the target similarity based on the updated first similarity, the second similarity and the target sequence until the target similarities of all images are determined.
[0116] In an exemplary embodiment, the apparatus may be configured to determine a processing state of each of the images before determining the target similarity between each of the images and each of the archives included in the archives; and assign a label value to each of the images based on the processing state.
[0117] In an exemplary embodiment, the fourth determination module 510 can determine the target profile to which each of the images belongs from the profiles based on the target similarity in the following manner: determine whether there is a first profile that satisfies a first predetermined condition in the profiles based on the target similarity; if the first profile exists, determine the first profile as the target profile; if the first profile does not exist, create a second profile and determine the second profile as the target profile.
[0118] In an exemplary embodiment, the device is also used to sequentially determine the third similarities between pairs of files included in the files; determine the target file similarity between each of the files and the other files based on the first similarity and the third similarity; determine the third file and the fourth file that meet the second predetermined condition based on the target file similarity; and merge the third file and the fourth file.
[0119] In an exemplary embodiment, the first determination module 504 can determine the first similarity between each of the images and a predetermined archive in the following manner: perform a first clustering process on each image included in the image and the image included in the archive to obtain a first clustering result, and determine the first similarity based on the first clustering result; the second determination module 506 can determine the second similarity between any two images in the plurality of images in the following manner: perform a second clustering process on any two images included in the image to obtain a second clustering result, and determine the second similarity based on the second clustering result.
[0120] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0121] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0122] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0123] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0124] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0125] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0126] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0127] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for determining the archive to which an image belongs, characterized in that: include: Acquire a plurality of images to be archived, wherein each of the images includes a target object; determining a first similarity between each of the images and a predetermined profile; Determining a second similarity between any two of the images; determining a target similarity between each of the images and each of the archives included in the archive based on the first similarity and the second similarity; Determining the target profile to which each of the images belongs based on the target similarity; Determining the target similarity between each of the images and each of the archives included in the archive based on the first similarity and the second similarity includes: sorting each of the images based on the first similarity and the second similarity to obtain a target order; determining the target similarity between each of the images and each of the archives included in the archive in sequence based on the first similarity and the second similarity according to the target order; Determining the target profile to which each image belongs from the profile based on the target similarity includes: determining whether there is a first profile that satisfies a first predetermined condition in the profile based on the target similarity; if the first profile exists, determining the first profile as the target profile; if the first profile does not exist, creating a second profile and determining the second profile as the target profile.
2. The method according to claim 1, characterized in that Determining the target order based on the first similarity and the second similarity includes: determining a maximum similarity corresponding to each of the images from the first similarities and the second similarities to obtain a plurality of maximum similarities; Each of the images is sorted according to a predetermined rule based on the multiple maximum similarities to obtain a target order.
3. The method according to claim 1, characterized in that Determining the target similarity between each of the images and each of the archives included in the archive in sequence based on the first similarity and the second similarity according to the target order includes: The target similarity between each image and each file included in the file is determined in sequence by the following formula according to the target order: Among them, S ik represents the target similarity between image i and file k, where k is the file number and s ij represents the similarity between image i and image j, s jk Indicates the similarity between image j and file k, flag j represents the assigned label value of image j; updating the similarities included in the first similarity and for which the target similarity has been confirmed based on the target similarity; The target similarity is determined based on the updated first similarity, the second similarity and the target order until the target similarities of all images are determined.
4. The method according to claim 3, characterized in that Before determining the target similarity between each of the images and each of the archives included in the archive, the method further comprises: determining a processing status of each of said images; A label value is assigned to each of the images based on the processing status.
5. The method according to claim 1, characterized in that The method further comprises: sequentially determining the third similarity between any two files included in the files; Determine the target file similarity of each of the files with other files based on the first similarity and the third similarity; Determining a third file and a fourth file that meet a second predetermined condition based on the target file similarity; merging the third file and the fourth file; Wherein, determining the target file similarity between each of the files and other files based on the first similarity and the third similarity comprises: sorting each of the files based on the first similarity and the third similarity to obtain a target file sequence; determining the target file similarity between each of the files and each file included in the other files in sequence based on the first similarity and the third similarity according to the target file sequence; The step of sequentially determining the third similarity between the two files included in the files includes: determining image features of the images included in the two files, and determining the third similarity based on the similarity of the image features.
6. The method according to claim 1, characterized in that Determining a first similarity between each of the images and a predetermined archive includes: performing a first clustering process on each of the images and the images included in the archive to obtain a first clustering result, and determining the first similarity based on the first clustering result; Determining the second similarity between any two images in the plurality of images includes: performing a second clustering process on any two images in the images to obtain a second clustering result, and determining the second similarity based on the second clustering result.
7. A device for determining the file to which an image belongs, characterized in that: include: An acquisition module, used for acquiring a plurality of images to be archived, wherein each of the images includes a target object; A first determination module, used for determining a first similarity between each of the images and a predetermined profile; A second determination module, used to determine a second similarity between any two images in the plurality of images; a third determination module, configured to determine a target similarity between each of the images and each of the archives included in the archive based on the first similarity and the second similarity; A fourth determination module, configured to determine the target profile to which each of the images belongs based on the target similarity; The third determination module determines the target similarity between each image and each file included in the file based on the first similarity and the second similarity in the following manner: sorting each image based on the first similarity and the second similarity to obtain a target order; and determining the target similarity between each image and each file included in the file in sequence based on the first similarity and the second similarity according to the target order; The fourth determination module determines the target archive to which each of the images belongs from the archives based on the target similarity in the following manner: determining whether there is a first archive satisfying a first predetermined condition in the archives based on the target similarity; if the first archive exists, determining the first archive as the target archive; if the first archive does not exist, creating a second archive and determining the second archive as the target archive.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 6 when executed by a processor.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Archiving method and device
CN109815370A
Image file merging method and device, electronic equipment and storage medium
CN112131419A