Image storage method and device and electronic equipment
By identifying image types and applying different storage strategies, the problem of excessive storage space in terminal devices is solved, achieving both storage space optimization and image quality assurance.
Patent Information
- Application Number
- CN202511509481.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-01-16
AI Technical Summary
Images occupy too much storage space on terminal devices, especially less important images.
By performing content recognition on the images to be stored, their types are determined, and appropriate storage strategies are selected based on the image type, including strategies with different compression ratios such as text enhancement, visual lossless compression, and preservation of original image data.
This reduces the storage space required for non-critical images, alleviating the problem of excessive image space usage on terminal devices, while ensuring the quality of important images.
Smart Images

Figure CN121353058A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technology, specifically to an image storage method, apparatus, and electronic device. Background Technology
[0002] Currently, most user devices use a uniform compression algorithm to compress photos taken with them. To ensure the quality of images stored on these devices, photos typically require a significant amount of storage space. This results in even less important images needing substantial storage, leading to an excessive amount of storage space required for images on the device. Summary of the Invention
[0003] This application provides an image storage method, apparatus, and electronic device that can solve the problem in related technologies where images in terminal devices require excessive storage space.
[0004] Firstly, an image storage method is provided, including:
[0005] Get the image to be stored;
[0006] The content in the image to be stored is identified to obtain the image type of the image to be stored, wherein the image type is one of at least two candidate types;
[0007] The image to be stored is stored based on a first storage strategy, wherein the at least two candidate types correspond one-to-one with at least two storage strategies, the first storage strategy is the storage strategy that corresponds to the image type among the at least two storage strategies, and the image compression ratios corresponding to different storage strategies are different among the at least two storage strategies.
[0008] Secondly, an image storage device is provided, comprising:
[0009] The acquisition module is used to acquire images to be stored.
[0010] The recognition module is used to recognize the content in the image to be stored and obtain the image type of the image to be stored, wherein the image type is one of at least two candidate types;
[0011] A storage module is used to store the image to be stored based on a first storage strategy, wherein the at least two candidate types correspond one-to-one with at least two storage strategies, the first storage strategy is the storage strategy corresponding to the image type among the at least two storage strategies, and the image compression ratios corresponding to different storage strategies are different among the at least two storage strategies.
[0012] Thirdly, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a program or instructions executable on the processor, the program or instructions, when executed by the processor, perform the steps of the method described in the first aspect.
[0013] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0014] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the steps of the method described in the first aspect.
[0015] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the method described in the first aspect.
[0016] In this embodiment, during the storage of the image to be stored, the image type of the image to be stored is obtained by identifying the content in the image to be stored, and the image to be stored is stored based on the storage strategy corresponding to the image type. Since different image types correspond to different storage strategies, and different storage strategies correspond to different image compression ratios, storing the image to be stored according to the storage strategy corresponding to the image type of the image to be stored helps to match the storage space occupied by the image after storage with the image type of the image to be stored, thereby reducing the storage space required for non-important images, and thus helping to alleviate the problem of excessive storage space required for images in terminal devices. Attached Figure Description
[0017] Figure 1 This is a schematic flowchart of an image storage method provided in an embodiment of this application;
[0018] Figure 2 This is a schematic diagram of an electronic device acquiring raw image data in an embodiment of this application;
[0019] Figure 3 This is a schematic diagram of the real-time background analysis process in an embodiment of this application;
[0020] Figure 4 This is a schematic diagram of the background storage execution process in an embodiment of this application;
[0021] Figure 5 This is a schematic diagram of the category confirmation interface;
[0022] Figure 6 This is a schematic diagram of the intelligent photo storage system architecture in the embodiments of this application;
[0023] Figure 7 This is a schematic diagram of the structure of an image storage device provided in an embodiment of this application;
[0024] Figure 8 Schematic diagrams of the structure of electronic devices provided for some embodiments of this application;
[0025] Figure 9 A schematic diagram of the hardware structure of an electronic device provided for some embodiments of this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0027] The terms "first," "second," etc., used in this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, the first object can be one or more. Furthermore, "or" in this application indicates at least one of the connected objects. For example, the scope of protection for "A or B" covers at least three scenarios: Scenario 1: including A but not B; Scenario 2: including B but not A; Scenario 3: including both A and B. In addition, the terms "A and / or B," "at least one of A and B," and "at least one of A or B" also cover at least the above three scenarios. The character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0028] The image storage method, apparatus, and electronic device provided in this application will be described in detail below with reference to the accompanying drawings and through some embodiments and application scenarios.
[0029] Please see Figure 1 , Figure 1 This is a flowchart illustrating an image storage method provided in an embodiment of this application. The image storage method includes the following steps:
[0030] Step 101: Obtain the image to be stored.
[0031] The image storage method described herein can be applied to various types of electronic devices, such as mobile phones, tablets, and smartwatches. Accordingly, the image to be stored can be an image acquired by the electronic device through various means; for example, the image to be stored can be a picture taken by the electronic device, or a picture received by the electronic device, or a picture downloaded by the electronic device.
[0032] For ease of understanding, this application embodiment uses an image taken by an electronic device as an example to further explain the image storage method. The process of acquiring the image to be stored may include the following steps: Please refer to... Figure 2 The electronic device uses an image sensor to sense optical signals to acquire raw image data. The image sensor transmits the raw image data to an image signal processor (ISP). The ISP performs basic noise reduction and color correction on the raw image data and outputs an uncompressed preview image stream. In some embodiments of this application, the preview image stream has a resolution greater than 720P and a frame rate of 30fps. The image to be stored can be any frame from the preview image stream. It is understood that each frame from the preview image stream can be stored according to the image storage method described in the embodiments of this application.
[0033] Step 102: Identify the content in the image to be stored to obtain the image type of the image to be stored, wherein the image type is one of at least two candidate types.
[0034] The above-mentioned identification of the content in the image to be stored can be based on various image recognition algorithms or models.
[0035] The specific types of the above-mentioned at least two candidate types can be set as needed. For example, in some embodiments of this application, the at least two candidate types may include: document type and image type. As another example, in some embodiments of this application, the at least two candidate types may include: document type, daily type, and creative type. Specifically, when the image to be stored is a functional content image such as a document image, whiteboard image, or ticket image, the image type can be document type. When the image to be stored is a picture taken casually by the user in daily life, the image type can be daily type. When the image to be stored is important content creatively captured by the user, for example, when the content of the image to be stored includes portrait images, landscape images, and works of art, the image type is determined to be creative type.
[0036] Step 103: Store the image to be stored based on the first storage strategy, wherein the at least two candidate types correspond one-to-one with the at least two storage strategies, the first storage strategy is the storage strategy that corresponds to the image type among the at least two storage strategies, and the image compression ratios corresponding to different storage strategies are different among the at least two storage strategies.
[0037] The image compression ratio mentioned above can be equal to the storage space occupied by the image before compression divided by the actual storage space occupied by the image after compression. A higher compression ratio results in a smaller storage space occupied by the compressed image. In some embodiments of this application, the importance of various image types can be preset, and the corresponding compression ratio can be determined based on the importance. For example, the compression ratio can be set to be smaller for image types with higher importance.
[0038] The aforementioned storage strategy may include a strategy for compressing images during storage, and this image compression strategy may include a compression ratio.
[0039] In this embodiment, during the storage of the image to be stored, the image type of the image to be stored is obtained by identifying the content in the image to be stored, and the image to be stored is stored based on the storage strategy corresponding to the image type. Since different image types correspond to different storage strategies, and different storage strategies correspond to different image compression ratios, storing the image to be stored according to the storage strategy corresponding to the image type of the image to be stored helps to match the storage space occupied by the image after storage with the image type of the image to be stored, thereby reducing the storage space required for non-important images, and thus helping to alleviate the problem of excessive storage space required for images in terminal devices.
[0040] Optionally, the at least two candidate types include at least two of the following: document type, daily type, and creative type.
[0041] In this embodiment, by including at least two of the following: document type, daily type, and creative type, the storage effect of various types of images is improved.
[0042] Optionally, the storage strategy corresponding to the document class includes a text-enhanced compression storage strategy;
[0043] The storage strategy corresponding to the daily category includes a visual lossless compression storage strategy, wherein the image compression ratio corresponding to the text-enhanced compression storage strategy is higher than the image compression ratio corresponding to the visual lossless compression storage strategy.
[0044] The storage strategies for the creation category include: a strategy for preserving the original image data, or an oversampling storage strategy.
[0045] For document-type images, which are functional content, various text-enhanced compression methods can be used during storage to maintain the minimum storage format for OCR recognition. Text-enhanced compression primarily refers to techniques that improve text compression efficiency through algorithmic optimization, focusing on reducing data redundancy and ensuring the integrity of the restored information. Common methods include lossy and lossless compression. Lossless compression, such as RLE and Huffman coding, mainly achieves this by eliminating redundant characters and optimizing storage structure, completely restoring the original data. It is suitable for scenarios with high accuracy requirements, such as code and documents. Lossy compression, such as JPEG, mainly sacrifices some data precision for a higher compression ratio, making it suitable for multimedia content.
[0046] For everyday images, lossless compression can be used during storage, such as WebP / HEIF format with adaptive quantization, to ensure visual losslessness while reducing the space required for storage.
[0047] For creative images, to ensure visual quality, the storage process can use either preserving the original image (RAW) data or oversampled JPEG, and the user can choose the method that best suits their needs.
[0048] In some embodiments of this application, a storage parameter scheme can be formulated, wherein the storage parameter scheme includes at least two of the above-mentioned storage strategies. Based on the determination result, the decision engine calls the corresponding storage parameter combination from a predefined "dynamic parameter matrix" and issues the instruction to the storage execution unit. The "dynamic parameter matrix" can serve as the above-mentioned storage parameter scheme, and the storage parameter combination can include not only the image compression ratio but also resolution, format, etc. Please refer to Table 1, which provides a dynamic parameter matrix for some embodiments of this application:
[0049] Table 1:
[0050]
[0051] The electronic device backend can use the strategy decision engine to call the dynamic parameter matrix in Table 1, thereby generating a storage plan and storing images of the corresponding image types.
[0052] During the storage process based on the dynamic parameter matrix in Table 1, if the image type to be stored is a document, a high compression ratio is used, and dedicated post-processing compensation is activated to ensure clear and readable text. If the image type to be stored is a daily-use image, a balanced setting is used to significantly save space while maintaining considerable image quality. If the image type to be stored is a creative image, it is stored at the highest quality, or even in a lossless format, to preserve all original details. Please refer to [link / reference]. Figure 4 When the image type to be stored is creative, the landscape photo can be saved in RAW+Jepg format according to the creative category based on the pre-classification and dynamic parameter engine.
[0053] In some embodiments of this application, complete GPS, aperture, and other EXIF information can also be preserved for creative image processing.
[0054] In this embodiment, the storage strategy corresponding to the document class includes a text-enhanced compression storage strategy; the storage strategy corresponding to the daily class includes a visually lossless compression storage strategy, wherein the image compression ratio corresponding to the text-enhanced compression storage strategy is higher than the image compression ratio corresponding to the visually lossless compression storage strategy; the storage strategy for the creative class includes: a strategy for preserving the original image data storage, or an oversampling storage strategy. This is beneficial to improving the storage effect for various types of images.
[0055] Optionally, the step of recognizing the content in the image to be stored to obtain the image type of the image to be stored includes:
[0056] The content in the image to be stored is identified to obtain the image type of the image to be stored and the confidence level corresponding to the image type;
[0057] The storage of the image to be stored based on the first storage strategy includes:
[0058] If the confidence level is greater than or equal to the first threshold, the image to be stored is stored based on the first storage strategy.
[0059] In the process of identifying the image to be stored, the confidence level of the image to be stored belonging to each candidate type can be output, and the candidate type with the highest confidence level is determined as the image type of the image to be stored. At the same time, the image type of the image to be stored and the confidence level corresponding to the image type are output, wherein the confidence level corresponding to the image type is used to represent the probability that the image to be stored belongs to that image type.
[0060] The value of the first threshold can be set as needed. For example, in some embodiments of this application, the value of the first threshold is 60%. In other embodiments of this application, the value of the first threshold is 70%.
[0061] In this embodiment, when the confidence level is greater than or equal to the first threshold, it indicates that the probability of the image to be stored belonging to the image type is high. At this time, the image to be stored can be directly stored based on the first storage strategy, that is, the user does not need to manually confirm the image type, which helps to simplify the storage process.
[0062] Optionally, after identifying the content in the image to be stored and obtaining the image type and the confidence level corresponding to the image type, the method further includes:
[0063] If the confidence level is less than the first threshold, a classification confirmation interface is displayed, wherein the classification confirmation interface includes the at least two candidate types, and the candidate type indicated by the image type in the classification confirmation interface is selected.
[0064] Upon receiving a user's first input regarding the first candidate type in the classification confirmation interface, the image to be stored is stored based on a second storage strategy, wherein the first candidate type is any one of the at least two candidate types, and the second storage strategy is the storage strategy corresponding to the first candidate type among the at least two storage strategies.
[0065] Specifically, if the confidence level is less than the first threshold, it indicates a low probability that the image to be stored belongs to that image type. In this case, the accuracy of the image classification is low. To further improve the accuracy of the classification results, a user confirmation step can be added. For example, please refer to... Figure 5 If the confidence level is less than the first threshold, a classification confirmation interface can be displayed. This interface may include at least two candidate types, each followed by a selectable rectangle. Initially, the rectangle corresponding to the candidate type indicated by the image type is selected to prompt the user about the image type in the classification result. For example, please refer to... Figure 5The candidate types in the category confirmation interface include the following three categories: document type, daily type, and creative type. If the image type obtained based on the above step "identifying the content in the image to be stored to obtain the image type of the image to be stored" is "creative type", then "creative type" is selected in the category confirmation interface at the same time as the interface is displayed. Users can select other candidate types in the category confirmation interface, or they can select the image type in the category confirmation interface. The first input is the user's selection input for a certain candidate type in the category confirmation interface, thereby realizing the process of users manually confirming the image type.
[0066] Please see further. Figure 5 The category confirmation interface may further include a share control, an edit control, a delete control, and more controls. After making the first input, the user can share the stored image using the share control. Alternatively, the user can edit the image to be stored using the edit control before making the first input. Alternatively, the user can delete the image to be stored using the delete control. Furthermore, the user can select other controls using the more controls to process the image to be stored.
[0067] In this embodiment, when the confidence level is less than the first threshold, a classification confirmation interface is displayed, wherein the classification confirmation interface includes the at least two candidate types and the image type; upon receiving a first input from the user regarding the first candidate type in the classification confirmation interface, the image to be stored is stored based on a second storage strategy, wherein the first candidate type is any one of the at least two candidate types, and the second storage strategy is the storage strategy corresponding to the first candidate type among the at least two storage strategies. This helps to further improve the accuracy of classifying the image to be stored, thereby further improving the storage effect of the image to be stored.
[0068] Optionally, storing the image to be stored based on the first storage strategy includes:
[0069] When the image type is the document type, the image to be stored is compressed based on the first storage strategy to obtain a compressed image.
[0070] The compressed image is compensated based on a post-processing compensation strategy to obtain a processed image, wherein the post-processing compensation strategy includes at least one of sharpening and contrast enhancement.
[0071] The processed image is then stored.
[0072] Specifically, for document-type images, since a high compression ratio is used during storage, the quality of the compressed image can be enhanced to improve the quality of the stored image. In some embodiments of this application, the post-processing compensation process for the compressed image may include the following steps:
[0073] Dynamic threshold binarization can automatically calculate the threshold based on the grayscale distribution, and then perform binarization based on the threshold to obtain a binarized image.
[0074] Targeted sharpening processing is applied to the binarized image to enhance text edges;
[0075] The sharpened image is then subjected to contrast expansion processing to improve the distinction between text and background, thereby obtaining the processed image.
[0076] In this embodiment, when the image type is the document type, the image to be stored is compressed based on the first storage strategy to obtain a compressed image; the compressed image is compensated based on a post-processing compensation strategy to obtain a processed image, wherein the post-processing compensation strategy includes at least one of sharpening and contrast enhancement; the processed image is then stored, which helps to improve the image quality of the stored document type image.
[0077] Optionally, after storing the image to be stored based on the first storage strategy, the method further includes:
[0078] Upon receiving a second input from a user in the album regarding the image to be stored, the image is stored based on a third storage strategy. The second input is an input to modify the image type of the stored image to a second candidate type. The second candidate type is any other candidate type besides the image type among the at least two candidate types. The third storage strategy is the storage strategy among the at least two storage strategies that corresponds to the second candidate type.
[0079] The aforementioned photo album can be the photo album within the camera application of the aforementioned electronic device. It is understood that the images to be stored can be stored in the aforementioned photo album. The stored images are those obtained after compression or other processing of the images to be stored during the storage process.
[0080] The aforementioned second input may include a first sub-input and a second sub-input. The first sub-input can trigger an image type modification interface, which may be similar to the aforementioned category confirmation interface. Users can modify the image type of the stored image based on the second sub-input within this interface. The first sub-input can be various types of touch input, such as a long press or double-tap on the stored image. The second sub-input can be a selection of a second candidate type within the image type modification interface.
[0081] It is understandable that when the image quality corresponding to the second candidate type is lower than that corresponding to the image type, the aforementioned third storage strategy can be a strategy for further compressing the stored image. Correspondingly, when the image quality corresponding to the second candidate type is higher than that corresponding to the image type, the aforementioned third storage strategy can be a strategy such as interpolation to improve image quality.
[0082] In this embodiment, upon receiving a second input from the user regarding the storage image corresponding to the image to be stored in the album, the storage image is stored based on a third storage strategy. This allows the user to easily modify the storage method of the already stored images manually.
[0083] Optionally, the step of recognizing the content in the image to be stored to obtain the image type of the image to be stored includes:
[0084] The content of the image to be stored is identified using an Artificial Intelligence (AI) classifier to determine the image type of the image to be stored.
[0085] Please see Figure 6 In some embodiments of this application, the electronic device may include a real-time analysis module, which may be used to implement the following functions:
[0086] Preview Frame Cache
[0087] Function: Temporarily stores consecutive image frames captured by the camera.
[0088] Technical Implementation:
[0089] Establish a double-buffered queue: the front-end buffer is used for real-time processing, and the back-end preparation area receives new frames. The front-end buffer has a capacity of 3 frames, and the back-end preparation area has a capacity of 5 frames.
[0090] A timestamp synchronization mechanism is used to ensure frame order;
[0091] 2.2 AI Classifier
[0092] Function: Identifies image types, and preview frames are simultaneously sent to two parallel AI analysis paths for real-time analysis.
[0093] Technical Implementation:
[0094] Dual-path parallel analysis architecture:
[0095] ①. Document Analysis Path: The core objective of this path is to quickly determine whether the screen contains a large amount of text content and to calculate the proportion of the text area.
[0096] The implementation process consists of three main steps:
[0097] 1. Edge feature extraction:
[0098] The system first converts the color image to grayscale, then uses edge detection algorithms (such as the optimized Sobel operator) to analyze abrupt changes in image brightness. A typical characteristic of text regions is the presence of numerous dense, regular vertical and horizontal edges. This step generates an "edge intensity map," in which the edges of the text regions exhibit a highlighted response.
[0099] 2. Generation and density calculation of candidate text regions:
[0100] Based on the edge intensity map, the system binarizes the image through adaptive thresholding to separate potential edge pixels. Subsequently, morphological operations (such as dilation) are used to connect adjacent edge pixels into blocks, forming potential "text candidate regions".
[0101] Next, the system calculates the edge density of these candidate regions. Density is defined as the ratio of the total number of edge pixels within a candidate region to the total area of the candidate region. A high-density region means that the region contains a large number of edges per unit area, which closely matches the characteristics of text (dense strokes), thus distinguishing it from complex natural scenes such as leaves and hair.
[0102] 3. Regional positioning and output:
[0103] The system filters and merges all high-density areas to determine the extent and location of all text regions in the image. The final output is a key quantitative metric: text coverage ratio, which is the proportion of the total area of text regions to the entire image area. This ratio is the core basis for determining whether the content is "document-type".
[0104] In short, this approach extracts and quantifies text as a special texture feature through the process of "finding edges -> calculating density -> defining regions".
[0105] ②. Aesthetic Analysis Path: The core objective of this path is to assess whether the user's shooting intention is to create a "good photo," which is achieved by analyzing the compositional regularity and color richness of the image;
[0106] The implementation process is divided into two parallel evaluation dimensions:
[0107] 1. Composition rules analysis:
[0108] The system applies classic principles of photographic composition to evaluate the standardization of the image. It primarily assesses the following two aspects:
[0109] The rule of thirds: The system divides the image into nine equal grids (3x3 grid) using two horizontal and two vertical lines. The algorithm detects whether the visual subject of the image (such as a face or a building) is located near the intersection of these lines. The more the subject's position conforms to the rule of thirds, the higher the composition score.
[0110] Symmetry: The system calculates the mirror similarity between the two sides of the horizontal or vertical midline of the image. Images with high symmetry (such as reflections and buildings) usually receive higher aesthetic scores.
[0111] 2. Color complexity analysis:
[0112] The system converts the image from the RGB color space to the LAB color space, which is more in line with human visual perception. Analysis is then performed in this space.
[0113] Color richness: Evaluated by calculating the entropy value of the color histogram's distribution dispersion. The more uniform the color distribution and the greater the number of colors, the higher the complexity. The dispersion of the distribution can be represented by the entropy value of the color histogram.
[0114] Dominant Color Concentration: This analyzes whether a single dominant color or a few dominant colors exist in the image. Masterful landscape or portrait shots typically have harmonious dominant color tones, while casual snapshots may show a cluttered color palette or lack a prominent dominant color. Combining these metrics, the system calculates a color complexity score. Images with moderate complexity or those that have been carefully balanced score higher.
[0115] Ultimately, the system weights and combines the composition score and color complexity score to arrive at a comprehensive "aesthetic quality" score. A high score indicates that the user is likely intentionally creating art.
[0116] Based on the parallel processing of the above two paths, the results are submitted together to the decision engine, whereby the results include text coverage ratio and aesthetic quality score.
[0117] If the text coverage is very high, for example, more than 30%, then regardless of the aesthetic score, it is strongly inclined to be classified as "document".
[0118] If the aesthetic quality score is high and the text coverage ratio is low, it is classified as "creative". For example, a scoring threshold and a coverage threshold can be preset. When the aesthetic quality score is higher than the scoring threshold and the text coverage ratio is lower than the coverage threshold, the image type of the image to be stored is determined to be creative. The values of the scoring threshold and the coverage threshold can be set as needed. For example, in some embodiments of this application, the value range of the scoring threshold is 0.4 to 0.6 and the value range of the coverage threshold is 0.3 to 0.6.
[0119] If both the aesthetic quality score and text coverage are low, for example, when the aesthetic quality score is lower than the scoring threshold and the text coverage ratio is lower than the coverage threshold, then the image type of the image to be stored is determined to be daily life.
[0120] like Figure 3 As shown, the electronic device's backend processes and analyzes image data in real time, classifying the images, such as... Figure 3 If the image in the image is a landscape photo, the system will categorize it as a creative work.
[0121] In this embodiment, the image type of the image to be stored is obtained by recognizing the content in the image based on an AI classifier, thereby realizing the process of recognizing the type of the image to be stored.
[0122] Optionally, the method further includes:
[0123] Obtain historical operation information, wherein the historical operation information includes operation information of the user manually modifying the image type identified by the AI classifier;
[0124] An updated dataset is generated based on the historical operation information, wherein the updated dataset includes training data, and the training data includes sample images and type labels corresponding to the sample images;
[0125] The AI classifier is updated based on the updated dataset to obtain the updated AI classifier.
[0126] The aforementioned historical operation information may include various operation information regarding the user's manual modification of the image type identified by the AI classifier. For example, it may include the user's manual modification of the image type identified by the AI classifier in the classification confirmation interface, and it may also include the user's manual modification of the image type identified by the AI classifier in the image type modification interface.
[0127] The sample images mentioned above can be the images themselves or the image features of the sample images. The type labels mentioned above can include the image categories output by the AI classifier and the corrected classifications after manual modification by the user.
[0128] In some embodiments of this application, the AI classifier can be incrementally trained at regular intervals, and the incremental training process may include 20% of historical model features to prevent overfitting. For example, in some embodiments of this application, the updated dataset can be generated every week based on the user's operation information over the past week. Then, 20% of the training input from the previous week's training dataset is added to the updated dataset to obtain the updated training dataset. Then, the AI classifier is trained based on the updated training dataset to obtain the updated AI classifier.
[0129] When data transmission is involved in the collection of training data, the data can be anonymized before transmission to protect privacy.
[0130] In some embodiments of this application, each correction made by the user to the classification result of the AI classifier is anonymously recorded by the habit learning module, forming training data. The system periodically uses this new data to incrementally train and fine-tune the AI classifier, thereby making the model increasingly conform to the user's personal shooting habits and intentions, achieving continuous self-optimization, and reducing the number of future misjudgments.
[0131] In this implementation, historical operation information is obtained, including information on how users manually modify the image types identified by the AI classifier; an updated dataset is generated based on the historical operation information; and the AI classifier is updated based on the updated dataset to obtain an updated AI classifier. In this way, the classification results of the AI classifier can be more closely matched with user habits.
[0132] Please see Figure 6 , Figure 6 This is a schematic diagram of an intelligent photo storage system architecture provided in this application embodiment. Electronic devices can implement the various processes of the aforementioned image storage method based on this intelligent photo storage system architecture. The intelligent photo storage system architecture includes: an image acquisition module, a real-time analysis module, a strategy execution module, and a user interaction module.
[0133] The image acquisition module serves as a hardware layer and includes an image sensor. The image sensor is used to acquire raw image data, which can be used as the aforementioned image to be stored.
[0134] The aforementioned real-time analysis module serves as the AI processing layer. This module acquires images to be stored from the image sensor and includes a preview frame buffer, an AI content classification unit, and a pre-classification result feedback unit. The preview frame buffer temporarily stores consecutive frames acquired by the image sensor. The AI content classification unit classifies the content in the images to be stored. During classification, it can perform document feature extraction and aesthetic quality assessment in two separate steps to obtain text coverage ratio and aesthetic quality score. The pre-classification result feedback unit determines the image type of the images to be stored based on the text coverage ratio, aesthetic quality score, and confidence threshold.
[0135] The aforementioned strategy execution module serves as the strategy layer and may include a strategy decision engine, a storage execution unit, and a post-processing compensation unit. The strategy decision engine can invoke a dynamic parameter matrix and generate a storage plan corresponding to the image type output by the pre-classification result feedback unit based on the dynamic parameter matrix. The storage execution unit executes the storage plan, specifically including performing actions such as compression, resolution adjustment, and format conversion according to the storage plan. The post-processing compensation unit performs post-processing on the image output by the storage execution unit, specifically including sharpening, noise reduction, and image enhancement.
[0136] The aforementioned user interaction module serves as the application layer. The user interaction module may include a user correction interface, which can record the user's correction behavior and update the model weights in the AI classifier based on the user's historical operation information.
[0137] The image storage method provided in this application has at least the following beneficial effects:
[0138] Pre-emptive: Analysis is completed before the photo is taken, and decisions are made instantly without the user noticing.
[0139] Parallelism: Two analysis paths work simultaneously, comprehensively considering both the functionality and artistry of the image, resulting in more comprehensive decision-making.
[0140] Adaptability: It not only considers the image content, but also the device status such as the phone's storage space.
[0141] Evolutionary nature: A closed-loop user feedback mechanism is introduced, enabling the system to learn and become smarter the more it is used.
[0142] This process successfully integrates AI recognition, intelligent decision-making, and storage management, ultimately achieving the core objective of "different content, different storage specifications," while balancing the dual needs of saving space and ensuring quality.
[0143] The image storage method provided in this application can be executed by an image storage device. This application uses an image storage device executing the image storage method as an example to illustrate the image storage device provided in this application.
[0144] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an image storage device 700 provided in an embodiment of this application. The image storage device includes:
[0145] Module 701 is used to acquire images to be stored;
[0146] The recognition module 702 is used to recognize the content in the image to be stored and obtain the image type of the image to be stored, wherein the image type is one of at least two candidate types;
[0147] Storage module 703 is used to store the image to be stored based on a first storage strategy, wherein the at least two candidate types correspond one-to-one with at least two storage strategies, the first storage strategy is the storage strategy corresponding to the image type among the at least two storage strategies, and the image compression ratios corresponding to different storage strategies are different among the at least two storage strategies.
[0148] Optionally, the at least two candidate types include at least two of the following: document type, daily type, and creative type.
[0149] Optionally, the storage strategy corresponding to the document class includes a text-enhanced compression storage strategy;
[0150] The storage strategy corresponding to the daily category includes a visual lossless compression storage strategy, wherein the image compression ratio corresponding to the text-enhanced compression storage strategy is higher than the image compression ratio corresponding to the visual lossless compression storage strategy.
[0151] The storage strategies for the creation category include: a strategy for preserving the original image data, or an oversampling storage strategy.
[0152] Optionally, the recognition module 702 is specifically used to recognize the content in the image to be stored, and obtain the image type of the image to be stored and the confidence level corresponding to the image type;
[0153] The storage module 703 is specifically used to store the image to be stored based on a first storage strategy when the confidence level is greater than or equal to a first threshold.
[0154] Optionally, the device further includes:
[0155] The display module is used to display a classification confirmation interface when the confidence level is less than the first threshold, wherein the classification confirmation interface includes the at least two candidate types, and the candidate type indicated by the image type in the classification confirmation interface is selected.
[0156] The storage module 703 is further configured to store the image to be stored based on a second storage strategy when receiving a first input from the user on the first candidate type in the classification confirmation interface, wherein the first candidate type is any one of the at least two candidate types, and the second storage strategy is the storage strategy corresponding to the first candidate type among the at least two storage strategies.
[0157] Optionally, the storage module 703 includes:
[0158] The compression submodule is used to compress the image to be stored based on the first storage strategy when the image type is the document type, so as to obtain a compressed image;
[0159] The compensation submodule is used to compensate the compressed image based on a post-processing compensation strategy to obtain a processed image, wherein the post-processing compensation strategy includes at least one of sharpening and contrast enhancement.
[0160] The storage submodule is used to store the processed images.
[0161] Optionally, the storage module 703 is further configured to store the image based on a third storage strategy when receiving a second input from the user in the album for the image to be stored, wherein the second input is an input to modify the image type of the stored image to a second candidate type, the second candidate type is a candidate type other than the image type among the at least two candidate types, and the third storage strategy is a storage strategy corresponding to the second candidate type among the at least two storage strategies.
[0162] Optionally, the recognition module 702 is specifically used to recognize the content in the image to be stored based on an AI classifier to obtain the image type of the image to be stored.
[0163] Optionally, the acquisition module 701 is further configured to acquire historical operation information, wherein the historical operation information includes operation information of the user manually modifying the image type identified by the AI classifier;
[0164] The device further includes:
[0165] A generation module is used to generate an updated dataset based on the historical operation information, wherein the updated dataset includes training data, and the training data includes sample images and type labels corresponding to the sample images;
[0166] The update module is used to update the AI classifier based on the updated dataset to obtain the updated AI classifier.
[0167] In this embodiment, during the storage of the image to be stored, the image type of the image to be stored is obtained by identifying the content in the image to be stored, and the image to be stored is stored based on the storage strategy corresponding to the image type. Since different image types correspond to different storage strategies, and different storage strategies correspond to different image compression ratios, storing the image to be stored according to the storage strategy corresponding to the image type of the image to be stored helps to match the storage space occupied by the image after storage with the image type of the image to be stored, thereby reducing the storage space required for non-important images, and thus helping to alleviate the problem of excessive storage space required for images in terminal devices.
[0168] The image storage device 700 in this embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This embodiment does not specifically limit the specific type of device.
[0169] The image storage device 700 in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit its use.
[0170] The image storage device 700 provided in this application embodiment can achieve... Figure 1 The various processes implemented in the method embodiments achieve the same technical effect, and will not be described again here to avoid repetition.
[0171] In some embodiments, such as Figure 8 As shown, this application embodiment also provides an electronic device 800, including a processor 801, a memory 802, and a program or instructions stored in the memory 802 and executable on the processor 801. When the program or instructions are executed by the processor 801, they implement the various processes of the above-described image storage method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0172] Figure 9 A schematic diagram of the hardware structure of an electronic device according to an embodiment of this application.
[0173] The electronic device 900 includes, but is not limited to, components such as: radio frequency unit 901, network module 902, audio output unit 903, input unit 904, sensor 905, display unit 906, user input unit 907, interface unit 908, memory 909, and processor 910.
[0174] The processor 910 is used to acquire the image to be stored.
[0175] The processor 910 is used to identify the content in the image to be stored and obtain the image type of the image to be stored, wherein the image type is one of at least two candidate types;
[0176] The processor 910 is used to store the image to be stored based on a first storage strategy, wherein the at least two candidate types correspond one-to-one with at least two storage strategies, the first storage strategy is the storage strategy corresponding to the image type among the at least two storage strategies, and the image compression ratios corresponding to different storage strategies are different among the at least two storage strategies.
[0177] Optionally, the at least two candidate types include at least two of the following: document type, daily type, and creative type.
[0178] Optionally, the storage strategy corresponding to the document class includes a text-enhanced compression storage strategy;
[0179] The storage strategy corresponding to the daily category includes a visual lossless compression storage strategy, wherein the image compression ratio corresponding to the text-enhanced compression storage strategy is higher than the image compression ratio corresponding to the visual lossless compression storage strategy.
[0180] The storage strategies for the creation category include: a strategy for preserving the original image data, or an oversampling storage strategy.
[0181] Optionally, the processor 910 is configured to identify the content in the image to be stored, and obtain the image type of the image to be stored and the confidence level corresponding to the image type;
[0182] The processor 910 is used to store the image to be stored based on the first storage strategy, including:
[0183] The processor 910 is configured to store the image to be stored based on a first storage strategy when the confidence level is greater than or equal to a first threshold.
[0184] Optionally, the display unit 906 is configured to display a classification confirmation interface when the confidence level is less than the first threshold, wherein the classification confirmation interface includes the at least two candidate types, and the candidate type indicated by the image type in the classification confirmation interface is selected.
[0185] The processor 910 is configured to store the image to be stored based on a second storage strategy when it receives a first input from a user on a first candidate type in the classification confirmation interface, wherein the first candidate type is any one of the at least two candidate types, and the second storage strategy is the storage strategy corresponding to the first candidate type among the at least two storage strategies.
[0186] Optionally, the processor 910 is configured to compress the image to be stored based on the first storage strategy when the image type is the document type, to obtain a compressed image;
[0187] The processor 910 is used to compensate the compressed image based on a post-processing compensation strategy to obtain a processed image, wherein the post-processing compensation strategy includes at least one of sharpening and contrast enhancement.
[0188] The processor 910 is used to store the processed image.
[0189] Optionally, the processor 910 is configured to store the image based on a third storage strategy when it receives a second input from a user in the album for the image to be stored, wherein the second input is an input to modify the image type of the stored image to a second candidate type, the second candidate type is a candidate type other than the image type among the at least two candidate types, and the third storage strategy is a storage strategy corresponding to the second candidate type among the at least two storage strategies.
[0190] Optionally, the processor 910 is configured to identify the content in the image to be stored based on an AI classifier to obtain the image type of the image to be stored.
[0191] Optionally, the processor 910 is configured to acquire historical operation information, wherein the historical operation information includes operation information on the user manually modifying the image type identified by the AI classifier;
[0192] The processor 910 is configured to generate an updated dataset based on the historical operation information, wherein the updated dataset includes training data, and the training data includes sample images and type labels corresponding to the sample images;
[0193] The processor 910 is used to update the AI classifier based on the updated dataset to obtain the updated AI classifier.
[0194] Those skilled in the art will understand that the electronic device 900 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 910 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 9 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0195] It should be understood that, in this embodiment, the input unit 904 may include a graphics processing unit (GPU) 9041 and a microphone 9042. The GPU 9041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 906 may include a display panel 9061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 907 includes a touch panel 9071 and other input devices 9072. The touch panel 9071 is also called a touch screen. The touch panel 9071 may include a touch detection device and a touch controller. Other input devices 9072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0196] The memory 909 can be used to store software programs and various data. The memory 909 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 909 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 909 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0197] Processor 910 may include one or more processing units; optionally, processor 910 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 910.
[0198] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image storage method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0199] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0200] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image storage method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0201] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0202] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0203] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0204] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A picture storage method characterized by comprising: The method comprises: acquiring a picture to be stored; identifying content in the picture to be stored to obtain a picture type of the picture to be stored, wherein the picture type is one of at least two candidate types; storing the picture to be stored based on a first storage strategy, wherein the at least two candidate types correspond to at least two storage strategies one by one, the first storage strategy is a storage strategy corresponding to the picture type among the at least two storage strategies, and different storage strategies among the at least two storage strategies correspond to different picture compression ratios.
2. The method of claim 1, wherein, The at least two candidate types include at least two of the following: a document type, a daily type, and a creation type.
3. The method of claim 2, wherein, The storage strategy corresponding to the document type includes a text-enhanced compression storage strategy; the storage strategy corresponding to the daily type includes a visual lossless compression storage strategy, wherein the picture compression ratio corresponding to the text-enhanced compression storage strategy is higher than the picture compression ratio corresponding to the visual lossless compression storage strategy; The storage strategy of the creation type includes a reserved original image data storage strategy or a supersampling storage strategy.
4. The method according to any one of claims 1 to 3, characterized in that, The identifying the content in the picture to be stored to obtain the picture type of the picture to be stored comprises: identifying the content in the picture to be stored to obtain the picture type of the picture to be stored and a confidence degree corresponding to the picture type; The storing the picture to be stored based on the first storage strategy comprises: In a case where the confidence degree is greater than or equal to a first threshold, storing the picture to be stored based on the first storage strategy.
5. The method of claim 4, wherein, After the identifying the content in the picture to be stored to obtain the picture type of the picture to be stored and the confidence degree corresponding to the picture type, the method further comprises: In a case where the confidence degree is less than the first threshold, displaying a classification confirmation interface, wherein the classification confirmation interface includes the at least two candidate types, and the candidate type indicated by the picture type is in a selected state in the classification confirmation interface; In a case where a first input of a first candidate type in the classification confirmation interface is received by a user, storing the picture to be stored based on a second storage strategy, wherein the first candidate type is any one of the at least two candidate types, and the second storage strategy is a storage strategy corresponding to the first candidate type among the at least two storage strategies.
6. The method according to claim 2 or 3, characterized in that, The storing the picture to be stored based on the first storage strategy comprises: In a case where the picture type is the document type, compressing the picture to be stored based on the first storage strategy to obtain a compressed picture; compensating the compressed picture based on a post-processing compensation strategy to obtain a processed picture, wherein the post-processing compensation strategy includes at least one of sharpening and contrast enhancement; storing the processed picture.
7. The method of claim 1, wherein, After the storing the picture to be stored based on the first storage strategy, the method further comprises: In a case where a second input of a user in the album on the storage picture corresponding to the to-be-stored picture is received, the storage picture is stored based on a third storage strategy, wherein the second input is an input of modifying a picture type of the storage picture to a second candidate type, the second candidate type is a candidate type other than the picture type in the at least two candidate types, and the third storage strategy is a storage strategy corresponding to the second candidate type in the at least two storage strategies.
8. The method of claim 1, wherein, The identifying the content in the to-be-stored picture to obtain the picture type of the to-be-stored picture comprises: identifying the content in the to-be-stored picture based on an AI classifier to obtain the picture type of the to-be-stored picture; The method further comprises: obtaining historical operation information, wherein the historical operation information comprises operation information of a user manually modifying the picture type identified by the AI classifier; generating an updated data set based on the historical operation information, wherein the updated data set comprises training data, and the training data comprises a sample picture and a type label corresponding to the sample picture; updating the AI classifier based on the updated data set to obtain an updated AI classifier.
9. An image storage apparatus characterized by comprising: comprises: an obtaining module configured to obtain a to-be-stored picture; an identifying module configured to identify content in the to-be-stored picture to obtain a picture type of the to-be-stored picture, wherein the picture type is one of at least two candidate types; a storage module configured to store the to-be-stored picture based on a first storage strategy, wherein the at least two candidate types correspond to at least two storage strategies one by one, the first storage strategy is a storage strategy corresponding to the picture type in the at least two storage strategies, and different storage strategies in the at least two storage strategies correspond to different picture compression ratios.
10. An electronic device, comprising: comprises a processor and a memory, the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the picture storage method according to any one of claims 1-8.