Method and device for compressing image of crash screenshot
By segmenting and two-dimensional entropy division of downtime screenshot images, combining the compression technology of variational autoencoder and convolutional autoencoder, the problems of limited identification accuracy and low encoding efficiency in the prior art are solved, and efficient image compression and information retention are achieved.
Patent Information
- Application Number
- CN202510340506.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-03-21
AI Technical Summary
In the prior art, color clustering has limited recognition accuracy when processing complex backgrounds or images with similar text colors to background colors, and video encoding is inefficient and flexible when selecting prediction modes, and cannot adapt to high-resolution videos or complex scenes.
By segmenting the screenshot image to be compressed, the two-dimensional entropy of the image is calculated, the image is divided into multiple area sub-maps, and each area sub-map is input into a variational autoencoder or a convolutional autoencoder for compression.
It improves recognition accuracy and encoding efficiency, enhances adaptability to high-resolution videos and complex scenes, reduces the amount of image data, while maintaining the main features of the image, and reducing the use of storage space.
Smart Images

Figure CN119854493B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image compression technology, and in particular, to a method and device for compressing crash screenshot images. Background Art
[0002] In related technologies, color clustering can be performed on the text areas of a crash video to obtain multiple layer images of single colors. Then, text connected components in each layer image can be identified to obtain different recognition results, and the corresponding recognized text can be converted into a storage document and saved in the log system of the server. Alternatively, according to the input current frame and reference frame images, different prediction modes can be selected, and the prediction residuals obtained under different prediction modes can be mapped to the non - negative region. Then, according to the distribution characteristics of the residual data, corresponding coding methods can be adopted to obtain the final coding result.
[0003] However, in related technologies, when dealing with images having complex backgrounds or similar text and background colors, the recognition accuracy of color clustering is limited, affecting the accuracy of color clustering. When selecting a prediction mode for video coding, various factors need to be weighed, resulting in low coding efficiency and poor flexibility, and being unable to adapt to processing high - resolution videos or complex scenes, etc., which urgently need improvement. Summary of the Invention
[0004] This application provides a method and device for compressing crash screenshot images to at least solve the problems in related technologies, such as limited recognition accuracy, low coding efficiency, poor flexibility, and inability to adapt to processing high - resolution videos or complex scenes, etc.
[0005] This application provides a method for compressing crash screenshot images, including: segmenting the crash screenshot image to be compressed to obtain at least one sample sub - image; calculating the two - dimensional entropy of the image of the at least one sample sub - image based on the gray - scale values of each position and adjacent positions in the at least one sample sub - image; using the two - dimensional entropy of the image to divide the corresponding sample sub - image into multiple region sub - images, and respectively inputting each region sub - image into the corresponding variational auto - encoder or convolutional auto - encoder to output the compressed crash screenshot image.
[0006] This application also provides a device for compressing crash screenshot images, including: a segmentation module for segmenting the crash screenshot image of the mainboard management controller to be compressed to obtain at least one sample sub - image; a calculation module for calculating the two - dimensional entropy of the image of the at least one sample sub - image based on the gray - scale values of each position and adjacent positions in the at least one sample sub - image; an output module for using the two - dimensional entropy of the image to divide the corresponding sample sub - image into multiple region sub - images, and respectively inputting each region sub - image into the corresponding variational auto - encoder or convolutional auto - encoder to output the compressed crash screenshot image.
[0007] The present application also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any of the above-mentioned crash screenshot image compression methods when executing the computer program.
[0008] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of any of the above-mentioned crash screenshot image compression methods when executed by a processor.
[0009] The present application also provides a computer program product including a computer program, which implements the steps of any of the above-mentioned crash screenshot image compression methods when executed by a processor.
[0010] Through the present application, the to-be-compressed crash screenshot image can be segmented to obtain sample sub-images, and the corresponding sample sub-images can be divided into multiple regional sub-images by using the calculated two-dimensional entropy of the image, so that each regional sub-image is input into the corresponding variational autoencoder or convolutional autoencoder to obtain the compressed crash screenshot image. Therefore, technical problems such as limited recognition accuracy, low coding efficiency, poor flexibility, and inability to adapt to processing high-resolution videos or complex scenes can be solved, and the technical effect of adaptively adjusting the compression strategy according to different regional sub-images, while effectively reducing the amount of image data, maintaining the main features of the image, and reducing the occupancy of storage space by improving the loss functions of the variational autoencoder and convolutional autoencoder, ensuring the quality of the compressed image, and saving precious memory resources can be achieved. Description of the Drawings
[0011] To more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0012] Figure 1 It is a flowchart of a crash screenshot image compression method provided according to an embodiment of the present application;
[0013] Figure 2(a) is a schematic diagram of image segmentation provided according to an embodiment of the present application;
[0014] Figure 2(b) is a schematic diagram of image segmentation provided according to an embodiment of the present application;
[0015] Figure 2(c) is a schematic diagram of image segmentation provided according to an embodiment of the present application;
[0016] Figure 3 It is a schematic block diagram of an autoencoder structure provided according to an embodiment of the present application;
[0017] FIG. 4(a) is a schematic diagram of dynamic threshold adjustment provided according to an embodiment of the present application;
[0018] FIG. 4(b) is another schematic diagram of dynamic threshold adjustment provided according to an embodiment of the present application;
[0019] Figure 5 is a flowchart of the working principle of a method for compressing a crashed screenshot image provided according to an embodiment of the present application;
[0020] Figure 6 is a block diagram of a device for compressing a crashed screenshot image provided according to an embodiment of the present application.
[0021] Reference numerals:
[0022] Among them, 60 - a device for compressing a crashed screenshot image; 100 - a segmentation module, 200 - a first calculation module, 300 - an output module. Detailed implementation manners
[0023] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.
[0024] It should be noted that in the description of the present application, the terms "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0025] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0026] Embodiments of the present application provide a method for compressing a crashed screenshot image. In combination with the execution process of the method for compressing a crashed screenshot image, the method will be described in detail.
[0027] Specifically, Figure 1 is a flowchart of a method for compressing a crashed screenshot image provided according to an embodiment of the present application.
[0028] As Figure 1 shown, the method for compressing a crashed screenshot image includes the following steps:
[0029] In step S101, the downtime screenshot image to be compressed is segmented to obtain at least one sample sub-image.
[0030] It can be understood that in the embodiments of the present application, the downtime screenshot image may but is not limited to include operating system-level screenshot images, virtualization platform screenshot images, BMC (Baseboard Management Controller) downtime screenshot images, etc., and the present application does not make specific limitations.
[0031] Among them, BMC is an embedded microcontroller independent of the main processor, with independent processing capabilities and storage space, and is used to monitor, manage, and control various hardware and software functions of the server.
[0032] In addition, during the use of the server, the server may experience a downtime phenomenon. Therefore, the BMC in the embodiments of the present application provides a downtime screenshot function, which can record specific error information or status logs when the server is down, and is very crucial for quickly locating the cause of the downtime. Among them, the downtime screenshot image can help developers or operation and maintenance teams trace back the system state at that time, can help reproduce the problem, and is helpful for analyzing the root cause of hardware failures or system crashes. In addition, in the embodiments of the present application, the BMC downtime screenshot image is stored in the BMC memory space. However, the BMC memory is usually small, and the BMC downtime screenshot image occupies a large amount of BMC memory, which is likely to cause memory congestion. Therefore, the embodiments of the present application compress and store the BMC downtime screenshot image.
[0033] As a possible implementation method, the embodiments of the present application can segment the BMC downtime screenshot image to be compressed, and divide the image into several sample sub-images with independent features. Among them, each sample sub-image can be segmented by a uniform grid, or a content-based segmentation algorithm such as edge detection or region growing can be used. Specifically, it can be set by those skilled in the art according to the actual situation, and the present application does not make specific limitations.
[0034] Exemplarily, in the embodiments of the present application, the BMC downtime screenshot image is often a single-background image containing text, and the text distribution is relatively regular (such as having rows and columns, etc., and the present application does not make specific limitations). Therefore, the embodiments of the present application can take the uniform grid segmentation with less computational complexity and simple operation as an example to segment the BMC downtime screenshot image to be compressed.
[0035] Further, in order to ensure the highest possible image compression quality, the embodiments of the present application can use multiple segmentation window schemes to uniformly segment the BMC downtime screenshot image to be compressed into 、 、 Equal sample sub - graphs, and the segmentation schematic diagrams are shown in Figures 2(a) - 2(c) (where, in the embodiments of the present application, in order to avoid disclosing sensitive information, the text part of the BMC downtime screenshot image to be compressed has been replaced).
[0036] In addition, it should be noted that after calculating the information amount and performing compression processing on the sample sub - graphs of different segmentation schemes in the embodiments of the present application, the compression quality of each scheme is compared, and the optimal scheme is selected.
[0037] The embodiments of the present application can help accurately identify and locate the key information in the BMC downtime screenshot image by segmenting the BMC downtime screenshot image to be compressed, thereby accelerating the fault troubleshooting and repair process. For the segmented sample sub - graphs, compression processing can be performed as needed to reduce the storage space occupancy and maintain high efficiency and security during transmission and storage.
[0038] Optionally, in an embodiment of the present application, calculating the two - dimensional entropy of at least one sample sub - graph includes: obtaining the gray - scale value of each position in different sample sub - graphs; counting the gray - scale values of all positions in different sample sub - graphs, and calculating the gray - scale proportion according to the gray - scale values of all positions; calculating the two - dimensional entropy of the corresponding sample sub - graph based on the gray - scale proportion.
[0039] It can be understood that in the embodiments of the present application, for the quantitative calculation of the information amount, the entropy value is an important indicator. Further, the image entropy can be used to reflect the average amount of information in the image region, and the one - dimensional image entropy can represent the information amount contained in the aggregation characteristics of the gray - scale distribution in the gray - scale image.
[0040] As a possible implementation manner, the embodiments of the present application can obtain the gray - scale values of all positions by obtaining the gray - scale value of each position in different sample sub - graphs, and then calculate the gray - scale proportion of different gray - scale values, thereby calculating the one - dimensional entropy of the corresponding sample sub - graph. Among them, the expression of the one - dimensional image entropy can be but is not limited to:
[0041] ,
[0042] where, is the proportion of pixels with gray - scale value in the image (which can be obtained by calculating the gray - scale histogram or by other means, and can be specifically set by those skilled in the art according to the actual situation, and the present application does not make specific limitations).
[0043] Exemplarily, for each sample sub - graph in the embodiments of the present application, first, the gray - scale value of each position is obtained, and its value can be [85 123 198 78 85 78]. Further, the embodiments of the present application can calculate the gray - scale proportion of different gray - scale values among the gray - scale values of all positions, and then calculate the corresponding one - dimensional entropy of the image.
[0044] Among them, for pixels with a gray value of 85, the gray proportion is 1 / 3; for pixels with a gray value of 123, the gray proportion is 1 / 6; for pixels with a gray value of 198, the gray proportion is 1 / 6; for pixels with a gray value of 78, the gray proportion is 1 / 3.
[0045] Furthermore, in the embodiments of the present application, the calculation result of the one-dimensional entropy of the image can be, but is not limited to: .
[0046] The embodiments of the present application can initially understand the gray distribution characteristics of the image by calculating the one-dimensional entropy of the image, provide a basis for calculating the two-dimensional entropy of the image, and then more accurately understand and analyze the two-dimensional entropy of the image, so as to provide richer image information, more deeply understand the quality and characteristics of the image, and provide important reference information for image segmentation, realizing the accurate segmentation of the image.
[0047] In step S102, based on the gray values of each position and adjacent positions in at least one sample subgraph, calculate the two-dimensional entropy of at least one sample subgraph. Among them, the expression of the two-dimensional entropy of the image can be, but is not limited to:
[0048] ,
[0049] Among them, is the gray value of the pixel, the neighborhood gray value, is the comprehensive feature of the gray value at the image position and its neighborhood gray value distribution.
[0050] It can be understood that the one-dimensional entropy of the image in the embodiments of the present application can represent the aggregation characteristics of the gray distribution of the image, but cannot reflect the spatial characteristics of the gray distribution of the image. In order to characterize this spatial characteristic, a feature quantity that can reflect the spatial characteristics of the gray distribution - the neighborhood gray value - is introduced on the basis of the one-dimensional entropy to form the two-dimensional entropy of the image. Among them, the two-dimensional entropy of the image, as an effective index for measuring the amount of image information, can help judge the complexity and redundancy of the image area.
[0051] Those skilled in the art can understand that the embodiments of the present application can form a feature binary group from the gray values of each position and adjacent positions in the sample subgraph, denoted as , and then obtain the comprehensive feature of the gray value at a certain pixel position of the image and the gray distribution of its surrounding pixels, which can be, but is not limited to, expressed as:
[0052] ,
[0053] Among them, is the feature binary group The frequency of occurrence is the scale of the image.
[0054] Furthermore, the embodiments of the present application can calculate the two-dimensional entropy of the image according to , and its expression can be but is not limited to:
[0055] ,
[0056] wherein is the gray value of the pixel, is the gray value of the neighborhood, is the gray value at the image position and its neighborhood gray value is the comprehensive feature of the distribution.
[0057] Exemplarily, the embodiments of the present application take the to-be-compressed BMC downtime screenshot image as an example, use the segmentation method of Figure 2 for each downtime screenshot image, and then obtain sample sub-images, and denote the sample sub-images as , where , is the position mark of the sample sub-image in the original image, which is used to restore the image after compression. Calculate the two-dimensional entropy of each sample sub-image , and then obtain , where is the two-dimensional entropy of the corresponding sample sub-image .
[0058] The embodiments of the present application can use the two-dimensional entropy of the image to measure the amount of information in each sample sub-image of the image, and select different compression strategies differentially based on this.
[0059] In step S103, the corresponding sample sub-images are divided into multiple regional sub-images by using the two-dimensional entropy of the image, and each regional sub-image is respectively input into the corresponding variational autoencoder or convolutional autoencoder to output the compressed downtime screenshot image.
[0060] It can be understood that in the embodiments of the present application, the autoencoder is a neural network structure, mainly composed of an encoder and a decoder, and its structural schematic diagram is as Figure 3 shown. Among them, the encoder is usually composed of multiple fully connected layers, convolutional layers or recurrent layers, maps the high-dimensional input data to a low-dimensional space, extracts the main features of the data by gradually reducing the dimension of the data, and achieves the purpose of compression; the decoder is usually symmetric with the encoder and reconstructs the data by gradually increasing the dimension of the data.
[0061] As a possible implementation manner, embodiments of the present application can divide the corresponding sample sub-image into multiple regional sub-images according to the calculated two-dimensional entropy of the image, and then input different regional sub-images into the corresponding variational autoencoder or convolutional autoencoder respectively, so as to obtain the compressed downtime screenshot image.
[0062] Embodiments of the present application reasonably divide the sample sub-image into multiple regional sub-images with different feature information through the two-dimensional entropy of the image, and then ensure that each regional sub-image can be specifically input into a suitable autoencoder, so as to achieve more efficient compression, meet the actual application requirements and image features, and then optimize the compression effect.
[0063] Optionally, in an embodiment of the present application, dividing the corresponding sample sub-image into multiple regional sub-images by using the two-dimensional entropy of the image includes: determining an initial regional threshold for dividing the sample sub-image based on the two-dimensional entropy of the image; dividing the sample sub-image by using the initial regional threshold to obtain multiple initial regional sub-images; dynamically adjusting the initial regional threshold according to the multiple initial regional sub-images to obtain a regional threshold; and dividing the sample sub-image by using the regional threshold to obtain multiple regional sub-images.
[0064] It can be understood that, in order to dynamically adapt to each BMC downtime screenshot image to be compressed, embodiments of the present application can dynamically adjust the regional threshold according to the information amount of each sample sub-image.
[0065] In some embodiments, embodiments of the present application can first determine an initial regional threshold based on the two-dimensional entropy of the image, and then dynamically adjust the initial regional threshold according to the initial regional sub-images obtained by dividing according to the initial regional threshold. Then, a regional threshold is obtained, and the sample sub-image is re-divided by using the regional threshold to obtain multiple regional sub-images.
[0066] Exemplarily, embodiments of the present application can be combined with those shown in FIGS. 4(a)-4(b), set three initial regional thresholds, and then determine the regional threshold through the three initial regional thresholds, where the regional threshold The expression can be but is not limited to:
[0067] ,
[0068] where is the median of the two-dimensional entropy of the image.
[0069] In addition, it should be noted that 1 / 0.8 / 0.5 in embodiments of the present application can be understood as an empirical value, and its value can also be taken as 0.6 / 0.4, etc. The specific setting can be set by those skilled in the art according to the actual situation, and the present application does not make specific limitations.
[0070] Furthermore, when the two-dimensional entropy of the sample sub-image When the sample sub - graph is classified into the background - area sub - graph, it can be understood that the amount of information data contained in this area sub - graph is relatively small; when the two - dimensional entropy of the sample sub - graph is , the sample sub - graph is classified into the text - area sub - graph, which can be understood as that the amount of information data contained in this area sub - graph is relatively large.
[0071] In the embodiment of the present application, the initial region threshold determined by the two - dimensional entropy of the image can reflect the spatial characteristics of the image gray - level distribution, so as to divide the image region more accurately. By dynamically adjusting the initial region threshold, the segmentation result is further optimized, maintaining high segmentation performance and stability, making the segmentation result more in line with the actual characteristics of the image, and thus improving the image compression efficiency and quality.
[0072] Optionally, in an embodiment of the present application, based on the two - dimensional entropy of the image, determining the initial region threshold for dividing the sample sub - graph includes: obtaining the data information of the two - dimensional entropy of the image; determining the initial region threshold according to the data information.
[0073] It can be understood that in the embodiment of the present application, the data information may include, but is not limited to, the median information, mean information, maximum value information, and minimum value information of the two - dimensional entropy of the image, etc. Specifically, it can be set by those skilled in the art according to the actual situation, and the present application does not make specific limitations.
[0074] In some embodiments, the embodiment of the present application may use the median of the two - dimensional entropy of the image as the calculation basis to further determine the initial region threshold.
[0075] The embodiment of the present application adaptively and dynamically sets the region threshold according to the information amount difference of each sample sub - graph for dividing the region sub - graph, making the compression region division of each image more accurate and flexible.
[0076] Optionally, in an embodiment of the present application, the multiple region sub - graphs include a text - area sub - graph and a background - area sub - graph. Among them, inputting each region sub - graph into the corresponding variational auto - encoder or convolutional auto - encoder to output the compressed crash - screen image includes: inputting the text - area sub - graph into the variational auto - encoder to obtain the text - compressed image; inputting the background - area sub - graph into the convolutional auto - encoder to obtain the background - compressed image; outputting the compressed crash - screen image according to the text - compressed image and the background - compressed image.
[0077] It can be understood that in the embodiments of the present application, the multiple regional sub - graphs may but are not limited to including text - region sub - graphs, background - region sub - graphs, etc., and the present application does not make specific limitations. Among them, the text - region sub - graph contains more information. To avoid serious distortion caused by image compression and inconvenience for developers to analyze the cause of downtime using the compressed downtime screenshot image, the embodiments of the present application plan to use a variational auto - encoder with better compression performance for compressing the text - region sub - graph.
[0078] In some embodiments, the embodiments of the present application can obtain the text - compressed image after compressing the text - region sub - graph through a variational auto - encoder.
[0079] In addition, during the image compression process, a high compression ratio often means a high possibility of distortion. For the background - region sub - graph, which contains less information and plays a relatively small role in the analysis of the BMC downtime screenshot image, even if some distortion is caused during the compression process, the adverse impact on the analysis of the BMC downtime screenshot image is limited. Therefore, the embodiments of the present application can use a convolutional auto - encoder with less computational overhead for compressing the background - region sub - graph to reduce computational resource consumption.
[0080] In some embodiments, the embodiments of the present application can obtain the background - compressed image after compressing the background - region sub - graph through a convolutional auto - encoder.
[0081] Furthermore, the embodiments of the present application can output the compressed BMC downtime screenshot image according to the text - compressed image and the background - compressed image.
[0082] The embodiments of the present application use a variational auto - encoder and a convolutional auto - encoder to effectively learn the latent representation of the image, thereby compressing the data of the text region and the background region to a lower dimension while maintaining the main features and information of the image. This is very beneficial for storing and transmitting the BMC downtime screenshot image, so as to achieve more refined encoding and compression targeted, improve the overall image quality for efficient image compression, and selectively store or transmit these regions as needed, further optimizing the storage and transmission efficiency and reducing resource consumption.
[0083] Optionally, in an embodiment of the present application, inputting the text - region sub - graph into the variational auto - encoder to obtain the text - compressed image includes: inputting the text - region sub - graph into the inference network of the variational auto - encoder to generate the probability distribution of the latent variable; inputting the probability distribution into the generation network of the variational auto - encoder to output the approximate probability distribution of the text - region sub - graph; and obtaining the text - compressed image based on the approximate probability distribution.
[0084] It can be understood that, in the embodiments of the present application, different from the traditional autoencoder that describes the latent space numerically, the variational autoencoder describes the observation of the latent space in a probabilistic manner, and performs outstandingly in data generation, enabling high-quality images to be generated during reconstruction, without obvious block effects or distortion visually, and is applicable to the compression of sub-images of text regions.
[0085] In some embodiments, the variational autoencoder in the embodiments of the present application may but is not limited to include an inference network, a generation network, etc., and the present application does not make specific limitations.
[0086] Among them, in the embodiments of the present application, the probability distribution of the latent variable can be generated through the inference network for encoding the sub-image of the text region; then the generated probability distribution is input into the generation network to restore and generate the approximate probability distribution of the original data to reconstruct the image and obtain the text compressed image.
[0087] In the embodiments of the present application, the hidden probability distribution characteristics of the sub-image of the text region can be obtained through the variational autoencoder, realizing effective compression of the image and retaining the important features of the input sub-image of the text region, which is crucial for subsequent image processing.
[0088] Optionally, in an embodiment of the present application, before inputting the sub-image of the background region into the convolutional autoencoder to obtain the background compressed image, it further includes: constructing a convolutional encoder of the convolutional autoencoder based on at least one convolutional layer; constructing a convolutional decoder of the convolutional autoencoder based on at least one convolutional layer; constructing a convolutional autoencoder based on the convolutional encoder, the convolutional decoder, and / or at least one hidden layer.
[0089] It can be understood that, in the embodiments of the present application, the convolutional encoder and the convolutional decoder of the convolutional autoencoder are composed of convolutional layers, which can effectively retain the spatial relationship of the input data and effectively capture local features, and are applicable to the compression of sub-images of background regions.
[0090] In some embodiments, the convolutional encoder of the convolutional autoencoder in the embodiments of the present application can be constructed through at least one convolutional layer, and the convolutional decoder of the convolutional autoencoder can be constructed through at least one convolutional layer. Further, the embodiments of the present application combine at least one hidden layer to construct a convolutional autoencoder. Among them, at least one layer can be one layer, two layers, or multiple layers, and can be specifically set by those skilled in the art according to the actual situation, and the present application does not make specific limitations.
[0091] The embodiments of the present application use convolution to perform linear transformation on the subgraphs of the background region, which can well preserve the spatial information of the subgraphs of the background region, significantly reduce the number of parameters, lower the computational complexity and cost, improve the processing speed and efficiency, and can adjust and expand the architecture of the convolutional autoencoder according to specific task requirements, realizing broad application prospects in various application scenarios.
[0092] Optionally, in an embodiment of the present application, before respectively inputting each regional subgraph into the corresponding variational autoencoder or convolutional autoencoder, it further includes: calculating the entropy difference between the two-dimensional entropy of the sample subgraph before compression and the two-dimensional entropy of the image after compression; respectively obtaining the initial loss functions of the variational autoencoder and the convolutional autoencoder; constructing the loss functions of the variational autoencoder and the convolutional autoencoder based on the initial loss functions and the entropy difference. Wherein, the expression of the loss function can be but is not limited to:
[0093] ,
[0094] Wherein, is the input data of the variational autoencoder or convolutional autoencoder, is the reconstructed data output by the variational autoencoder or convolutional autoencoder, is the two-dimensional entropy value of the image before compression, is the two-dimensional entropy value of the image after compression, is the weight exponent.
[0095] It can be understood that for the autoencoder in the embodiments of the present application, if the input data is , it is compressed by the encoder and denoted as the latent representation , and then passes through the decoder to attempt to reconstruct the input data and obtain the reconstructed data . The difference between the reconstructed data and the input data can be represented by the loss function. The training process of the autoencoder is the process of minimizing the loss function.
[0096] In addition, it should be noted that in the embodiments of the present application, the loss function is generally the difference between the vectors of the input data and the reconstructed data, which is calculated based on the input data. Among them, the initial loss function of the autoencoder in the embodiments of the present application can adopt the mean square error function, and its expression can be but is not limited to:
[0097] ,
[0098] In some embodiments, in order to compress the screenshot image of the BMC downtime, obtain a picture with a small memory occupancy and high clarity, for the clarity of the picture, the image entropy value can be used to measure. Therefore, based on the initial loss function, the entropy difference of the two-dimensional entropy of the image before and after compression is incorporated into the calculation of the loss function, and participates in the parameter optimization of the variational autoencoder and the convolutional autoencoder. Among them, the expression of the loss function can be but not limited to:
[0099] ,
[0100] Among them, is the input data of the variational autoencoder or the convolutional autoencoder, is the reconstructed data output by the variational autoencoder or the convolutional autoencoder, is the two-dimensional entropy value of the image before compression, is the two-dimensional entropy value of the image after compression, is the weight exponent.
[0101] Furthermore, the embodiments of the present application use the loss function to train the variational autoencoder and the convolutional autoencoder, and use the trained variational autoencoder and convolutional autoencoder for the compression of the screenshot image of the BMC downtime, which can effectively compress the memory size occupied by the image and reduce image distortion.
[0102] The embodiments of the present application quantify the change in the clarity of the image before and after compression, incorporate it into the calculation of the loss function of the variational autoencoder and the convolutional autoencoder, use the entropy difference to participate in the training of the variational autoencoder and the convolutional autoencoder, improve the overall performance of the autoencoder, and make the autoencoder pay more attention to the retention of image information during the training process, thereby enhancing the interpretability of the autoencoder.
[0103] Next, the working principle of the downtime screenshot image compression method proposed in the embodiments of the present application will be introduced in combination with a specific embodiment.
[0104] Among them, Figure 5 is the flowchart of the working principle of the downtime screenshot image compression method provided according to an embodiment of the present application.
[0105] Step S501: Obtain the downtime screenshot image to be compressed.
[0106] Step S502: Segment the downtime screenshot image to be compressed.
[0107] Step S503: Obtain different sample sub-images.
[0108] Step S504: Calculate the two-dimensional entropy of each sample sub-image.
[0109] Step S505: Determine whether the two-dimensional entropy of the image is greater than or equal to the region threshold.
[0110] Among them, in the embodiments of the present application, the regional threshold is dynamically adjusted and set through the two-dimensional entropy of the image.
[0111] Furthermore, in the implementation of the present application, if the two-dimensional entropy of the image is greater than or equal to the regional threshold, step S506 is executed; otherwise, step S508 is executed.
[0112] Step S506: Obtain a sub-graph of the text region.
[0113] Step S507: Input the sub-graph of the text region into the variational autoencoder to obtain a compressed text image.
[0114] Step S508: Obtain a sub-graph of the background region.
[0115] Step S509: Input the sub-graph of the background region into the convolutional autoencoder to obtain a compressed background image.
[0116] Step S510: Obtain a compressed crash screenshot image based on the compressed text image and the compressed background image.
[0117] In summary, in the embodiments of the present application, since the crash screenshot image to be compressed is often in the form of a single background combined with several texts, and the amount of information contained in the text region and the background region varies greatly, the crash screenshot image of the BMC to be compressed can be segmented to obtain different sample sub-graphs, and by detecting the amount of information in each sample sub-graph, it can be determined whether it is a sub-graph of the text region or the background region, so as to select different autoencoders for different degrees of compression processing for the two types of regions, and then obtain a compressed crash screenshot image of the BMC, realizing efficient image compression and information retention.
[0118] According to the crash screenshot image compression method proposed in the embodiments of the present application, the crash screenshot image to be compressed can be segmented to obtain sample sub-graphs, and the corresponding sample sub-graphs can be divided into multiple regional sub-graphs by using the calculated two-dimensional entropy of the image, so that each regional sub-graph is input into the corresponding variational autoencoder or convolutional autoencoder to obtain a compressed crash screenshot image. The compression strategy can be adaptively adjusted according to different regional sub-graphs, while effectively reducing the amount of image data, maintaining the main features of the image, and reducing the occupation of storage space by improving the loss functions of the variational autoencoder and the convolutional autoencoder, ensuring the quality of the compressed image and saving valuable memory resources. Thus, the problems in the related art, such as limited recognition accuracy, low coding efficiency, poor flexibility, and inability to adapt to processing high-resolution videos or complex scenes, are solved.
[0119] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0120] An embodiment of the present application also provides a crash screenshot image compression device.
[0121] Figure 6 It is a block diagram of the crash screenshot image compression device provided according to an embodiment of the present application.
[0122] As Figure 6 shown, the crash screenshot image compression device 60 includes: a segmentation module 100, a first calculation module 200, and an output module 300.
[0123] Among them, the segmentation module 100 is used to segment the motherboard management controller crash screenshot image to be compressed to obtain at least one sample sub-image.
[0124] The first calculation module 200 is used to calculate the two-dimensional image entropy of at least one sample sub-image based on the gray values of each position and adjacent positions in at least one sample sub-image.
[0125] The output module 300 is used to divide the corresponding sample sub-image into multiple region sub-images by using the two-dimensional image entropy, and input each region sub-image into the corresponding variational autoencoder or convolutional autoencoder respectively to output the compressed crash screenshot image.
[0126] Optionally, in an embodiment of the present application, the multiple region sub-images include a text region sub-image and a background region sub-image. Among them, the output module 300 includes: a first generation unit, a second generation unit, and a third generation unit.
[0127] Among them, the first generation unit is used to input the text region sub-image into the variational autoencoder to obtain a text compressed image.
[0128] The second generation unit is used to input the background region sub-image into the convolutional autoencoder to obtain a background compressed image.
[0129] The third generation unit is used to output the compressed crash screenshot image according to the text compressed image and the background compressed image.
[0130] Optionally, in an embodiment of the present application, the first generation unit includes: a first generation sub-unit, a second generation sub-unit, and a third generation sub-unit.
[0131] Among them, the first generation sub-unit is used to input the text region sub-image into the inference network in the variational autoencoder to generate the probability distribution of the latent variable.
[0132] A second generation sub-unit, configured to input a probability distribution into a generation network in a variational autoencoder to output an approximate probability distribution of a text region sub-graph.
[0133] A third generation sub-unit, configured to obtain a text compressed image based on the approximate probability distribution.
[0134] Optionally, in an embodiment of the present application, it further includes: a first construction module, a second construction module, and a third construction module.
[0135] Among them, the first construction module is configured to construct a convolutional encoder of the convolutional autoencoder based on at least one convolutional layer before inputting the background region sub-graph into the convolutional autoencoder to obtain a background compressed image.
[0136] The second construction module is configured to construct a convolutional decoder of the convolutional autoencoder based on at least one convolutional layer.
[0137] The third construction module is configured to construct a convolutional autoencoder based on the convolutional encoder, the convolutional decoder, and / or at least one hidden layer.
[0138] Optionally, in an embodiment of the present application, it further includes: a second calculation module, an acquisition module, and a fourth construction module.
[0139] Among them, the second calculation module is configured to calculate the entropy difference between the two-dimensional entropy of the sample sub-graph before compression and the two-dimensional entropy of the image after compression before respectively inputting each region sub-graph into the corresponding variational autoencoder or convolutional autoencoder.
[0140] The acquisition module is configured to respectively acquire the initial loss functions of the variational autoencoder and the convolutional autoencoder.
[0141] The fourth construction module is configured to construct the loss functions of the variational autoencoder and the convolutional autoencoder based on the initial loss functions and the entropy differences.
[0142] Optionally, in an embodiment of the present application, the expression of the loss function may but is not limited to:
[0143] ,
[0144] Among them, is the input data of the variational autoencoder or the convolutional autoencoder, is the reconstructed data output by the variational autoencoder or the convolutional autoencoder, is the two-dimensional entropy value of the image before compression, is the two-dimensional entropy value of the image after compression, is the weight exponent.
[0145] Optionally, in an embodiment of the present application, the first calculation module 200 includes: an acquisition unit, a first calculation unit, and a second calculation unit.
[0146] Among them, the acquisition unit is used to acquire the gray values of each position in different sample subgraphs.
[0147] The first calculation unit is used to count the gray values of all positions in different sample subgraphs and calculate the gray proportion according to the gray values of all positions.
[0148] The second calculation unit is used to calculate the two-dimensional image entropy of the corresponding sample subgraph based on the gray proportion.
[0149] Optionally, in an embodiment of the present application, the output module 300 includes: a determination unit, a division unit, an adjustment unit, and a fourth generation unit.
[0150] Among them, the determination unit is used to determine the initial region threshold for dividing the sample subgraph based on the two-dimensional image entropy.
[0151] The division unit is used to divide the sample subgraph using the initial region threshold to obtain a plurality of initial region subgraphs.
[0152] The adjustment unit is used to dynamically adjust the initial region threshold according to the plurality of initial region subgraphs to obtain the region threshold.
[0153] The fourth generation unit is used to divide the sample subgraph using the region threshold to obtain a plurality of region subgraphs.
[0154] Optionally, in an embodiment of the present application, the determination unit includes: an acquisition subunit and a determination subunit.
[0155] Among them, the acquisition subunit is used to acquire the data information of the two-dimensional image entropy.
[0156] The determination subunit is used to determine the initial region threshold according to the data information.
[0157] Optionally, in an embodiment of the present application, the expression of the two-dimensional image entropy can be but is not limited to:
[0158] ,
[0159] Among them, is the gray value of the pixel, the neighborhood gray value, is the gray value at the image position and its neighborhood gray value the comprehensive feature of the distribution.
[0160] It should be noted that the foregoing explanatory description of the embodiment of the method for compressing the crashed screenshot image is also applicable to the crashed screenshot image compression device of this embodiment, and will not be repeated here.
[0161] According to the crashed screenshot image compression device provided by the embodiment of the present application, the to-be-compressed crashed screenshot image can be segmented to obtain sample sub-images, and the corresponding sample sub-images can be divided into multiple regional sub-images by using the calculated two-dimensional entropy of the image, so that each regional sub-image is input into the corresponding variational autoencoder or convolutional autoencoder to obtain the compressed crashed screenshot image. The compression strategy can be adaptively adjusted according to different regional sub-images, while effectively reducing the amount of image data, maintaining the main features of the image, and reducing the occupation of storage space by improving the loss functions of the variational autoencoder and the convolutional autoencoder, ensuring the quality of the compressed image and saving valuable memory resources. Thus, the problems in the related art, such as limited recognition accuracy, low coding efficiency, poor flexibility, and inability to adapt to processing high-resolution videos or complex scenes, are solved.
[0162] For the description of the features in the embodiment corresponding to the crashed screenshot image compression device, reference can be made to the relevant description of the embodiment corresponding to the crashed screenshot image compression method, which will not be elaborated here one by one.
[0163] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above embodiments of the method for compressing the crashed screenshot image.
[0164] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any of the above embodiments of the method for compressing the crashed screenshot image when running.
[0165] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disc that can store a computer program.
[0166] An embodiment of the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above embodiments of the method for compressing the crashed screenshot image are implemented.
[0167] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium storing a computer program, where the computer program, when executed by a processor, implements the steps in any of the above-described embodiments of the method for compressing a crash screenshot image.
[0168] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0169] The above has introduced in detail a method for compressing a crash screenshot image provided by the present application. Specific examples are used herein to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A method for compressing a screenshot image during a shutdown, characterized in that: The following steps are involved: Segmenting the downtime screenshot image to be compressed to obtain at least one sample sub-image, wherein the downtime screenshot image to be compressed includes a text area and a background area; Calculating the image two-dimensional entropy of the at least one sample sub-image based on the grayscale values of each position and the adjacent positions in the at least one sample sub-image; Using the two-dimensional entropy of the image, the corresponding sample sub-image is divided into a plurality of regional sub-images, and each regional sub-image is respectively input into a corresponding variational autoencoder or convolutional autoencoder to output a compressed downtime screenshot image; The multiple region sub-images include a text region sub-image and a background region sub-image, and the step of inputting each region sub-image into a corresponding variational autoencoder or a convolutional autoencoder to output a compressed downtime screenshot image includes: Inputting the text region sub-image into a variational autoencoder to obtain a text compressed image; Inputting the background area sub-image into the convolutional autoencoder to obtain a background compressed image; The compressed downtime screenshot image is outputted according to the text compressed image and the background compressed image.
2. The method for compressing downtime screenshot images according to claim 1, characterized in that: The step of inputting the text region sub-image into a variational autoencoder to obtain a text compressed image includes: Inputting the text region sub-graph into the inference network in the variational autoencoder to generate a probability distribution of latent variables; Inputting the probability distribution into the generative network in the variational autoencoder to output an approximate probability distribution of the text region subgraph; Based on the approximate probability distribution, the text compressed image is obtained.
3. The method for compressing downtime screenshot images according to claim 1, characterized in that: Before inputting the background area sub-image into the convolutional autoencoder to obtain the background compressed image, the method further includes: Constructing a convolutional encoder of the convolutional autoencoder based on at least one convolutional layer; Based on at least one convolutional layer, construct a convolutional decoder of the convolutional autoencoder; The convolutional autoencoder is constructed based on the convolutional encoder, the convolutional decoder and / or at least one hidden layer.
4. The method for compressing downtime screenshot images according to claim 1, characterized in that: Before each of the region sub-graphs is input into the corresponding variational autoencoder or convolutional autoencoder, the method further includes: Calculating the entropy difference between the two-dimensional entropy of the sample sub-image before compression and the two-dimensional entropy of the sample sub-image after compression; Obtaining initial loss functions of the variational autoencoder and the convolutional autoencoder respectively; Based on the initial loss function and the entropy difference, loss functions of the variational autoencoder and the convolutional autoencoder are constructed.
5. The method for compressing downtime screenshot images according to claim 4, characterized in that: The expression of the loss function is: , in, is the input data of the variational autoencoder or the convolutional autoencoder, is the reconstructed data output by the variational autoencoder or the convolutional autoencoder, is the two-dimensional entropy value of the image before compression, is the two-dimensional entropy value of the compressed image, is the weight index.
6. The method for compressing downtime screenshot images according to claim 1, characterized in that: The calculating the two-dimensional entropy of the image of the at least one sample sub-image comprises: Get the grayscale value of each position in different sample sub-images; Counting the grayscale values of all positions in different sample sub-images, and calculating the grayscale proportions according to the grayscale values of all positions; Based on the grayscale proportion, the two-dimensional entropy of the image corresponding to the sample sub-image is calculated.
7. The method for compressing downtime screenshot images according to claim 1, characterized in that: The method of dividing the corresponding sample sub-image into a plurality of region sub-images by using the two-dimensional entropy of the image includes: Based on the two-dimensional entropy of the image, determining an initial region threshold for dividing the sample sub-image; Dividing the sample sub-graph using the initial region threshold to obtain a plurality of initial region sub-graphs; Dynamically adjusting the initial region threshold according to the multiple initial region sub-graphs to obtain a region threshold; The sample sub-image is divided using the region threshold to obtain the multiple region sub-images.
8. The method for compressing downtime screenshot images according to claim 7, characterized in that: The determining, based on the two-dimensional entropy of the image, an initial region threshold for dividing the sample sub-image comprises: Acquire data information of the two-dimensional entropy of the image; The initial region threshold is determined according to the data information.
9. The method according to claim 1, characterized in that: The expression of the two-dimensional entropy of the image is: , in, is the gray value of the pixel, is the neighborhood grayscale value, is the gray value at the image position and its neighboring grayscale value Comprehensive characteristics of distribution.
10. A downtime screenshot image compression device, characterized in that: include: A segmentation module, used for segmenting the mainboard management controller crash screenshot image to be compressed to obtain at least one sample sub-image; A calculation module, used for calculating the two-dimensional image entropy of the at least one sample sub-image based on the grayscale values of each position and adjacent positions in the at least one sample sub-image; An output module, used to divide the corresponding sample sub-image into a plurality of regional sub-images by using the two-dimensional entropy of the image, and input each regional sub-image into a corresponding variational autoencoder or convolutional autoencoder to output a compressed downtime screenshot image; The plurality of region sub-images include a text region sub-image and a background region sub-image, and the output module includes: A first generating unit, used for inputting the text region sub-image into a variational autoencoder to obtain a text compressed image; A second generating unit, configured to input the background region sub-image into the convolutional autoencoder to obtain a background compressed image; The third generating unit is used to output the compressed crash screenshot image according to the text compressed image and the background compressed image.
11. The downtime screenshot image compression device according to claim 10, characterized in that: The first generating unit comprises: A first generating subunit, used for inputting the text region subgraph into the inference network in the variational autoencoder to generate a probability distribution of latent variables; A second generating subunit, used for inputting the probability distribution into a generating network in the variational autoencoder to output an approximate probability distribution of the text region subgraph; The third generating subunit is used to obtain the text compressed image based on the approximate probability distribution.
12. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for compressing a downtime screenshot image as described in any one of claims 1 to 9.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the downtime screenshot image compression method as described in any one of claims 1-9.
Citation Information
Patent Citations
Video abnormal behavior detection method and system based on automatic encoder
CN114913599A
Anomaly detection method and system for multi-source heterogeneous data
WO2025039300A1