Marketing terminal power image compression method and system based on graph segmentation technology
Through the method based on graph segmentation technology, key feature areas in the power meter image are identified and segmented and losslessly compressed, the problem of excessive traffic charges caused by frequent upload of power meter images by marketing terminals is solved, and the data transmission volume is reduced and the transmission efficiency is improved.
Patent Information
- Application Number
- CN202510308986.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-06-13
AI Technical Summary
The transmission traffic problems caused by the super-large data sets caused by the frequent upload of power meter images of marketing terminals, resulting in excessive traffic charges.
Using a method based on graph segmentation technology, the boundary line of the power meter is identified through an edge detection algorithm, and the image segmentation is used for image segmentation, the key feature areas of the power meter are separated, and losslessly compressed, and other areas are lost to be compressed, combining them into the compressed image.
It effectively reduces the amount of data transmission, reduces traffic charges, improves transmission efficiency, optimizes the size of image files, and reduces storage space requirements.
Smart Images

Figure CN120147343A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image compression, and more specifically, to a marketing terminal power image compression method and system based on graph segmentation technology. Background Art
[0002] To accelerate the construction of marketing digitization, a certain region has successively or will equip meter reading personnel in each business hall with marketing terminals, and the marketing terminal equipment effectively supports the on-site service work requirements of front-line staff in business halls. However, in the actual application process, the following problems are faced:
[0003] Excessive traffic charges for marketing terminals: There are approximately 70,000 existing marketing terminals. The current main operation mode of marketing terminals is that marketing meter reading personnel manually take pictures of meters and upload them to the marketing system for meter reading identification. The current household registration number in a certain region is approximately 25 million, and the application frequency of marketing terminals has also increased sharply, and it has already faced the problem of transmission traffic caused by ultra-large datasets. According to statistics, calculated at the frequency of taking one electric meter image per month, the total number of images taken in a year can reach 300 million images. Calculated at 1MB per image, the annual transmission traffic is as high as 286TB. Based on the cost of 10 yuan / G for APN transmission traffic, the annual transmission traffic cost is expected to reach 2.93 million yuan. Therefore, there is an urgent need for a marketing terminal power image compression method and system based on graph segmentation technology to solve the problem of excessive traffic charges for marketing terminals. Summary of the Invention
[0004] In view of the problems in the related art, the present invention proposes a marketing terminal power image compression method and system based on graph segmentation technology to overcome the above technical problems existing in the existing related technologies.
[0005] The present invention adopts the following technical solutions.
[0006] The first aspect of the present invention proposes a marketing terminal power image compression method based on graph segmentation technology, which is characterized by including the following:
[0007] Obtain an electric meter image, standardize it, use an edge detection algorithm to identify the boundary line of the electric meter, and perform affine transformation or projective transformation after filtering the boundary line information;
[0008] Use the boundary line information to perform local enhancement on the standardized electric meter image, and based on a pre-trained U-Net model, perform image segmentation on the locally enhanced electric meter image to obtain the key feature region of the electric meter image;
[0009] Perform region optimization on the key feature region to obtain an optimized key image region;
[0010] Perform lossless compression on the optimized key image region, perform lossy compression on other regions in the electric meter image, and combine the two compressed images to obtain the compressed marketing terminal electric power image.
[0011] Preferably, the edge detection algorithm is the Canny edge detection algorithm. Use this edge detection algorithm to extract the edge information of the image to obtain an edge image, convert the edge image into a binary image, and use the findContours function of the computer vision and machine learning library to detect the contour in the binary image to identify the boundary line of the electric meter, and project the boundary line information onto the Cartesian coordinate system.
[0012] Preferably, perform affine transformation or projective transformation after filtering the boundary line information. Specifically:
[0013] Calculate the area and perimeter of the boundary line. If the area and aspect ratio are not within the range of the area and aspect ratio of the set electric meter, then filter out this boundary line. Otherwise, calculate the circularity of the boundary line by calculating the area and perimeter of the boundary line. If the circularity is lower than the set circularity threshold, then calculate the number of corner points of the boundary line by the polygon approximation method. If the number of its corner points exceeds the set corner point threshold, then filter out this boundary line;
[0014] The affine transformation or projective transformation is to multiply the boundary line by the corresponding set transformation matrix.
[0015] Preferably, using the boundary line information to perform local adjustment on the image is to enhance the contrast or brightness of the region marked by the boundary line information or to weight each pixel of the electric meter image. The weight of the region marked by the boundary line information is large, and the weight of other regions is small.
[0016] Preferably, the key feature regions include: digital display region, pointer, outer frame boundary, buttons and knobs; the U-Net model includes an encoder, a decoder and an output layer; there is a skip connection between the encoder and the decoder. The feature map output by the decoder is the same size as the image of the original electric meter image. The output layer uses a 1*1 convolution to map the number of channels of the feature map output by the decoder to the number of categories of the key feature regions, and uses the Softmax activation function to generate the probability map of each pixel of the original electric meter image for various key feature regions, so as to determine all key feature regions.
[0017] Preferably, perform regional optimization on the key feature regions to obtain the optimized key image region. Specifically:
[0018] Extract the boundary lines of all key feature regions, offset them according to the set coefficients, and smooth the key feature regions through opening and closing operations in morphological operations. Extract pixel feature vectors from each pixel of the smoothed key feature regions and perform normalization processing. Use principal component analysis to reduce the dimension of the normalized pixel feature vectors; for each pixel of the smoothed key feature regions, cluster them using the corresponding reduced-dimension pixel feature vectors, and optimize the clustering results through the simulated annealing algorithm. Use the pixel feature vectors of the optimized cluster centers to replace the pixel feature vectors of all pixels within the corresponding clusters of the cluster centers.
[0019] Preferably, the pixel feature vectors include color information and spatial position information. The color information is RGB value, HSV or Lab value, and the spatial information is the two-dimensional coordinates of the pixel.
[0020] Preferably, the using principal component analysis to reduce the dimension of the normalized pixel feature vectors is specifically as follows:
[0021] Calculate the covariance matrix of the normalized pixel feature vectors, perform eigenvalue decomposition on the covariance matrix to obtain a set of pixel eigenvalues and corresponding principal component vectors. Sort according to the magnitudes of the pixel eigenvalues, select the principal component vectors corresponding to the set K largest pixel eigenvalues, and multiply the pixel feature vectors by the matrix composed of the concatenation of these K selected principal component vectors to obtain the reduced-dimension pixel feature vectors.
[0022] Preferably, the optimizing the clustering results through the simulated annealing algorithm is specifically as follows:
[0023] Take the clustering labels and cluster centers of each pixel in the key feature regions as the initial state, set the simulated annealing parameters. The simulated annealing parameters include the initial temperature, cooling coefficient, temperature threshold, and maximum number of iterations, and construct an objective function. The constructed objective function is the weighted sum of the regional uniformity energy function, color consistency energy function, and edge intensity energy function, and the weights are set values;
[0024] Add random perturbations to the current state. The random perturbations include randomly moving the cluster centers, randomly swapping the clustering labels of pixels, merging clusters or splitting clusters; calculate the difference ΔE of the objective function before and after the random perturbations total , if the difference is less than 0, then take the state after adding the random perturbations as the state after this iteration, otherwise generate a random number between 0 and 1. If the random number is less than where T is the temperature corresponding to the current iteration number, and T is the initial temperature in the first iteration, then take the state after adding the random perturbations as the state after this iteration, otherwise take the state before adding the random perturbations as the state after this iteration;
[0025] Multiply the temperature corresponding to the current iteration number by the temperature reduction coefficient to obtain the temperature corresponding to the next iteration number, and repeat the above process until the temperature drops below the temperature threshold or reaches the maximum number of iterations and then stop.
[0026] Preferably, perform lossless compression on the optimized key image region, perform lossy compression on other regions in the electricity meter image, and combine the two compressed images to obtain the compressed marketing terminal electricity image, specifically as follows:
[0027] For lossless compression, use a lossless compression algorithm or an autoencoder for compression. The lossless compression algorithm is specifically the LZW algorithm;
[0028] For lossless compression based on the autoencoder, extract the feature data of the key feature region using the pre-trained autoencoder. After quantifying the feature data, use entropy coding technology to represent and compress the quantified feature data into a binary stream; for other regions in the electricity meter image, use the JPEG algorithm for lossy compression.
[0029] The second aspect of the present invention proposes a marketing terminal electricity image compression system based on graph segmentation technology using the method described in the first aspect of the present invention, including: a boundary line information acquisition module, a key feature region recognition module, a key feature region optimization module, and an electricity image partition compression module, characterized in that:
[0030] Boundary line information acquisition module: used to acquire the electricity meter image, standardize it, use an edge detection algorithm to identify the boundary line of the electricity meter, and perform affine transformation or projective transformation after filtering the boundary line information;
[0031] Key feature region recognition module: used to perform local enhancement on the standardized electricity meter image using the boundary line information, and perform image segmentation on the locally enhanced electricity meter image based on the pre-trained U-Net model to obtain the key feature region of the electricity meter image;
[0032] Key feature region optimization module: used to perform region optimization on the key feature region to obtain the optimized key image region;
[0033] Electricity image partition compression module: used to perform lossless compression on the optimized key image region, perform lossy compression on other regions in the electricity meter image, and combine the two compressed images to obtain the compressed marketing terminal electricity image.
[0034] The beneficial effects of the present invention are as follows. Compared with the prior art, (1) the present invention performs lossless and lossy compression on the power meter images. In particular, lossless compression is used for key image regions to ensure the integrity of important data, while lossy compression is used for non-critical regions, significantly reducing the overall size of the transmitted data. This method effectively reduces the data transmission volume. The autoencoder of the present invention further compresses the data by converting the power images into feature data representations while retaining the important information in the images. After image compression, the use of data traffic can be reduced, thereby reducing the traffic charges and solving the problem of excessive traffic charges for marketing terminals. The compressed form of the present invention can quickly transmit a large amount of image data under limited bandwidth, improving the transmission efficiency.
[0035] (2) The present invention uses an autoencoder and a compression algorithm to optimize the size of the image file, thereby reducing the storage space requirements. Through compression and encoding, the original image data is converted into a binary stream that is difficult to directly identify, increasing the data security.
[0036] (3) The present invention optimizes image segmentation and morphology through the U-Net model, and can accurately identify the important parts in the power meter images. The present invention optimizes the important parts through morphological operations and the use of a clustering annealing optimization algorithm. The clustering annealing optimization algorithm combines the global search ability of simulated annealing to avoid the clustering algorithm falling into local optima, thereby finding a more stable and accurate clustering result. For image segmentation, this can better retain and distinguish key feature regions. The optimization of key feature regions not only improves the accuracy of segmentation, but also reduces unnecessary details and noise, which provides a better basis for subsequent data compression. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flowchart of the method of the present invention;
[0038] Figure 2 is a framework diagram of the system of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0039] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. The embodiments described in this application are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the spirit of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
[0040] According to an embodiment of the present invention, a method and system for compressing power images of a marketing terminal based on graph segmentation technology are provided.
[0041] The present invention will be further described in conjunction with the accompanying drawings and specific embodiments.
[0042] As Figure 1 shown, Embodiment 1 of the present invention proposes a marketing terminal power image compression method based on graph segmentation technology, including the following content:
[0043] Obtain the power meter image, standardize it, use the edge detection algorithm to identify the boundary line of the power meter, and perform affine transformation or projective transformation after filtering the boundary line information;
[0044] It should be noted that standardizing the power meter image means adjusting all power meter images to the same size. In this embodiment, the specific size adopted is 512x512 pixels to eliminate resolution and scale differences.
[0045] Use the boundary line information to locally enhance the standardized power meter image, and based on the pre-trained U-Net model, perform image segmentation on the locally enhanced power meter image to obtain the key feature area of the power meter image;
[0046] Optimize the key feature area to obtain the optimized key image area;
[0047] Perform lossless compression on the optimized key image area, perform lossy compression on other areas in the power meter image, and combine the two compressed images to obtain the compressed marketing terminal power image.
[0048] Preferably, the edge detection algorithm is the Canny edge detection algorithm. Use this edge detection algorithm to extract the edge information of the image to obtain the edge image, convert the edge image into a binary image, and use the findContours function in the computer vision and machine learning library to detect the contours in the binary image to identify the boundary line of the power meter, and project the boundary line information onto the Cartesian coordinate system.
[0049] Preferably, after filtering the boundary line information and performing affine transformation, specifically:
[0050] Calculate the area and perimeter of the boundary line. If the area and aspect ratio are not within the range of the area and aspect ratio of the set power meter, then filter out this boundary line. Otherwise, calculate the circularity of the boundary line by calculating the area and perimeter of the boundary line. If the circularity is not lower than the set circularity threshold, it indicates that it may be a circular electric meter, so it is retained; if the circularity is lower than the set circularity threshold, then calculate the number of corner points of the boundary line by the polygon approximation method. If the number of corner points is small, it may be the frame of the electric meter. If the number of its corner points exceeds the set corner point threshold, it may be noise or irrelevant components, and filter out this boundary line;
[0051] It should be noted that the circularity calculation formula is where S is the area enclosed by the boundary line and C is the perimeter of the boundary line; the set circularity threshold is 0.9 and the set corner point threshold is 1;
[0052] The affine transformation or projective transformation is to multiply the boundary line by the corresponding set transformation matrix. The affine transformation only performs linear geometric operations such as scaling, rotation, translation, etc.; the perspective transformation performs non-linear transformation. When the image deformation is small or the shooting angle change is not large, the affine transformation is performed; when the shooting angle has a large inclination and the perspective effect is obvious, the perspective transformation is performed.
[0053] Preferably, the local adjustment of the image using the boundary line information is to enhance the contrast or brightness of the area marked by the boundary line information or to weight each pixel of the electricity meter image, with the weight being a set value, the weight of the area marked by the boundary line information being large and the weight of other areas being small. Specifically, the weight of the area marked by the boundary line information is set to 1 and the weight of other areas is set to 0.5.
[0054] Preferably, the key feature regions include: the digital display region, the pointer, the outer frame boundary, the buttons and the knobs; the U-Net model includes an encoder, a decoder and an output layer; there is a skip connection between the encoder and the decoder, the feature map output by the decoder is the same size as the image size of the original electricity meter image, and the output layer uses a 1*1 convolution to map the number of channels of the feature map output by the decoder to the number of categories of the key feature regions, and uses the Softmax activation function to generate the probability map of each pixel of the original electricity meter image for various key feature regions, so as to determine all key feature regions.
[0055] It should be noted that when using this model, it is necessary to ensure that the format, size and number of channels of the input image are the same as those used when training this model.
[0056] Specifically, the loss function of the U-Net model is a combined segmentation loss and boundary loss to form a composite loss function;
[0057] The formula of the load loss function is:
[0058] Ltotal = αLseg + βLIoU + γLHausdorff
[0059] where α, β, γ are the corresponding weighting coefficients. Lseg is the segmentation loss, LIoU is the IoU loss, and LHausdorff is the Hausdorff distance loss.
[0060] By calculating the comprehensive loss function \(L_{total}\), the model can update the weights according to the errors of the boundaries and segmentation results during each backpropagation. The segmentation loss mainly affects the accuracy of the overall pixel segmentation, while the boundary loss specifically guides the model to increase its attention and prediction accuracy for the boundary regions of the electricity meters.
[0061] It should be noted that the adjustment of these coefficients \(\alpha\), \(\beta\), and \(\gamma\) can be optimized according to the training performance. If the model's prediction for the boundary part is weak, \(\beta\) and \(\gamma\) can be increased to strengthen the influence of the boundary loss; if the overall segmentation accuracy is not high, \(\alpha\) can be increased.
[0062] Preferably, the regional optimization of the key feature regions to obtain the optimized key image regions is specifically as follows:
[0063] Extract the boundary lines of all key feature regions, perform offset processing on them according to the set coefficients, and perform smoothing processing on the key feature regions through opening and closing operations in morphological operations. Extract pixel feature vectors from each pixel of the smoothed key feature regions and perform normalization processing. Use principal component analysis to reduce the dimension of the normalized pixel feature vectors; for each pixel of the smoothed key feature regions, use the corresponding reduced-dimensional pixel feature vectors for clustering, and optimize the clustering results through the simulated annealing algorithm. Use the pixel feature vectors of the optimized cluster centers to replace the pixel feature vectors of all pixels within the corresponding clusters of the cluster centers.
[0064] It should be noted that the size of the coefficients set during offset is set according to the difference between the key feature regions and the mean of the pixels of the entire picture. Through offset, the contrast of the key regions can be enhanced, thus highlighting these regions.
[0065] The opening operation is used to remove small noise points, and the closing operation is used to fill holes. The combination of the two can enhance the target regions in the image and smooth the image.
[0066] Specifically, use the corresponding reduced-dimensional pixel feature vectors for clustering, adopting k-means clustering. The number of clustering clusters is obtained through calculation. First, calculate the total sum of squared distances after k-means clustering with different numbers of clustering clusters. Take the number of clustering clusters as the abscissa and the total sum of squared distances as the ordinate, draw the relationship graph between the two, and find the inflection point where the curve of the relationship graph shows a gentle decline. The number of clustering clusters at this inflection point is the final number of clustering clusters.
[0067] Preferably, the pixel feature vectors include color information and spatial position information. The color information is RGB value, HSV or Lab value, and the spatial information is the two-dimensional coordinates of the pixels.
[0068] Preferably, the dimensionality reduction processing of the standardized pixel feature vector by using principal component analysis is specifically as follows:
[0069] Calculate the covariance matrix of the standardized pixel feature vector, perform eigenvalue decomposition on the covariance matrix to obtain a set of pixel eigenvalues and corresponding principal component vectors, sort according to the magnitudes of the pixel eigenvalues, select the principal component vectors corresponding to the set K largest pixel eigenvalues, and multiply the pixel feature vector by the matrix composed of the concatenation of these K selected principal component vectors to obtain the pixel feature vector with reduced dimensions.
[0070] Specifically, calculate the covariance matrix Cov of the standardized pixel feature vector. If X is the standardized pixel feature vector, then the covariance matrix Cov is:
[0071]
[0072] In the formula, X is the standardized pixel feature vector, X T is the transpose of X, and n represents the total number of all pixel feature vectors.
[0073] Perform eigenvalue decomposition on the covariance matrix to obtain a set of pixel eigenvalues and corresponding principal component vectors. The pixel eigenvalue corresponding to each principal component vector represents the variance explained by this principal component.
[0074] Sort according to the magnitudes of the pixel eigenvalues, and select the principal component vectors corresponding to the set K larger pixel eigenvalues.
[0075] After reducing the dimensions of the original pixel feature vector using the selected principal components.
[0076] The pixel feature vector X' with reduced dimensions is:
[0077] X' = X[W 1 W 2 ...W k ...W K
[0078] where W k is the k-th selected principal component vector.
[0079] Preferably, the optimization of the clustering result by using the simulated annealing algorithm is specifically as follows:
[0080] Take the clustering label and clustering center of each pixel in the key feature region as the initial state, set the simulated annealing parameters, where the simulated annealing parameters include the initial temperature, cooling coefficient, temperature threshold, and maximum number of iterations, and construct an objective function. The constructed objective function is the weighted sum of the regional uniformity energy function, color consistency energy function, and edge intensity energy function, and the weights are set values;
[0081] Specifically, the objective function E total is calculated as follows:
[0082] E total = w 1 E uniformity + w 2 E color + w 3 E edge
[0083] In the formula, E uniformity , E color , and E edge are the regional uniformity energy function, the color consistency energy function, and the edge strength energy function, respectively; w 1 , w 2 , and w 3 are the weight coefficients of the regional uniformity energy function, the weight coefficient of the color consistency energy function, and the weight coefficient of the edge strength energy function, respectively; set in this embodiment; w 1 , w 2 , and w 3 are 0.4, 0.4, and 0.2, respectively. The color information and the spatial position information
[0084] Among them, the regional uniformity energy function is the sum of the squares of the Euclidean distances between the spatial position information of all pixels and the spatial position information of the corresponding cluster centers.
[0085] The color consistency energy function is the sum of the squares of the Euclidean distances between the color information of all pixels and the color information of the corresponding cluster centers.
[0086] The edge strength energy function is the sum of the squares of the Euclidean distances between the edge strength of all pixels and the color information of the corresponding cluster centers, and the edge strength is the gradient of the pixel in the horizontal and vertical directions.
[0087] Add a random perturbation to the current state, where the random perturbation includes randomly moving the cluster centers, randomly swapping the cluster labels of pixels, merging clusters, or splitting clusters; calculate the difference ΔE total of the objective function before and after the random perturbation. If the difference is less than 0, then use the state after adding the random perturbation as the state after this iteration. Otherwise, generate a random number between 0 and 1. If the random number is less than where T is the temperature corresponding to the current iteration number, and T is the initial temperature in the first iteration, then use the state after adding the random perturbation as the state after this iteration. Otherwise, use the state before adding the random perturbation as the state after this iteration;
[0088] Multiply the temperature corresponding to the current iteration number by the temperature reduction coefficient to obtain the temperature corresponding to the next iteration number, and repeat the above process until the temperature drops below the temperature threshold or reaches the maximum number of iterations and then stop.
[0089] Preferably, perform lossless compression on the optimized key image region, perform lossy compression on other regions in the electricity meter image, and combine the two compressed images to obtain the compressed marketing terminal electricity image, specifically as follows:
[0090] Lossless compression is performed using a lossless compression algorithm or an autoencoder. The lossless compression algorithm is specifically the LZW algorithm;
[0091] Performing lossless compression based on the autoencoder is to use the pre-trained autoencoder to extract the feature data of the key feature region. After quantifying the feature data, use entropy coding technology to compress the quantified feature data representation into a binary stream; use the JPEG algorithm to perform lossy compression on other regions in the electricity meter image.
[0092] It should be noted that the feature data refers to a set of feature vectors obtained by learning through the autoencoder, which represents the input data (pixel values of the key image region) abstracted and compressed by the encoder. Quantification is to convert floating-point features into discrete values. It should be noted that although this method is called lossless compression, in actual operation, due to the existence of the quantization process, certain errors may be introduced. Strictly speaking, it is not completely lossless, but a high-precision quantization method can be designed to minimize the loss to meet the requirements of lossless compression.
[0093] As Figure 2 shown, Embodiment 2 of the present invention proposes a marketing terminal electricity image compression system based on graph segmentation technology using the method described in the first aspect of the present invention, including: a boundary line information acquisition module, a key feature region recognition module, a key feature region optimization module, and a power image partition compression module, characterized in that:
[0094] The boundary line information acquisition module: used to acquire the electricity meter image, standardize it, use an edge detection algorithm to identify the boundary line of the electricity meter, and perform affine transformation after filtering the boundary line information;
[0095] The key feature region recognition module: used to perform local enhancement on the standardized electricity meter image using the boundary line information, and perform image segmentation on the locally enhanced electricity meter image based on the pre-trained U-Net model to obtain the key feature region of the electricity meter image;
[0096] The key feature region optimization module: used to perform region optimization on the key feature region to obtain the optimized key image region;
[0097] Power image partition compression module: It is used to perform lossless compression processing on the optimized key image area, perform lossy compression on other areas in the power meter image, and combine the two compressed images to obtain the compressed power image of the marketing terminal.
[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the specific implementation manners of the present invention or make equivalent replacements, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A marketing terminal power image compression method based on graph segmentation technology, characterized in that: Includes the following: Obtain an image of a power meter, standardize it, use an edge detection algorithm to identify the boundary line of the power meter, and perform an affine transformation or a projective transformation after filtering the boundary line information; The standardized power meter image is locally enhanced using boundary line information, and the locally enhanced power meter image is segmented based on a pre-trained U-Net model to obtain the key feature areas of the power meter image. Perform regional optimization on the key feature area to obtain an optimized key image area; The optimized key image area is subjected to lossless compression, and other areas in the power meter image are subjected to lossy compression. The two compressed images are combined to obtain a compressed marketing terminal power image.
2. According to claim 1, a marketing terminal power image compression method based on graph segmentation technology is characterized in that: The edge detection algorithm is a Canny edge detection algorithm, which is used to extract edge information of an image to obtain an edge image, convert the edge image into a binary image, use the findContours function of a computer vision and machine learning library to detect contours in the binary image to identify the boundary line of the power meter, and project the boundary line information into a Cartesian coordinate system.
3. According to claim 2, a marketing terminal power image compression method based on graph segmentation technology is characterized in that: The filtering of the boundary line information and then performing an affine transformation or a projective transformation are specifically as follows: Calculate the area and perimeter of the boundary line. If the area and length-to-width ratio are not within the set area and length-to-width ratio range of the power meter, filter out the boundary line. Otherwise, calculate the circularity of the boundary line by calculating the area and perimeter of the boundary line. If the circularity is lower than the set circularity threshold, calculate the number of corner points of the boundary line by polygon approximation. If the number of corner points exceeds the set corner point threshold, filter out the boundary line. Affine transformation or projective transformation is to multiply the boundary line by the corresponding set transformation matrix.
4. According to claim 3, a marketing terminal power image compression method based on graph segmentation technology is characterized in that: The local adjustment of the image using the boundary line information is to enhance the contrast or brightness of the area marked by the boundary line information or to weight each pixel of the power meter image, the weight is a set value, the area marked by the boundary line information has a large weight, and other areas have a small weight.
5. The marketing terminal power image compression method based on graph segmentation technology according to claim 1 is characterized by: The key feature areas include: digital display area, pointer, outer frame boundary, button and knob; the U-Net model includes an encoder, a decoder and an output layer; the encoder and the decoder are connected by jump connection, the feature map output by the decoder is consistent with the image size of the original power meter image, the output layer uses 1*1 convolution to map the number of channels of the feature map output by the decoder to the number of categories of the key feature area, and uses the Softmax activation function to generate a probability map of each pixel of the original power meter image being various key feature areas, thereby determining all key feature areas.
6. The marketing terminal power image compression method based on graph segmentation technology according to claim 5 is characterized by: The key feature area is optimized to obtain an optimized key image area, specifically: The boundary lines of all key feature areas are extracted, and biased according to the set coefficients. The key feature areas are smoothed through the opening and closing operations in the morphological operations. The pixel feature vector is extracted from each pixel in the smoothed key feature area and standardized. The standardized pixel feature vector is reduced in dimension using principal component analysis. For each pixel in the smoothed key feature area, the corresponding pixel feature vector with reduced dimension is used for clustering, and the clustering results are optimized through the simulated annealing algorithm. The pixel feature vector of the optimized cluster center is used to replace the pixel feature vectors of all pixels in the cluster corresponding to the cluster center.
7. The marketing terminal power image compression method based on graph segmentation technology according to claim 6 is characterized by: The pixel feature vector includes color information and spatial position information. The color information is RGB value, HSV or Lab value, and the spatial information is the two-dimensional coordinates of the pixel.
8. The marketing terminal power image compression method based on graph segmentation technology according to claim 6 is characterized by: The principal component analysis is used to perform dimensionality reduction processing on the standardized pixel feature vector, specifically: Calculate the covariance matrix of the standardized pixel feature vector, perform eigenvalue decomposition on the covariance matrix, obtain a set of pixel eigenvalues and corresponding principal component vectors, sort them according to the size of the pixel eigenvalues, select the principal component vectors corresponding to the set K largest pixel eigenvalues, and multiply the pixel feature vector by the matrix formed by the splicing of the K selected principal component vectors to obtain the pixel feature vector with reduced dimension.
9. The marketing terminal power image compression method based on graph segmentation technology according to claim 6 is characterized by: The clustering results are optimized by the simulated annealing algorithm, specifically: The cluster label and cluster center of each pixel in the key feature area are taken as the initial state, and the simulated annealing parameters are set. The simulated annealing parameters include the initial temperature, the cooling coefficient, the temperature threshold and the maximum number of iterations. The objective function is constructed as the weighted sum of the regional uniformity energy function, the color consistency energy function and the edge intensity energy function, and the weight is the set value; Adding random perturbations to the current state, wherein the random perturbations include randomly moving cluster centers, randomly exchanging cluster labels of pixels, merging clusters, or splitting clusters; Calculate the difference ΔE of the objective function before and after random disturbance total , if the difference is less than 0, the state after random perturbation will be added as the state after this iteration, otherwise a random number between 0 and 1 is generated. If the random number is less than Where T is the temperature corresponding to the current iteration number. In the first iteration, T is the initial temperature. Then the state after random disturbance is added as the state after this iteration. Otherwise, the state before random disturbance is added as the state after this iteration. The temperature corresponding to the current iteration number is multiplied by the temperature reduction coefficient to obtain the temperature corresponding to the next iteration number. The above content is repeated until the temperature drops below the temperature threshold or the maximum number of iterations is reached.
10. The marketing terminal power image compression method based on graph segmentation technology according to claim 1 is characterized by: The optimized key image area is subjected to lossless compression, the other areas in the power meter image are subjected to lossy compression, and the two compressed images are combined to obtain a compressed marketing terminal power image, specifically: Lossless compression uses a lossless compression algorithm or an automatic encoder for compression, and the lossless compression algorithm is specifically the LZW algorithm; The lossless compression processing based on the autoencoder is to use the pre-trained autoencoder to extract the feature data of the key feature area, quantize the feature data, and then use the entropy coding technology to compress the quantized feature data into a binary stream; the JPEG algorithm is used to perform lossy compression on other areas in the power meter image.
11. A marketing terminal power image compression system based on graph segmentation technology using the method according to any one of claims 1 to 10, comprising: The boundary line information acquisition module, the key feature area recognition module, the key feature area optimization module and the power image partition compression module are characterized by: Boundary line information acquisition module: used to acquire the power meter image, standardize it, use the edge detection algorithm to identify the boundary line of the power meter, and filter the boundary line information and perform affine transformation or projection transformation; Key feature area recognition module: used to locally enhance the standardized power meter image using boundary line information, and to segment the locally enhanced power meter image based on a pre-trained U-Net model to obtain the key feature area of the power meter image; Key feature area optimization module: used to optimize the key feature area to obtain the optimized key image area; Power image partition compression module: used to perform lossless compression on the optimized key image area, perform lossy compression on other areas in the power meter image, and combine the two compressed images to obtain a compressed marketing terminal power image.