Image storage method and device and storage medium
By generating and comparing the similarity between the feature vectors of the image to be stored and the historical image, the problem that images occupy a large amount of storage space in the computing device is solved, and more efficient storage management and space savings are achieved.
Patent Information
- Application Number
- CN202510063595.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-01-15
AI Technical Summary
The pictures stored in the computing device occupy a large amount of storage space, and it is difficult for users to determine which pictures are similar or the same, which requires caution when deleting them, and will only prompt for deletion when the user actively cleanses them.
By generating the first target feature vector and the second target feature vector of the image to be stored, feature extraction and point extraction are performed using multi-layer convolution and preset algorithms respectively, the similarity between the image to be stored and the historical image is calculated, and prompt information is sent to the user when the similarity exceeds the threshold to decide whether to store the image to be stored.
It effectively improves the efficiency of the image storage process, saves the storage space of computing devices, and reduces the storage of redundant images through similarity comparison.
Smart Images

Figure CN120029539A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology and provides a method, device and storage medium for storing images. Background Art
[0002] At present, a large number of pictures are usually stored in the photo albums or application software of computing devices (such as mobile phones, tablet computers, etc.). When the user terminal chooses to clean up the memory, the user terminal will be prompted whether to delete the similar or identical pictures. However, since the pictures are stored for a long time, the user terminal cannot determine under what circumstances the similar or identical pictures are stored. Therefore, more considerations should be given when deleting them. In addition, only when the user terminal actively cleans up the memory will the user terminal be prompted whether to delete them, otherwise the pictures will continue to occupy storage space in the memory. Summary of the invention
[0003] The embodiments of the present application provide a method, device and storage medium for storing images, which are used to determine whether to store an image after comparing the similarity between an image to be stored and a historical image, thereby saving storage space of a computing device.
[0004] The specific technical solutions provided by this application are as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for storing an image, which is applied to a computing device, and the method includes:
[0006] In response to a picture storage request triggered by a user terminal, a first target feature vector and a second target feature vector are respectively generated based on the image to be stored, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm;
[0007] Determine the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, wherein the first similarity is determined based on the first target feature vector and the first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and the second historical feature vector corresponding to the historical image;
[0008] When the similarity is greater than a preset similarity threshold, a prompt message is sent to the user terminal, and based on the user terminal's reply message to the prompt message, it is determined whether to store the image to be stored in the computing device.
[0009] Optionally, the first target feature vector is generated by:
[0010] Acquire a generation location and creation time of the image to be stored, wherein the generation location represents the application software that generates the image to be stored in the computing device;
[0011] Use multi-layer convolution to extract features from the image to be stored, and obtain a first pre-selected feature vector;
[0012] generating a first target feature vector based on the generation location, the creation time, and the first preselected feature vector;
[0013] The second target feature vector is generated by:
[0014] Use a preset algorithm to extract feature points from the stored image to obtain multiple feature points;
[0015] A second target feature vector is generated based on each feature point.
[0016] Optionally, each first similarity is determined by:
[0017] Using multi-layer convolution to extract features from each historical image pre-stored in the computing device, respectively, to obtain a first pre-selected historical feature vector corresponding to each historical image;
[0018] generating a first historical feature vector based on the storage location, storage time and first preselected historical feature vector of each historical image;
[0019] Calculating the similarities between the first target feature vector and each first historical feature vector using cosine similarity, and determining each obtained similarity as a first similarity;
[0020] Each second similarity is determined by:
[0021] Using a preset algorithm to extract feature points from each historical image pre-stored in the computing device, respectively, to obtain a second historical feature vector corresponding to each historical image;
[0022] The similarities between the second target feature vector and each second historical feature vector are calculated using cosine similarity, and each obtained similarity is determined as a second similarity.
[0023] Optionally, determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity includes:
[0024] For each historical image pre-stored in the computing device, the following operations are performed:
[0025] The first similarity and the second similarity corresponding to the image to be stored and the historical image are calculated, and a result value obtained after the calculation is determined as the similarity between the image to be stored and the historical image.
[0026] Optionally, determining whether to store the image to be stored in the computing device based on the user terminal's reply information to the prompt information includes:
[0027] Receive the user's reply to the prompt message and parse the reply;
[0028] If the reply information indicates that the image to be stored needs to be saved, storing the image to be stored in the computing device;
[0029] If the reply information indicates that the image to be stored does not need to be saved, the image to be stored is not stored in the computing device.
[0030] Optionally, before determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, the method further includes:
[0031] Comparing whether any two historical images pre-stored in the computing device are identical;
[0032] If the comparison result is the same, one of any two historical images is deleted.
[0033] Optionally, the method further comprises:
[0034] When the similarity is not greater than a preset similarity threshold, the image to be stored is stored in the computing device.
[0035] In a second aspect, an embodiment of the present application further provides a device for storing an image, comprising:
[0036] A response unit, configured to respond to a picture storage request triggered by a user terminal, and to generate a first target feature vector and a second target feature vector based on the image to be stored, respectively, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm;
[0037] a determining unit, configured to determine, based on each first similarity and each second similarity, similarities between the image to be stored and each historical image pre-stored in the computing device, wherein the first similarity is determined based on the first target feature vector and the first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and the second historical feature vector corresponding to the historical image;
[0038] The storage unit is used to send a prompt message to the user terminal when the similarity is greater than a preset similarity threshold, and determine whether to store the image to be stored in the computing device based on the user terminal's reply information to the prompt message.
[0039] Optionally, the first target feature vector is generated by:
[0040] Acquire a generation location and creation time of the image to be stored, wherein the generation location represents the application software that generates the image to be stored in the computing device;
[0041] Use multi-layer convolution to extract features from the image to be stored, and obtain a first pre-selected feature vector;
[0042] generating a first target feature vector based on the generation location, the creation time, and the first preselected feature vector;
[0043] The second target feature vector is generated by:
[0044] Use a preset algorithm to extract feature points from the stored image to obtain multiple feature points;
[0045] A second target feature vector is generated based on each feature point.
[0046] Optionally, each first similarity is determined by:
[0047] Using multi-layer convolution to extract features from each historical image pre-stored in the computing device, respectively, to obtain a first pre-selected historical feature vector corresponding to each historical image;
[0048] generating a first historical feature vector based on the storage location, storage time and first preselected historical feature vector of each historical image;
[0049] Calculating the similarities between the first target feature vector and each first historical feature vector using cosine similarity, and determining each obtained similarity as a first similarity;
[0050] Each second similarity is determined by:
[0051] Using a preset algorithm to extract feature points from each historical image pre-stored in the computing device, respectively, to obtain a second historical feature vector corresponding to each historical image;
[0052] The similarities between the second target feature vector and each second historical feature vector are calculated using cosine similarity, and each obtained similarity is determined as a second similarity.
[0053] Optionally, based on each first similarity and each second similarity, the similarity between the image to be stored and each historical image pre-stored in the computing device is determined, and the determining unit is used to:
[0054] For each historical image pre-stored in the computing device, the following operations are performed:
[0055] The first similarity and the second similarity corresponding to the image to be stored and the historical image are calculated, and a result value obtained after the calculation is determined as the similarity between the image to be stored and the historical image.
[0056] Optionally, based on the user's reply information to the prompt information, determining whether to store the image to be stored in the computing device, the storage unit is used to:
[0057] Receive the user's reply to the prompt message and parse the reply;
[0058] If the reply information indicates that the image to be stored needs to be saved, storing the image to be stored in the computing device;
[0059] If the reply information indicates that the image to be stored does not need to be saved, the image to be stored is not stored in the computing device.
[0060] Optionally, before determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, the method further includes:
[0061] Comparing whether any two historical images pre-stored in the computing device are identical;
[0062] If the comparison result is the same, one of any two historical images is deleted.
[0063] Optionally, it also includes:
[0064] When the similarity is not greater than a preset similarity threshold, the image to be stored is stored in the computing device.
[0065] According to a third aspect, a computing device includes:
[0066] A memory for storing executable instructions;
[0067] A processor is used to read and execute executable instructions stored in a memory to implement any method as described in the first aspect.
[0068] In a fourth aspect, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor, the processor is enabled to execute any method described in the first aspect.
[0069] The beneficial effects of this application are as follows:
[0070] In summary, in an embodiment of the present application, a method, device and storage medium for storing an image are provided. The method is applied to a computing device, including: in response to a picture storage request triggered by a user terminal, generating a first target feature vector and a second target feature vector based on the image to be stored, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm, and determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, wherein the first similarity is determined based on the first target feature vector and the first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and the second historical feature vector corresponding to the historical image, when the similarity is greater than a preset similarity threshold, sending a prompt message to the user terminal, and determining whether to store the image to be stored in the computing device based on the user terminal's reply information to the prompt message. The above-mentioned solution of determining whether to store the image to be stored in the computing device after comparing the similarity with the historical image effectively improves the efficiency of the picture storage process and saves the storage space of the computing device.
[0071] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0073] Figure 1 A schematic diagram of a system architecture for storing images in an embodiment of the present application;
[0074] Figure 2 A schematic diagram of a process of storing an image in an embodiment of the present application;
[0075] Figure 3 A schematic diagram of a process for determining whether to store an image to be stored in a computing device based on a user's reply information to a prompt information in an embodiment of the present application;
[0076] Figure 4 A schematic diagram of a flow chart of another method for storing images in an embodiment of the present application;
[0077] Figure 5 A schematic diagram of the logical architecture of a device for storing images in an embodiment of the present application;
[0078] Figure 6 Schematic diagram of the physical architecture of a computing device in an embodiment of the present application. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.
[0080] 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. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented using sequences other than those illustrated or described herein.
[0081] The preferred implementation modes of the present application are described in detail below with reference to the accompanying drawings.
[0082] See also Figure 1 As shown, in the embodiment of the present application, the system includes at least one user terminal and a computing device. Figure 1 In the embodiment, the computing device can be any device such as a mobile phone, a tablet computer, a computer, etc. Usually, multiple application software (photo albums or other communication software, etc.) are installed in the computing device, and a large number of historical images are stored in each application software. In the embodiment of the present application, a method for storing images is implemented mainly on the computing device side, which is described in detail below.
[0083] See also Figure 2 As shown, in an embodiment of the present application, a specific process of a method for storing an image is as follows:
[0084] Step 201: In response to a picture storage request triggered by a user terminal, a first target feature vector and a second target feature vector are generated based on the image to be stored, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm.
[0085] During the process of the user using the computing device, for example, when the user uses the camera of the computing device to take a picture, when the user downloads a picture in an application software of the computing device, or when the user uses an instant messaging application software of the computing device to obtain a picture, a picture storage request is triggered. The picture storage request is a request for whether the image to be stored obtained by taking pictures, downloading, communication transmission, etc. needs to be saved on the computing device.
[0086] After responding to the above image storage request, the computing device will parse the above image storage request, and then generate a first target feature vector and a second target feature vector according to the image to be stored. Here, the generation process of the first target feature vector and the second target feature vector is first introduced.
[0087] First, the first target feature vector is generated by:
[0088] (1) Obtaining a generation location and creation time of the image to be stored, wherein the generation location represents the application software that generates the image to be stored in the computing device.
[0089] Considering that the application software where the image is stored is uncertain, in the embodiment of the present application, in order to comprehensively and uniformly process the images in the computing device, the generation location a where the image to be stored is located is first obtained. The generation location a can be a specific storage path. For example, the generation location a is specifically the album where the image to be stored is stored after being generated by taking a photo, the application software stored after the image to be stored is obtained by downloading in a chat message, etc. It should be supplemented that the above generation location a can also be a storage location represented by a coding method, that is, in order to mark each application software, different codes can be used in advance to mark each application software. Accordingly, the above generation location a can be any one of the above-mentioned marked codes.
[0090] In order to describe the image to be stored more accurately, during the implementation, after obtaining the generation location of the image to be stored, the creation time t of the image to be stored is further obtained. For example, the photo shooting moment in the above method of generating the image to be stored by taking a photo, the downloading moment in the above method of obtaining the image to be stored by downloading in a chat message, etc.
[0091] (2) Use multi-layer convolution to extract features of the image to be stored and obtain the first pre-selected feature vector.
[0092] In order to avoid the overfitting phenomenon caused by the concentration of image features in too small an area due to the use of a deep convolutional neural network (usually including more than 3 convolutional layers and other layers), in the embodiment of the present application, only multiple layers of convolution are used to extract features of the image to be stored, and other layers in the neural network are not used for processing.
[0093] Preferably, the above-mentioned multi-layer convolution is usually three layers. During the implementation process, multi-layer convolution is used to extract features of the image to be stored, and multiple features obtained after extraction are generated into vectors, that is, a first pre-selected feature vector b is generated according to the image to be stored.
[0094] (3) Generate a first target feature vector based on the generation position, the creation time and the first pre-selected feature vector.
[0095] During implementation, after obtaining the first preselected feature vector b, the first target feature vector is generated in combination with the above-mentioned generation position a and creation time t, that is, the first target feature vector k1 = (a, t, b).
[0096] Secondly, the second target feature vector is generated by:
[0097] 1) Use a preset algorithm to extract feature points from the stored image to obtain multiple feature points.
[0098] In order to accurately extract the features of the image to be stored, while using multi-layer convolution to extract features of the image to be stored, in an embodiment of the present application, a preset algorithm (for example, the SIFT algorithm) is also used to extract feature points of the image to be stored, that is, to convert the image to be stored into multiple feature points.
[0099] 2) Generate a second target feature vector based on each feature point.
[0100] During the implementation process, after obtaining a plurality of feature points, a second target feature vector p1 is further generated according to each feature point.
[0101] Step 202: Determine the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, wherein the first similarity is determined based on the first target feature vector and the first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and the second historical feature vector corresponding to the historical image.
[0102] It should be explained first that before determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, the method further includes:
[0103] [1] Compare any two historical images that have been pre-stored in a computing device to see if they are the same.
[0104] Considering that a large number of historical images have been stored in the computing device, and the above historical images may be stored in any application software in the computing device, in order to reduce the amount of calculation, before determining the similarity between the image to be stored and the historical image, the historical images pre-stored in the computing device must be screened to achieve the purpose of retaining only different historical images in the computing device.
[0105] During the specific implementation process, the stored historical images are first obtained from each application software of the computing device, and then any two historical images among all the above historical images are compared to see if they are the same, that is, any two historical images are compared as a group to see if there are identical historical images.
[0106] [2] If the comparison result is the same, one of the two historical images is deleted.
[0107] During the implementation process, if any two historical images are found to be the same after comparison, one of the two historical images is deleted, that is, only one historical image is retained, thereby achieving the purpose of deleting duplicate historical images. After comparing each historical image, the purpose of ensuring that each historical image stored in the computing device is different can be achieved.
[0108] After determining that each of the historical images stored in the computing device is different, a first historical feature vector and a second historical feature vector are further generated according to the historical image, and each first similarity is determined based on the first similarity in the following manner:
[0109] 1. Use multi-layer convolution to extract features from each historical image that has been pre-stored in the computing device to obtain a first pre-selected historical feature vector corresponding to each historical image.
[0110] In the embodiment of the present application, in order to better compare the historical image with the image to be stored, the first historical feature vector is generated from each historical image in the same manner as the first target feature vector is generated for the image to be stored.
[0111] During the implementation process, in order to avoid the overfitting phenomenon caused by the concentration of image features in too small an area due to the use of deep convolutional neural networks (usually including more than 3 convolutional layers and other layers), only multiple layers of convolution are used to extract features from each historical image pre-stored in the computing device, without using other layers in the neural network for processing.
[0112] Preferably, the above-mentioned multi-layer convolution is usually three layers. During the implementation process, for each historical image, multi-layer convolution is used to extract features of the historical image, and a vector is generated using the multiple features obtained after extraction, that is, the first pre-selected historical feature vector B corresponding to the historical image is generated based on the historical image.
[0113] 2. Generate a first historical feature vector based on the storage location, storage time and first pre-selected historical feature vector of each historical image.
[0114] In addition, during the implementation process, it is also necessary to obtain the storage location A of the historical image. For example, the storage location A is the storage path or storage code where the historical image is stored. Also, the storage time T of the historical image is obtained. For example, the storage time T is the time when the historical image is saved to the application software, the time when the historical image is downloaded from a chat message, and so on.
[0115] During implementation, after obtaining the first preselected historical feature vector B, the storage location A and storage time T are combined to generate the first historical feature vector, that is, the first historical feature vector K1 = (A, T, B).
[0116] 3. Calculate the similarities between the first target feature vector and each first historical feature vector using cosine similarity, and determine each obtained similarity as a first similarity.
[0117] During the implementation, after obtaining the first target feature vector k1 of the image to be stored and the first historical feature vector K1 of one of the historical images, the cosine similarity is used to calculate the similarity between the first target feature vector k1 and the first historical feature vector K1. For other historical images in each of the historical images, the same cosine similarity is also used to calculate the similarity between the first target feature vector and the first historical feature vector until the corresponding first similarity is calculated between the image to be stored and each of the historical images.
[0118] And, each second similarity is determined by:
[0119] <1> The preset algorithms are respectively used to extract feature points from each historical image pre-stored in the computing device to obtain a second historical feature vector corresponding to each historical image.
[0120] Similarly, in order to accurately extract the features of the historical images used as comparison objects, while using multi-layer convolution to extract features from the historical images, in an embodiment of the present application, a preset algorithm (for example, the SIFT algorithm) is also used to extract feature points from each historical image that has been stored in the computing device in advance, that is, to convert the historical image into multiple feature points, and then obtain the second historical feature vector P1 corresponding to each historical image based on the multiple feature points.
[0121] <2> The similarities between the second target feature vector and each second historical feature vector are calculated using cosine similarity, and each obtained similarity is determined as a second similarity.
[0122] During the implementation, after obtaining the second target feature vector p1 of the image to be stored and the second historical feature vector P1 of one of the historical images, the similarity between the second target feature vector p1 and the second historical feature vector P1 is calculated using cosine similarity. For other historical images in each of the historical images, the similarity between the second target feature vector p1 and the second historical feature vector P1 is also calculated using the same cosine similarity until the corresponding second similarity is calculated between the image to be stored and each of the historical images.
[0123] It should also be noted that in order to ensure that the first similarity and the second similarity are obtained after comparing the similarity between the image to be stored and the same historical image, the first historical feature vector and the second historical feature vector can be marked with the storage location and storage time of the historical image, that is, the historical image can be uniquely identified based on the storage location and storage time, and then the first historical feature vector and the second historical feature vector of the historical image can be determined.
[0124] After obtaining a plurality of first similarities and a plurality of second similarities respectively, determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity includes:
[0125] For each historical image pre-stored in the computing device, the following operations are performed:
[0126] The first similarity and the second similarity corresponding to the image to be stored and the historical image are calculated, and a result value obtained after the calculation is determined as the similarity between the image to be stored and the historical image.
[0127] Taking into account that there are multiple historical images and only one image to be stored, in order to find out which stored historical image is the same as or very similar to the image to be stored, during the implementation process, the following operations are performed for each historical image: first, a first similarity between the image to be stored and the historical image is obtained, and then a second similarity between the image to be stored and the historical image is obtained, and then the first similarity and the second similarity are calculated. Exemplarily, the above-mentioned operation is an addition operation or a multiplication operation, and the result value obtained after the operation, exemplarily, the sum value after addition or the product value after multiplication is determined as the similarity between the image to be stored and the historical image. The method of using the calculation results of the first similarity and the second similarity to determine the similarity further improves the accuracy of the similarity calculation.
[0128] Step 203: When the similarity is greater than a preset similarity threshold, a prompt message is sent to the user terminal, and based on the user terminal's reply message to the prompt message, it is determined whether to store the image to be stored in the computing device.
[0129] In an embodiment of the present application, in order to effectively save storage space, a picture storage request is triggered on the user side, and after the similarity between the image to be stored and each historical image is calculated, prompt information is generated based on the same or more similar images to be stored, that is, when the similarity is greater than a preset similarity threshold, a prompt information is sent to the user side, and whether to store the image to be stored in the computing device is determined based on the user side's reply information to the prompt information.
[0130] The above prompt information can be a prompt information pop-up window. In one embodiment, the prompt information pop-up window presents the stored identical or highly similar images to be stored. In another embodiment, the prompt information pop-up window presents a comparison photo between the image to be stored and the historical image.
[0131] In a specific implementation process, whether to store the image to be stored in the computing device is determined based on the user's reply information to the prompt information, see Figure 3 As shown, including:
[0132] Step 2031: receiving the reply information of the user terminal to the prompt information, and analyzing the reply information.
[0133] After the computing device sends a prompt message to the user end, the user end can generate a reply message based on the prompt message and return the reply message to the computing device. In this way, after receiving the reply message, the computing device can determine whether to store the above-mentioned image to be stored based on the specific content of the reply message.
[0134] During the implementation process, the computing device first needs to parse the above reply information, that is, to analyze from the reply information whether to save the information of the image to be stored.
[0135] Step 2032: If the reply information indicates that the image to be stored needs to be saved, the image to be stored is stored in the computing device.
[0136] It should be noted that the specific content of the above reply information can be flexibly set according to the pre-settings. For example, the pre-setting information 1 indicates that the image to be stored needs to be saved, and the information 0 indicates that the image to be stored does not need to be saved. When the computing device parses the reply information and the information obtained is 1, it is determined that the image to be stored needs to be saved. In this case, the image to be stored is stored in the computing device. Exemplarily, in the process of storing the image to be stored, the original image of the image to be stored can be directly stored in a designated storage location (for example, any application software, etc.), or the first target feature vector and the second target feature vector corresponding to the image to be stored can be stored in the first vector library and the second vector library, respectively. No specific limitation is made here.
[0137] Step 2033: If the reply information indicates that the image to be stored does not need to be saved, the image to be stored is not stored in the computing device.
[0138] During the implementation process, when it is determined after parsing the above reply information that the image to be stored does not need to be saved, for example, the information 1 is preset to indicate that the image to be stored needs to be saved, and the information 0 is preset to indicate that the image to be stored does not need to be saved. When the computing device parses the reply information and the information obtained is 0, it means that the image to be stored does not need to be saved. In this case, the image to be stored is abandoned.
[0139] In addition, see Figure 4 As shown, the method also includes:
[0140] Step 204: When the similarity is not greater than a preset similarity threshold, the image to be stored is stored in the computing device.
[0141] In order to completely save the image in the computing device, during the implementation process, when it is determined through similarity calculation that the similarity between the image to be stored and the historical image is not greater than the preset similarity threshold, it means that the correlation between the image to be stored and the historical image is small. In this case, the image to be stored is stored in the computing device.
[0142] It should be noted that, in order to facilitate the user end to send a picture storage request again, the image to be stored is compared with the image to be stored as a new historical image for similarity. During the implementation process, the first target feature vector and the second target feature vector corresponding to the image to be stored are usually stored in the process of storing the above-mentioned image to be stored in the computing device, which can effectively save the amount of calculation in the similarity comparison process. It should also be noted that the specific storage location of the above-mentioned image to be stored in the computing device can be flexibly set according to the specific scenario, and no specific limitation is made here.
[0143] Based on the same inventive concept, refer to Figure 5 As shown, an embodiment of the present application provides a device for storing an image, comprising:
[0144] A response unit 501 is used to respond to a picture storage request triggered by a user terminal, and to generate a first target feature vector and a second target feature vector based on the image to be stored, respectively, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm;
[0145] A determining unit 502 is used to determine the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, wherein the first similarity is determined based on the first target feature vector and the first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and the second historical feature vector corresponding to the historical image;
[0146] The storage unit 503 is used to send a prompt message to the user terminal when the similarity is greater than a preset similarity threshold, and determine whether to store the image to be stored in the computing device based on the user terminal's reply information to the prompt message.
[0147] Optionally, the first target feature vector is generated by:
[0148] Acquire a generation location and creation time of the image to be stored, wherein the generation location represents the application software that generates the image to be stored in the computing device;
[0149] Use multi-layer convolution to extract features from the image to be stored, and obtain a first pre-selected feature vector;
[0150] generating a first target feature vector based on the generation location, the creation time, and the first preselected feature vector;
[0151] The second target feature vector is generated by:
[0152] Use a preset algorithm to extract feature points from the stored image to obtain multiple feature points;
[0153] A second target feature vector is generated based on each feature point.
[0154] Optionally, each first similarity is determined by:
[0155] Using multi-layer convolution to extract features from each historical image pre-stored in the computing device, respectively, to obtain a first pre-selected historical feature vector corresponding to each historical image;
[0156] generating a first historical feature vector based on the storage location, storage time and first preselected historical feature vector of each historical image;
[0157] Calculating the similarities between the first target feature vector and each first historical feature vector using cosine similarity, and determining each obtained similarity as a first similarity;
[0158] Each second similarity is determined by:
[0159] Using a preset algorithm to extract feature points from each historical image pre-stored in the computing device, respectively, to obtain a second historical feature vector corresponding to each historical image;
[0160] The similarities between the second target feature vector and each second historical feature vector are calculated using cosine similarity, and each obtained similarity is determined as a second similarity.
[0161] Optionally, based on each first similarity and each second similarity, the similarity between the image to be stored and each historical image pre-stored in the computing device is determined, and the determining unit 502 is used to:
[0162] For each historical image pre-stored in the computing device, the following operations are performed:
[0163] The first similarity and the second similarity corresponding to the image to be stored and the historical image are calculated, and a result value obtained after the calculation is determined as the similarity between the image to be stored and the historical image.
[0164] Optionally, based on the user's reply information to the prompt information, determining whether to store the image to be stored in the computing device, the storage unit 503 is used to:
[0165] Receive the user's reply to the prompt message and parse the reply;
[0166] If the reply information indicates that the image to be stored needs to be saved, storing the image to be stored in the computing device;
[0167] If the reply information indicates that the image to be stored does not need to be saved, the image to be stored is not stored in the computing device.
[0168] Optionally, before determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, the method further includes:
[0169] Comparing whether any two historical images pre-stored in the computing device are identical;
[0170] If the comparison result is the same, one of any two historical images is deleted.
[0171] Optionally, it also includes:
[0172] When the similarity is not greater than a preset similarity threshold, the image to be stored is stored in the computing device.
[0173] Based on the same inventive concept, refer to Figure 6 As shown, an embodiment of the present application provides a computing device, including: a memory 601, used to store executable instructions; a processor 602, used to read and execute the executable instructions stored in the memory, and execute any one of the methods of the first aspect above.
[0174] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor, the processor is enabled to execute the method described in any one of the first aspects above.
[0175] In summary, in an embodiment of the present application, a method, device and storage medium for storing an image are provided. The method is applied to a computing device, including: in response to a picture storage request triggered by a user terminal, generating a first target feature vector and a second target feature vector based on the image to be stored, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm, and determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, wherein the first similarity is determined based on the first target feature vector and the first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and the second historical feature vector corresponding to the historical image, when the similarity is greater than a preset similarity threshold, sending a prompt message to the user terminal, and determining whether to store the image to be stored in the computing device based on the user terminal's reply information to the prompt message. The above-mentioned solution of determining whether to store the image to be stored in the computing device after comparing the similarity with the historical image effectively improves the efficiency of the picture storage process and saves the storage space of the computing device.
[0176] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program product systems. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product system implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0177] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program product systems according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0178] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0180] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for storing an image, characterized in that: Applied to a computing device, the method comprises: In response to a picture storage request triggered by a user terminal, a first target feature vector and a second target feature vector are respectively generated based on the image to be stored, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm; Determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, wherein the first similarity is determined based on the first target feature vector and a first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and a second historical feature vector corresponding to the historical image; When the similarity is greater than a preset similarity threshold, a prompt message is sent to the user terminal, and based on the reply message of the user terminal to the prompt message, it is determined whether to store the image to be stored in the computing device.
2. The method according to claim 1, characterized in that The first target feature vector is generated by: Acquire a generation location and a creation time of the image to be stored, wherein the generation location represents application software in the computing device that generates the image to be stored; Using the multi-layer convolution to extract features from the image to be stored, to obtain a first pre-selected feature vector; generating the first target feature vector based on the generation location, the creation time, and the first preselected feature vector; The second target feature vector is generated by: Using the preset algorithm to extract feature points from the image to be stored to obtain a plurality of feature points; The second target feature vector is generated based on each of the feature points.
3. The method according to claim 1, characterized in that The first similarities are determined in the following manner: Using the multi-layer convolution to extract features from each historical image pre-stored in the computing device, respectively, to obtain a first pre-selected historical feature vector corresponding to each historical image; generating the first historical feature vector based on the storage location, storage time and the first preselected historical feature vector of each of the historical images; Calculating the similarities between the first target feature vector and each of the first historical feature vectors using cosine similarity, and determining each of the obtained similarities as the first similarities; Each of the second similarities is determined by: Using the preset algorithm to extract feature points from each historical image pre-stored in the computing device, respectively, to obtain a second historical feature vector corresponding to each historical image; The similarities between the second target feature vector and each of the second historical feature vectors are calculated using cosine similarity, and each of the obtained similarities is determined as the second similarities.
4. The method according to claim 1, characterized in that The determining, based on each first similarity and each second similarity, the similarity between the image to be stored and each historical image pre-stored in the computing device comprises: For each of the historical images that has been pre-stored in the computing device, the following operations are performed: The first similarity and the second similarity corresponding to the image to be stored and the historical image are calculated, and a result value obtained after the calculation is determined as the similarity between the image to be stored and the historical image.
5. The method according to claim 1, characterized in that The determining whether to store the image to be stored in the computing device based on the reply information of the user terminal to the prompt information includes: Receiving reply information from the user terminal to the prompt information, and parsing the reply information; If the reply information indicates that the image to be stored needs to be saved, storing the image to be stored in the computing device; If the reply information indicates that the image to be stored does not need to be saved, the image to be stored is not stored in the computing device.
6. The method according to claim 1, characterized in that Before determining the similarity between the image to be stored and each historical image pre-stored in the computing device based on each first similarity and each second similarity, the method further includes: Comparing whether any two of the historical images pre-stored in the computing device are identical; If the comparison result is the same, one of any two historical images is deleted.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: When the similarity is not greater than a preset similarity threshold, the image to be stored is stored in the computing device.
8. A device for storing an image, characterized in that: include: A response unit, configured to respond to a picture storage request triggered by a user terminal, and to generate a first target feature vector and a second target feature vector based on the image to be stored, respectively, wherein the picture storage request is generated based on the image to be stored, the first target feature vector is obtained by extracting features of the image to be stored using multi-layer convolution, and the second target feature vector is obtained by extracting feature points of the image to be stored using a preset algorithm; a determining unit, configured to determine, based on each first similarity and each second similarity, similarities between the image to be stored and each historical image pre-stored in the computing device, wherein the first similarity is determined based on the first target feature vector and a first historical feature vector corresponding to the historical image, and the second similarity is determined based on the second target feature vector and a second historical feature vector corresponding to the historical image; The storage unit is used to send a prompt message to the user terminal when the similarity is greater than a preset similarity threshold, and determine whether to store the image to be stored in the computing device based on the user terminal's reply information to the prompt message.
9. A computing device, characterized in that include: A memory for storing executable instructions; A processor, configured to read and execute the executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor, the processor is enabled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Picture duplicate removal method and device and electronic equipment
CN114529741A
Deep learning-based repeated picture detection method and device, equipment and medium
CN116304141A
Image processing method and device, electronic equipment and storage medium
CN117274641A
Image matching method and device, equipment and storage medium
CN117635978A
Vending machine settlement system, vending machine, face authentication server, vending machine settlement method, and program
JP2020087093A