Method and device for compressing downtime screenshot image
By segmenting and two-dimensional entropy division of downtime screenshot images and using autoencoder for compression, the problems of low identification accuracy and poor encoding efficiency in the prior art are solved, and efficient and flexible image compression is achieved, suitable for high-resolution videos and complex scenes.
Patent Information
- Application Number
- CN202510340506.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-04-18
- 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, improves encoding efficiency and flexibility, can adapt to high-resolution videos and complex scene processing, reduces the amount of image data, while maintaining the main features, and reducing storage space usage.
Smart Images

Figure CN119854493A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image compression technology, and in particular to a method and device for compressing a screenshot image when the computer is down. Background Art
[0002] In the related technology, color clustering can be performed on the text area of the downtime video recording to obtain multiple single-color layer images, and then the 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 server's log system; different prediction modes can also be selected according to the input current frame and reference frame images, and the prediction residuals obtained under different prediction modes can be mapped to the non-negative area, and then the corresponding encoding method can be used according to the distribution characteristics of the residual data to obtain the final encoding result.
[0003] However, in the related technologies, the recognition accuracy of color clustering is limited when processing images with complex backgrounds or text colors similar to the background colors, which affects the accuracy of color clustering; and video encoding needs to weigh various factors when selecting a prediction mode, resulting in low coding efficiency and poor flexibility, and is unable to adapt to processing high-resolution videos or complex scenes, etc., and is in urgent need of improvement. Summary of the invention
[0004] The present application provides a method and device for compressing screenshot images during a downtime, so as to at least solve the problems in the related art, such as limited recognition accuracy, low encoding efficiency, poor flexibility, and inability to adapt to processing high-resolution videos or complex scenes.
[0005] The present application provides a method for compressing a downtime screenshot image, comprising: segmenting a downtime screenshot image to be compressed to obtain at least one sample sub-image; calculating the image two-dimensional 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; using the image two-dimensional entropy to divide the corresponding sample sub-image into multiple region sub-images, and inputting each region sub-image into a corresponding variational autoencoder or a convolutional autoencoder, respectively, to output a compressed downtime screenshot image.
[0006] The present application also provides a downtime screenshot image compression device, including: a segmentation module, used to segment the mainboard management controller downtime screenshot image to be compressed to obtain at least one sample sub-image; a calculation module, used to calculate the image two-dimensional 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 multiple region sub-images using the image two-dimensional entropy, and input each region sub-image into a corresponding variational autoencoder or a convolutional autoencoder, respectively, to output a compressed downtime screenshot image.
[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned methods for compressing downtime screenshot images when executing the computer program.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned methods for compressing downtime screenshot images are implemented.
[0009] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned downtime screenshot image compression methods when executed by a processor.
[0010] Through the present application, the downtime screenshot image to be compressed can be segmented to obtain sample sub-images, and the corresponding sample sub-images can be divided into multiple regional sub-images 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 a compressed downtime 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 compression strategy can be adaptively adjusted according to different regional sub-images. While effectively reducing the amount of image data, the main features of the image are maintained, and by improving the loss function of the variational autoencoder and the convolutional autoencoder, the storage space occupancy is reduced, the compressed image quality is guaranteed, and the technical effect of saving precious memory resources is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 A flowchart of a method for compressing a downtime screenshot image provided according to an embodiment of the present application; FIG2( a ) is a schematic diagram of image segmentation provided according to an embodiment of the present application; FIG2( b ) is a schematic diagram of image segmentation provided according to an embodiment of the present application; FIG2( c ) is a schematic diagram of image segmentation provided according to an embodiment of the present application; Figure 3 A block diagram of an autoencoder structure provided according to an embodiment of the present application; FIG4( a ) is a schematic diagram of an example of dynamic threshold adjustment provided according to an embodiment of the present application; FIG4( b ) is a schematic diagram of another example of dynamic threshold adjustment provided according to an embodiment of the present application; Figure 5 A flowchart of the working principle of a method for compressing a downtime screenshot image provided according to an embodiment of the present application; Figure 6 A block diagram of a downtime screenshot image compression device provided according to an embodiment of the present application.
[0013] Reference numerals: Among them, 60 is a downtime screenshot image compression device; 100 is a segmentation module, 200 is a first calculation module, and 300 is an output module. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0015] It should be noted that, in the description of this application, the terms "include", "comprise" 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 includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0016] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0017] An embodiment of the present application provides a method for compressing a screenshot image when a computer is down, and the method is described in detail in conjunction with the execution flow of the method for compressing a screenshot image when a computer is down.
[0018] Specifically, Figure 1 The present invention is a flowchart of a method for compressing a screenshot image during a system downtime provided according to an embodiment of the present application.
[0019] like Figure 1 As shown, the downtime screenshot image compression method includes the following steps: In step S101, the downtime screenshot image to be compressed is segmented to obtain at least one sample sub-image.
[0020] It can be understood that in the embodiments of the present application, the downtime screenshot image may include but is not limited to operating system level screenshot images, virtualization platform screenshot images, BMC (Baseboard Management Controller) downtime screenshot images, etc., and the present application does not impose specific restrictions.
[0021] Among them, BMC is an embedded microcontroller independent of the main processor, with independent processing capabilities and storage space, used to monitor, manage and control various hardware and software functions of the server.
[0022] In addition, during the use of the server, the server may crash. Therefore, the BMC of the present application embodiment provides a crash screenshot function, which can record specific error information or status logs when the server crashes, which is very critical for quickly locating the cause of the crash. Among them, the crash screenshot image can help developers or operation and maintenance teams trace back to the system status at the time, can help reproduce the problem, and help analyze the root cause of hardware failure or system crash. In addition, in the present application embodiment, the BMC crash screenshot image is stored in the BMC memory space, but the BMC memory is usually small, and the BMC crash screenshot image occupies more BMC memory, which is easy to cause memory congestion. Therefore, the present application embodiment compresses and stores the BMC crash screenshot image.
[0023] As a possible implementation method, the embodiment 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 characteristics. 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. The specific settings can be made by technicians in this field according to actual conditions, and this application does not impose specific restrictions.
[0024] For example, in an embodiment of the present application, a BMC crash screenshot image is often a single background image containing text, and the text distribution is relatively regular (such as having rows and columns, etc., which is not specifically limited in the present application). Therefore, the embodiment of the present application can use uniform grid segmentation with less computational effort and simple operation as an example to segment the compressed BMC crash screenshot image.
[0025] Furthermore, in order to ensure the highest possible image compression quality, the embodiment of the present application may use multiple split window schemes to evenly split the BMC downtime screenshot image to be compressed into , , The segmentation diagrams of the sub-graphs are shown in FIG2(a) to FIG2(c) (wherein, in order to avoid leaking sensitive information, the text part of the BMC crash screenshot image to be compressed is replaced in this embodiment of the application).
[0026] In addition, it should be noted that, after calculating the amount of information and compressing the sample sub-graphs of different segmentation schemes, the embodiments of the present application compare the compression quality of each scheme and select the optimal scheme.
[0027] The embodiment of the present application can help accurately identify and locate key information in the BMC crash screenshot image by segmenting the BMC crash screenshot image to be compressed, thereby accelerating the troubleshooting and repair process. The segmented sample sub-images can be compressed as needed to reduce storage space usage and maintain high efficiency and security during transmission and storage.
[0028] Optionally, in one embodiment of the present application, the two-dimensional entropy of the image of at least one sample sub-image is calculated, including: obtaining 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 proportion based on the grayscale values of all positions; based on the grayscale proportion, calculating the two-dimensional entropy of the image of the corresponding sample sub-image.
[0029] It is understandable that, in the embodiments of the present application, entropy is an important indicator for the quantitative calculation of information volume. Further, image entropy can be used to reflect the average amount of information in an image area, while image one-dimensional entropy can represent the amount of information contained in the aggregated features of grayscale distribution in a grayscale image.
[0030] As a possible implementation method, the embodiment of the present application can obtain the grayscale value of all positions by obtaining the grayscale value of each position in different sample sub-images, and then calculate the grayscale proportion of different grayscale values, thereby calculating the image one-dimensional entropy of the corresponding sample sub-image. The expression of the image one-dimensional entropy can be but is not limited to: , in, The gray value in the image is The proportion of pixels occupied by (which can be obtained by grayscale histogram calculation or by other methods, which can be specifically set by technicians in this field according to actual conditions and is not specifically limited in this application).
[0031] Exemplarily, for each sample sub-image, the embodiment of the present application first obtains the grayscale value of each position, and its value can be [85 123 198 78 85 78]. Furthermore, the embodiment of the present application can calculate the grayscale proportion of different grayscale values in the grayscale values of all positions, and then calculate the corresponding one-dimensional entropy of the image.
[0032] Among them, for pixels with a grayscale value of 85, the grayscale proportion is 1 / 3; for pixels with a grayscale value of 123, the grayscale proportion is 1 / 6; for pixels with a grayscale value of 198, the grayscale proportion is 1 / 6; for pixels with a grayscale value of 78, the grayscale proportion is 1 / 3.
[0033] Further, in the embodiment of the present application, the calculation result of the one-dimensional entropy of the image may be, but is not limited to: .
[0034] The embodiments of the present application can calculate the one-dimensional entropy of the image to initially understand the grayscale distribution characteristics 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, thereby providing richer image information, a deeper understanding of the quality and characteristics of the image, and providing important reference information for image segmentation, thereby achieving accurate image segmentation.
[0035] In step S102, based on the grayscale values of each position and the adjacent positions in the at least one sample sub-image, the image two-dimensional entropy of the at least one sample sub-image is calculated. The expression of the image two-dimensional entropy may be, but is not limited to,: , in, is the gray value of the pixel, Neighborhood grayscale value, is the gray value at the image position and its neighboring grayscale value Comprehensive characteristics of distribution.
[0036] It is understandable that the one-dimensional entropy of the image in the embodiment of the present application can represent the clustering characteristics of the grayscale distribution of the image, but it cannot reflect the spatial characteristics of the grayscale distribution of the image. In order to characterize this spatial characteristic, a feature quantity that can reflect the spatial characteristics of the grayscale distribution - the neighborhood grayscale 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 indicator for measuring the amount of image information, can help judge the complexity and redundancy of the image area.
[0037] Those skilled in the art can understand that, in the embodiment of the present application, the grayscale values of each position and the adjacent position in the sample sub-image can be combined into a feature binary group, which is recorded as , and then obtain the comprehensive characteristics of the gray value at a certain pixel position of the image and the gray distribution of its surrounding pixels, which can be expressed as but not limited to: , in, is a feature binary The frequency of occurrence, is the scale of the image.
[0038] Furthermore, the embodiments of the present application can be based on , calculate the two-dimensional entropy of the image, and its expression can be but not limited to: , 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.
[0039] For example, the embodiment of the present application takes the BMC downtime screenshot image to be compressed as an example, and uses the segmentation method of Figure 2 for each downtime screenshot image to obtain sample subgraphs, and the sample subgraphs are recorded as ,in , 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 the image and get ,in, For each sample subgraph The corresponding two-dimensional entropy of the image.
[0040] The embodiment of the present application can use the two-dimensional entropy of the image to measure the amount of information of each sample sub-image in the image, and based on this, select different compression strategies in a differentiated manner.
[0041] In step S103, the corresponding sample sub-image is divided into a plurality of region sub-images using the two-dimensional entropy of the image, and each region sub-image is respectively input into a corresponding variational autoencoder or convolutional autoencoder to output a compressed downtime screenshot image.
[0042] It can be understood that in the embodiment of the present application, the autoencoder is a neural network structure, which is mainly composed of an encoder and a decoder. Figure 3 As shown in the figure, the encoder is usually composed of multiple fully connected layers, convolutional layers or recurrent layers, which maps high-dimensional input data to low-dimensional space, reduces the dimension of the data layer by layer, extracts the main features of the data, and achieves the purpose of compression; the decoder is usually symmetrical with the encoder and reconstructs the data by increasing the data dimension layer by layer.
[0043] As a possible implementation method, the embodiment of the present application can divide the corresponding sample sub-image into multiple region sub-images according to the calculated two-dimensional entropy of the image, and then input the different region sub-images into the corresponding variational autoencoder or convolutional autoencoder respectively, so as to obtain a compressed crash screenshot image.
[0044] The embodiment of the present application reasonably divides the sample sub-image into multiple regional sub-images with different feature information through the two-dimensional entropy of the image, thereby ensuring that each regional sub-image can be specifically input into a suitable autoencoder, thereby achieving more efficient compression, meeting actual application requirements and image characteristics, and optimizing the compression effect.
[0045] Optionally, in one embodiment of the present application, the corresponding sample sub-image is divided into multiple region sub-images using image two-dimensional entropy, including: determining an initial region threshold for dividing the sample sub-image based on the image two-dimensional entropy; dividing the sample sub-image using the initial region threshold to obtain multiple initial region sub-images; dynamically adjusting the initial region threshold based on the multiple initial region sub-images to obtain a region threshold; dividing the sample sub-image using the region threshold to obtain multiple region sub-images.
[0046] It is understandable that, in order to dynamically adapt to each BMC downtime screenshot image to be compressed, the embodiment of the present application can dynamically adjust the region threshold according to the amount of information of each sample sub-image.
[0047] In some embodiments, the embodiments of the present application can first determine the initial region threshold based on the two-dimensional entropy of the image, and then dynamically adjust the initial region threshold according to the initial region sub-image obtained by dividing the initial region threshold, and then obtain the region threshold, and use the region threshold to re-divide the sample sub-image, so as to obtain multiple region sub-images.
[0048] For example, the embodiment of the present application can be combined with FIG. 4 (a)-FIG. 4 (b) to set three initial area thresholds, and then determine the area threshold through the three initial area thresholds, wherein the area threshold The expression can be, but is not limited to: , in, is the median of the two-dimensional entropy of the image.
[0049] In addition, it should be noted that the embodiment 1 / 0.8 / 0.5 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 technicians in this field according to actual conditions, and this application does not make any specific restrictions.
[0050] Furthermore, when the image 2D entropy of the sample sub-graph When , the sample sub-image is classified into the background region sub-image. It can be understood that the sub-image in this region contains less information data. When the image two-dimensional entropy of the sample sub-image , the sample sub-image is classified into the text area sub-image. It can be understood that the area sub-image contains more information data.
[0051] The initial area threshold determined by the two-dimensional entropy of the image in the embodiment of the present application can reflect the spatial characteristics of the image grayscale distribution, thereby more accurately dividing the image area, and further optimizes the segmentation result by dynamically adjusting the initial area threshold, maintaining high segmentation performance and stability, so that the segmentation result is more in line with the actual characteristics of the image, thereby improving image compression efficiency and quality.
[0052] Optionally, in one embodiment of the present application, determining an initial region threshold for dividing a sample sub-image based on image two-dimensional entropy includes: acquiring data information of image two-dimensional entropy; and determining the initial region threshold according to the data information.
[0053] It can be understood that in the embodiments of the present application, the data information may include but is not limited to the median information, mean information, maximum information and minimum information of the two-dimensional entropy of the image, which can be specifically set by technicians in this field according to actual conditions, and the present application does not impose any specific restrictions.
[0054] In some embodiments, the present application can use the median of the two-dimensional entropy of the image To calculate the benchmark and then determine the initial area threshold.
[0055] The embodiment of the present application utilizes the information amount difference of each sample sub-image to adaptively and dynamically set the region threshold for dividing the region sub-image, so that the compression region division of each image is more accurate and flexible.
[0056] Optionally, in one embodiment of the present application, the multiple region sub-images include text region sub-images and background region sub-images, wherein each region sub-image is respectively input into a corresponding variational autoencoder or a convolutional autoencoder to output a compressed crash screenshot image, including: inputting the text region sub-image into the variational autoencoder to obtain a text compressed image; inputting the background region sub-image into the convolutional autoencoder to obtain a background compressed image; and outputting a compressed crash screenshot image according to the text compressed image and the background compressed image.
[0057] It is understandable that in the embodiment of the present application, the multiple region sub-graphs may include, but are not limited to, text region sub-graphs and background region sub-graphs, etc., and the present application does not impose specific restrictions. Among them, the text region sub-graph contains a large amount of information. In order to avoid serious distortion due to image compression, which causes inconvenience to developers when using compressed downtime screenshots to analyze the cause of downtime, the embodiment of the present application intends to use a variational autoencoder with good compression performance to compress the text region sub-graph.
[0058] In some embodiments, the embodiments of the present application can obtain a compressed text image after compressing the text area sub-image through a variational autoencoder.
[0059] In addition, during the image compression process, a high compression ratio often means a high possibility of distortion. For the background area sub-image, it contains less information and plays a smaller role in the BMC downtime screenshot image analysis process. Therefore, even if some distortion is caused during the compression process, the adverse impact on the BMC downtime screenshot image analysis is limited. Therefore, the embodiment of the present application can use a convolutional autoencoder with less computational overhead to compress the background area sub-image, thereby reducing the consumption of computing resources.
[0060] In some embodiments, the embodiments of the present application can obtain a background compressed image after the background area sub-image is compressed through a convolutional autoencoder.
[0061] Furthermore, the embodiment of the present application can output a compressed BMC crash screenshot image based on the text compressed image and the background compressed image.
[0062] The embodiment of the present application effectively learns the potential representation of the image through a variational autoencoder and a convolutional autoencoder, thereby compressing the data of the text area and the background area to a lower dimension while maintaining the main features and information of the image. This is very beneficial for storing and transmitting BMC crash screenshot images, thereby achieving more targeted and refined encoding and compression, improving the overall image quality and efficient image compression, and selectively storing or transmitting these areas as needed, further optimizing storage and transmission efficiency, and reducing resource consumption.
[0063] Optionally, in one embodiment of the present application, a text area sub-image is input into a variational autoencoder to obtain a text compressed image, including: inputting the text area sub-image into an inference network in the variational autoencoder to generate a probability distribution of latent variables; inputting the probability distribution into a generation network in the variational autoencoder to output an approximate probability distribution of the text area sub-image; and obtaining a text compressed image based on the approximate probability distribution.
[0064] It can be understood that in the embodiments of the present application, the variational autoencoder is different from the traditional autoencoder in that it describes the latent space in a numerical way. It describes the observation of the latent space in a probabilistic way, and performs outstandingly in data generation, so that high-quality images can be generated during reconstruction, without obvious visual blocking effects or distortion, and is suitable for text area sub-image compression.
[0065] In some embodiments, the variational autoencoder of the embodiment of the present application may include, but is not limited to, an inference network and a generation network, etc., and the present application does not impose any specific limitations.
[0066] Among them, the embodiment of the present application can generate a probability distribution of latent variables through an inference network, which is used to encode a text area sub-image; then the generated probability distribution is input into a generation network to restore the approximate probability distribution of the original data to reconstruct the image and obtain a compressed text image.
[0067] The embodiment of the present application can obtain the hidden probability distribution characteristics of the text area sub-image through the variational autoencoder, realize the effective compression of the image, and retain the important characteristics of the input text area sub-image, which plays a vital role in subsequent image processing.
[0068] Optionally, in one embodiment of the present application, before the background area sub-image is input into the convolutional autoencoder to obtain a background compressed image, it also 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.
[0069] It can be understood that in the embodiment of the present application, the convolutional encoder and 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 suitable for the compression of background area sub-images.
[0070] In some embodiments, the embodiment of the present application can construct a convolutional encoder of a convolutional autoencoder through at least one convolutional layer, and construct a convolutional decoder of a convolutional autoencoder through at least one convolutional layer. Further, the embodiment of the present application combines 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, which can be specifically set by technicians in this field according to actual conditions, and this application does not make specific restrictions.
[0071] The embodiment of the present application uses a convolution method to perform a linear transformation on the background area sub-image, which can well preserve the spatial information of the background area sub-image, significantly reduce the number of parameters, reduce the complexity and cost of calculation, and improve the processing speed and efficiency. The architecture of the convolutional autoencoder can be adjusted and expanded according to specific task requirements, and has broad application prospects in various application scenarios.
[0072] Optionally, in one embodiment of the present application, before each region sub-image is input into the corresponding variational autoencoder or convolutional autoencoder, the method further includes: calculating the entropy difference between the image two-dimensional entropy of the sample sub-image before compression and the image two-dimensional entropy after compression; obtaining the initial loss function of the variational autoencoder and the convolutional autoencoder respectively; and constructing the loss function of the variational autoencoder and the convolutional autoencoder based on the initial loss function and the entropy difference. The expression of the loss function may be, but is not limited to,: , in, 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 compressed image, is the weight index.
[0073] It can be understood that, for the autoencoder in the present embodiment, if the input data is , compressed by the encoder and recorded as implicit representation , then Through the decoder, try to reconstruct the input data and get the reconstructed data , the difference between the reconstructed data and the input data can be expressed by the loss function, and the training process of the autoencoder is the process of minimizing the loss function.
[0074] In addition, it should be noted that in the embodiment of the present application, the loss function is generally the difference between the vector 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 embodiment of the present application can adopt the mean square error function, and its expression can be but not limited to: , In some embodiments, in order to compress the BMC crash screenshot image and obtain a clear image that occupies less memory, the clarity of the image can be measured by the image entropy value. Therefore, based on the initial loss function, the embodiment of the present application incorporates the entropy difference of the two-dimensional entropy of the image before and after compression 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 is not limited to: , in, 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 compressed image, is the weight index.
[0075] Furthermore, the embodiment of the present application uses a loss function to train a variational autoencoder and a convolutional autoencoder, and uses the trained variational autoencoder and convolutional autoencoder to compress BMC downtime screenshot images, which can effectively compress the memory size occupied by the image and reduce image distortion.
[0076] The embodiment of the present application quantifies the change in image clarity before and after compression, and incorporates it into the calculation of the loss function of the variational autoencoder and the convolutional autoencoder, and uses the entropy difference to participate in the training of the variational autoencoder and the convolutional autoencoder, thereby improving the overall performance of the autoencoder and making the autoencoder pay more attention to the retention of image information during the training process, thereby enhancing the interpretability of the autoencoder.
[0077] The working principle of the downtime screenshot image compression method proposed in the embodiment of the present application is introduced below in conjunction with a specific embodiment.
[0078] in, Figure 5The present invention is a flowchart of the working principle of a method for compressing a screenshot image during a downtime according to an embodiment of the present application.
[0079] Step S501: Obtain the downtime screenshot image to be compressed.
[0080] Step S502: Segment the downtime screenshot image to be compressed.
[0081] Step S503: Acquire different sample sub-graphs.
[0082] Step S504: Calculate the two-dimensional image entropy of each sample sub-image.
[0083] Step S505: Determine whether the two-dimensional entropy of the image is greater than or equal to the region threshold.
[0084] In this embodiment of the present application, the regional threshold is set by dynamically adjusting the two-dimensional entropy of the image.
[0085] Further, 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.
[0086] Step S506: Obtain the text area sub-image.
[0087] Step S507: input the text region sub-image into the variational autoencoder to obtain a text compressed image.
[0088] Step S508: Obtain a background area sub-image.
[0089] Step S509: Input the background area sub-image into the convolutional autoencoder to obtain a background compressed image.
[0090] Step S510: obtaining a compressed downtime screenshot image according to the text compressed image and the background compressed image.
[0091] In summary, in the embodiment of the present application, since the crash screenshot image to be compressed is often in the form of a single background combined with a number of texts, and the amount of information contained in the text area and the background area is quite different, the BMC crash screenshot image to be compressed can be segmented to obtain different sample sub-images, and the amount of information in each sample sub-image can be detected to determine whether it is a text area sub-image or a background area sub-image, so that different autoencoders are selected for the two types of areas to perform compression processing to different degrees, and then the compressed BMC crash screenshot image is obtained, thereby achieving efficient image compression and information retention.
[0092] According to the downtime screenshot image compression method proposed in the embodiment of the present application, the downtime screenshot image to be compressed can be segmented to obtain sample sub-images, and the corresponding sample sub-images can be divided into multiple regional sub-images 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 downtime screenshot image. The compression strategy can be adaptively adjusted according to different regional sub-images, while effectively reducing the amount of image data, the main features of the image are maintained, and by improving the loss function of the variational autoencoder and the convolutional autoencoder, the storage space occupied is reduced, the quality of the compressed image is guaranteed, and precious memory resources are saved. In this way, the problems of limited recognition accuracy, low coding efficiency, poor flexibility, and inability to adapt to the processing of high-resolution videos or complex scenes in the related technology are solved.
[0093] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0094] An embodiment of the present application also provides a downtime screenshot image compression device.
[0095] Figure 6 A block diagram of a downtime screenshot image compression device provided according to an embodiment of the present application.
[0096] like Figure 6 As shown, the downtime screenshot image compression device 60 includes: a segmentation module 100, a first calculation module 200 and an output module 300.
[0097] The segmentation module 100 is used to segment the mainboard management controller crash screenshot image to be compressed to obtain at least one sample sub-image.
[0098] The first calculation module 200 is used to calculate the two-dimensional image entropy of at least one sample sub-image based on the grayscale values of each position and adjacent positions in at least one sample sub-image.
[0099] The output module 300 is used to divide the corresponding sample sub-image into multiple region sub-images by using the two-dimensional entropy of the image, and input each region sub-image into the corresponding variational autoencoder or convolutional autoencoder to output a compressed downtime screenshot image.
[0100] Optionally, in an embodiment of the present application, the plurality of region sub-images include a text region sub-image and a background region sub-image, wherein the output module 300 includes: a first generation unit, a second generation unit and a third generation unit.
[0101] Among them, the first generating unit is used to input the text area sub-image into the variational autoencoder to obtain a text compressed image.
[0102] The second generating unit is used to input the background area sub-image into the convolutional autoencoder to obtain a background compressed image.
[0103] The third generating unit is used to output a compressed crash screenshot image according to the text compressed image and the background compressed image.
[0104] Optionally, in one 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.
[0105] Among them, the first generation subunit is used to input the text area sub-image into the inference network in the variational autoencoder to generate the probability distribution of the latent variable.
[0106] The second generating subunit is used to input the probability distribution into the generating network in the variational autoencoder to output the approximate probability distribution of the text area sub-graph.
[0107] The third generating subunit is used to obtain a text compressed image based on an approximate probability distribution.
[0108] Optionally, in one embodiment of the present application, it further includes: a first building module, a second building module and a third building module.
[0109] Among them, the first construction module is used to construct a convolutional encoder of the convolutional autoencoder based on at least one convolutional layer before inputting the background area sub-image into the convolutional autoencoder to obtain a background compressed image.
[0110] The second building module is used to build a convolutional decoder of the convolutional autoencoder based on at least one convolutional layer.
[0111] The third building module is used to build a convolutional autoencoder based on the convolutional encoder, the convolutional decoder and / or at least one hidden layer.
[0112] Optionally, in one embodiment of the present application, it further includes: a second calculation module, an acquisition module and a fourth construction module.
[0113] The second calculation module is used to calculate the entropy difference between the image two-dimensional entropy of the sample sub-image before compression and the image two-dimensional entropy after compression before inputting each region sub-image into the corresponding variational autoencoder or convolutional autoencoder.
[0114] The acquisition module is used to obtain the initial loss functions of the variational autoencoder and the convolutional autoencoder respectively.
[0115] The fourth building module is used to construct the loss function of the variational autoencoder and the convolutional autoencoder based on the initial loss function and the entropy difference.
[0116] Optionally, in one embodiment of the present application, the expression of the loss function may be, but is not limited to,: , in, 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 compressed image, is the weight index.
[0117] Optionally, in one embodiment of the present application, the first calculation module 200 includes: an acquisition unit, a first calculation unit and a second calculation unit.
[0118] The acquisition unit is used to obtain the grayscale value of each position in different sample sub-images.
[0119] The first calculation unit is used to count the grayscale values of all positions in different sample sub-images, and calculate the grayscale proportion according to the grayscale values of all positions.
[0120] The second calculation unit is used to calculate the two-dimensional entropy of the image corresponding to the sample sub-image based on the grayscale ratio.
[0121] Optionally, in one embodiment of the present application, the output module 300 includes: a determination unit, a division unit, an adjustment unit and a fourth generation unit.
[0122] The determination unit is used to determine the initial region threshold for dividing the sample sub-image based on the two-dimensional entropy of the image.
[0123] The division unit is used to divide the sample sub-image by using the initial region threshold to obtain a plurality of initial region sub-images.
[0124] The adjusting unit is used to dynamically adjust the initial region threshold according to the multiple initial region sub-graphs to obtain the region threshold.
[0125] The fourth generating unit is used to divide the sample sub-image by using the regional threshold value to obtain multiple regional sub-images.
[0126] Optionally, in one embodiment of the present application, the determining unit includes: an acquiring subunit and a determining subunit.
[0127] The acquisition subunit is used to acquire data information of two-dimensional entropy of the image.
[0128] The determination subunit is used to determine the initial area threshold according to the data information.
[0129] Optionally, in one embodiment of the present application, the expression of the two-dimensional entropy of the image may be, but is not limited to,: , in, is the gray value of the pixel, Neighborhood grayscale value, is the gray value at the image position and its neighboring grayscale value Comprehensive characteristics of distribution.
[0130] It should be noted that the above explanation of the embodiment of the crash screenshot image compression method is also applicable to the crash screenshot image compression device of this embodiment, and will not be repeated here.
[0131] According to the downtime screenshot image compression device proposed in the embodiment of the present application, the downtime screenshot image to be compressed can be segmented to obtain sample sub-images, and the corresponding sample sub-images can be divided into multiple regional sub-images 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 downtime screenshot image. The compression strategy can be adaptively adjusted according to different regional sub-images, while effectively reducing the amount of image data, the main features of the image are maintained, and by improving the loss function of the variational autoencoder and the convolutional autoencoder, the storage space occupied is reduced, the quality of the compressed image is guaranteed, and precious memory resources are saved. In this way, the problems of limited recognition accuracy, low coding efficiency, poor flexibility, and inability to adapt to the processing of high-resolution videos or complex scenes in the related technology are solved.
[0132] The description of the features in the embodiment corresponding to the downtime screenshot image compression device can refer to the relevant description of the embodiment corresponding to the downtime screenshot image compression method, which will not be repeated here.
[0133] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned embodiments of the downtime screenshot image compression method.
[0134] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned embodiments of the downtime screenshot image compression method when running.
[0135] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0136] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned embodiments of the downtime screenshot image compression method are implemented.
[0137] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, implementing the steps in any of the above-mentioned embodiments of the downtime screenshot image compression method.
[0138] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0139] The above is a detailed introduction to a method for compressing screenshot images during downtime provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection 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; 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; The corresponding sample sub-image is divided into a plurality of region sub-images by using the two-dimensional entropy of the image, and each of the region sub-images is respectively input into a corresponding variational autoencoder or a convolutional autoencoder to output a compressed downtime screenshot image.
2. The method for compressing downtime screenshot images according to claim 1, characterized in that: The multiple region sub-images include a text region sub-image and a background region sub-image, wherein each region sub-image is input into a corresponding variational autoencoder or a convolutional autoencoder to output a compressed downtime screenshot image, including: 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.
3. The method for compressing downtime screenshot images according to claim 2, 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.
4. The method for compressing downtime screenshot images according to claim 2, 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.
5. 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.
6. The method for compressing downtime screenshot images according to claim 5, 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.
7. 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.
8. 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.
9. The method for compressing downtime screenshot images according to claim 8, 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.
10. 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.
11. 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; The output module is used to divide the corresponding sample sub-image into multiple regional sub-images by using the two-dimensional entropy of the image, and input each regional sub-image into the corresponding variational autoencoder or convolutional autoencoder to output a compressed downtime screenshot image.
12. The downtime screenshot image compression device according to claim 11, characterized in that: The plurality of area sub-images include a text area sub-image and a background area sub-image, wherein 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.
13. The downtime screenshot image compression device according to claim 12, 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.
14. 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 10.
15. 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-10.
Citation Information
Patent Citations
Image classification method and system
CN114818903A
Video abnormal behavior detection method and system based on automatic encoder
CN114913599A
Downtime video processing method and device, electronic equipment and storage medium
CN116310948A
Text generation method based on variational auto-encoder and diffusion model
CN119088948A
Anomaly detection method and system for multi-source heterogeneous data
WO2025039300A1