High-efficiency video compression method for AI gateways in edge computing

By extracting video image feature vectors from an AI gateway in edge computing, deleting unimportant images, and performing clustering and block encoding replacement, the problem of low compression rate in existing technologies is solved, achieving efficient video compression.

CN120676183BActive Publication Date: 2025-10-31BEIJING GUOWANG SHENGYUAN INTELLIGENT TERMINAL SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511186592.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-10-31
Estimated Expiration
2045-08-25

AI Technical Summary

Technical Problem

Existing technologies for compressing video data in edge computing AI gateways suffer from low compression rates, especially when there are many similar images in the video, resulting in the retention of redundant data.

Method used

By extracting feature vectors from video images, deleting unimportant images, clustering and dividing the data into blocks, using pixel differences for encoding replacement, and finally compressing the data using the H.264 video encoding algorithm.

Benefits of technology

It improves video compression rate while ensuring high fidelity of key content, and reduces video size and computational load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120676183B_ABST
    Figure CN120676183B_ABST
Patent Text Reader

Abstract

This invention relates to the field of video compression technology, specifically to a high-efficiency video compression method for AI gateways oriented towards edge computing. The method includes: acquiring a target video to be compressed; clustering all images in the target video to obtain various clusters; obtaining feature index values ​​corresponding to each image in a cluster based on the difference index values ​​between each image in the cluster and the other images within the cluster; obtaining the number of blocks corresponding to the cluster based on the feature index values; dividing each image in the corresponding cluster into sub-blocks based on the number of blocks corresponding to the cluster; encoding and replacing the sub-blocks in the images of the cluster based on the pixel differences between any two sub-blocks in the cluster, obtaining a replaced video; and compressing the replaced video to obtain compressed data. Furthermore, this invention can improve the compression rate while maintaining high fidelity for critical content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video compression technology, and more specifically to an efficient video compression method for AI gateways oriented towards edge computing. Background Technology

[0002] Currently, edge gateway devices with intelligent computing capabilities are typically deployed at the network edge, close to data sources (such as cameras and industrial equipment). These are AI gateways designed for edge computing, used to efficiently compress video data, thereby reducing bandwidth consumption and storage overhead. However, current technologies typically compress each frame of the video directly using existing compression strategies. This method retains a large amount of redundant data, resulting in a low compression ratio. For example, if a video contains many similar images, directly encoding and compressing each frame using existing algorithms will generate a significant amount of redundant data, further contributing to the low compression ratio. Therefore, improving the compression effect of the video compression module built into the AI ​​gateway when compressing captured videos is a pressing issue. Summary of the Invention

[0003] To address the aforementioned issues, this invention provides a high-efficiency video compression method for AI gateways oriented towards edge computing. The specific technical solution adopted is as follows:

[0004] One embodiment of the present invention provides a method for efficient video compression of AI gateways for edge computing, comprising the following steps:

[0005] Obtain the initial video to be compressed, and extract the feature vectors corresponding to each image in the initial video to be compressed;

[0006] Based on the difference index value between the images in the initial video to be compressed, the unimportant images in the initial video to be compressed are deleted to obtain the target video to be compressed.

[0007] All images in the target video to be compressed are clustered to obtain various clusters; based on the difference index values ​​between each image in the cluster and the other images in the cluster, the feature index values ​​corresponding to each image in the cluster are obtained, and based on the feature index values, the number of blocks corresponding to the cluster is obtained; based on the number of blocks corresponding to the cluster, each image in the corresponding cluster is divided to obtain each sub-block on each image in the cluster;

[0008] Based on the pixel difference between any two sub-blocks in the cluster, the sub-blocks on the image in the cluster are encoded and replaced to obtain the replaced video, and the replaced video is compressed to obtain compressed data.

[0009] Beneficial Effects: This invention first acquires the initial video to be compressed and extracts the feature vectors corresponding to each image in the initial video. Then, based on the difference index values ​​between the images in the initial video, unimportant images are deleted, resulting in the target video to be compressed. Next, all images in the target video are clustered to obtain clusters. Based on the difference index values ​​between each image in a cluster and the remaining images within that cluster, feature index values ​​are obtained for each image in the cluster. Based on these feature index values, the number of blocks corresponding to each cluster is determined. Based on this number of blocks, each image in the corresponding cluster is divided into sub-blocks. Finally, based on the pixel differences between any two sub-blocks in a cluster, the sub-blocks in the images of the cluster are encoded and replaced to obtain the replaced video. The replaced video is then compressed to obtain compressed data. Furthermore, this invention, through image segmentation and encoding replacement of sub-blocks in clusters based on pixel differences, can improve the compression rate while maintaining high fidelity for critical content. Attached Figure Description

[0010] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a flowchart of an AI gateway video high-efficiency compression method for edge computing according to the present invention. Detailed Implementation

[0012] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention are within the protection scope of the embodiments of the present invention.

[0013] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art.

[0014] This embodiment provides a high-efficiency video compression method for AI gateways oriented towards edge computing, detailed as follows:

[0015] like Figure 1As shown, this efficient video compression method for AI gateways oriented towards edge computing includes the following steps:

[0016] Step S001: Obtain the initial video to be compressed and extract the feature vectors corresponding to each image in the initial video to be compressed; based on the difference index values ​​between the images in the initial video to be compressed, delete the unimportant images in the initial video to be compressed to obtain the target video to be compressed.

[0017] The purpose of this embodiment is to improve the compression effect of video data, so as to ensure the high fidelity of key content while effectively reducing the video size. Therefore, this embodiment first needs to acquire the video to be compressed and record it as the initial video to be compressed. In this embodiment, the initial video to be compressed is video data acquired in real time by the gateway device deployed at the network edge. The video data to be compressed mainly comes from the access cameras, industrial monitoring terminals or other video acquisition devices. Then, the video compression module built into the AI ​​gateway will parse and efficiently compress the acquired video, and transmit the compressed data in real time, cache it on the edge side or upload it to the cloud storage to reduce network bandwidth consumption and storage pressure. That is, the subsequent video compression process in this embodiment is performed in the video compression module built into the AI ​​gateway.

[0018] Furthermore, directly using existing compression methods or strategies to compress the initial video will result in a large amount of redundant data being retained, leading to a low compression ratio. To improve the compression ratio, this embodiment requires processing the initial video first, specifically deleting unimportant images to obtain the target video to be compressed. The target video is then analyzed and compressed. The specific process for obtaining the target video to be compressed is as follows:

[0019] First, feature extraction is performed on each frame of the initial video to be compressed to obtain the feature vector corresponding to each image in the initial video to be compressed. In specific applications, the implementer can choose the method of image feature extraction according to the actual situation. For example, existing methods such as convolutional neural networks can be used to extract image features. Since the process of image feature extraction using existing methods such as convolutional neural networks is well known, it will not be described in detail in this embodiment.

[0020] After obtaining the feature vectors corresponding to each image in the initial video to be compressed, the difference index value between any two images is calculated based on the feature vectors corresponding to each image. The difference index value between any two images is the result of negatively correlated mapping of the similarity between the feature vectors corresponding to the two images. For example, for images v1 and v2, which are not the same image, the cosine similarity between the feature vectors corresponding to image v1 and the feature vectors corresponding to image v2 is calculated, and a negative correlation mapping is performed on the cosine similarity between the feature vectors corresponding to image v1 and the feature vectors corresponding to image v2. The mapping result is recorded as the difference index value between image v1 and image v2. Since the value range of the cosine similarity between vectors is from -1 to 1, and the closer it is to 1, the more similar they are, this embodiment chooses to use a constant 1 to implement the negative correlation mapping of the cosine similarity. That is, the result of constant 1-S is used as the difference index value between image v1 and image v2, where S is the cosine similarity between the feature vectors corresponding to image v1 and the feature vectors corresponding to image v2.

[0021] Since the initial video to be compressed may contain consecutively repeated or minimally changing video frames, it is necessary to delete these less important frames to reduce the size of the compressed video and the subsequent computational load. Therefore, after obtaining the difference index values ​​between the images, less important images in the initial video to be compressed are deleted based on these values, resulting in the target video to be compressed. In this embodiment, less important images refer to images similar to other images or images with consecutively repeated or minimally changing features. The specific process of deleting less important images in the initial video to be compressed based on the difference index values ​​to obtain the target video to be compressed is as follows:

[0022] First, the initial video to be compressed is designated as the first video. Then, the images in the first video are marked, and it is determined whether there are any images marked as unimportant. If so, all unimportant images in the first video are deleted, and the deleted first video is designated as the second video. The process is repeated, marking the images in the second video and deleting them, and the deleted second video is designated as the third video. This process continues until no unimportant images are found in the newly acquired video, at which point the deletion stops, and the newly acquired video is designated as the target video to be compressed. For example, if no unimportant images are found in the third video, then the third video can be directly used as the target video to be compressed.

[0023] Since the method for tagging any video is the same—that is, the method for tagging images in the first video, the second video, and the third video is all the same—this embodiment will, for ease of understanding, describe the specific process of tagging images in the first video as an example. The specific process of tagging images in the first video is as follows:

[0024] First, determine whether the importance index value of the second frame of the first video is greater than a preset importance threshold. If it is, continue to determine whether the importance index value of the third frame of the first video is greater than the preset importance threshold. If it is not greater, mark the third frame of the first video as unimportant, and continue to determine whether the importance index value of the fifth frame of the first video is greater than the preset importance threshold. If it is, continue to determine whether the importance index value of the sixth frame of the first video is greater than the preset importance threshold. If it is not greater, mark the sixth frame of the first video as unimportant, and continue to determine whether the importance index value of the eighth frame of the first video is greater than the preset importance threshold, and so on, until the second to last frame of the first video is reached and the marking stops.

[0025] It should be noted that when the importance index value of a frame in a video is higher, it indicates that the similarity between that frame and its adjacent frames is lower. This means that the frame does not have continuous repetition or small adjacent changes, thus indicating that the frame is more important and should not be deleted. Conversely, when the importance index value of a frame in a video is lower, it indicates that the similarity between that frame and its adjacent frames is higher. This means that the frame has continuous repetition or small adjacent changes, thus indicating that the frame is less important and should be deleted to reduce subsequent computation and lower the compression ratio.

[0026] Since the method for obtaining the importance representation value of any image in any video is the same, and for ease of understanding, this embodiment will subsequently describe the process of obtaining the importance representation value of the second frame image in the first video as an example. Therefore, the specific process for obtaining the importance representation value of the second frame image in the first video is as follows:

[0027] First, the difference index value between the first frame and the second frame of the first video is obtained and recorded as the first index value. Then, the difference index value between the second frame and the third frame of the first video is obtained and recorded as the second index value. The mean of the first index value and the second index value is calculated and recorded as the importance representation value of the second frame of the first video. That is, the method for obtaining the importance representation value of any frame in any video is the same as the method for obtaining the importance representation value of the second frame of the first video.

[0028] Furthermore, in this embodiment, the implementer needs to set a preset importance threshold based on actual conditions such as video type, image change characteristics, and playback smoothness requirements. A smaller preset importance threshold retains more frames, resulting in a lower compression rate but ensuring playback continuity. A larger preset importance threshold increases the compression rate but may discard some subtly different frames, affecting the smooth playback experience. For example, for fixed surveillance videos with many static scenes and low playback smoothness requirements, there are many continuously repeating or adjacent images with minimal changes. In this case, the preset importance threshold can be set larger to remove a large number of redundant frames; for example, the preset importance threshold for such videos can be set between 0.02 and 0.05. For a small number of dynamic scenes with traffic or pedestrian flow and intelligent traffic monitoring videos with moderate playback smoothness requirements, motion frames need to be retained to avoid losing event details. Therefore, the preset importance threshold cannot be set too large; for example, the preset importance threshold for such videos can be set to 0. For video conferencing or live streaming with moderately dynamic scenes such as people speaking and medium to high requirements for smooth playback, it is necessary to ensure the continuity of speaking actions and reduce visual frame skipping. Therefore, the preset importance threshold needs to be set relatively small, such as between 0.005 and 0.01. For sports events or sports videos with high-speed movement, rapid scene changes, and high requirements for smooth playback, high fidelity preservation is required to avoid affecting action details and viewing experience. Therefore, the preset importance threshold needs to be set relatively small, such as between 0.001 and 0.005. For film and entertainment or short videos with frequent scene transitions, many details, and extremely high requirements for smooth playback, it is necessary to ensure consistency in image quality and visual experience. Therefore, the preset importance threshold needs to be set extremely small, such as less than 0.001.

[0029] Therefore, this embodiment can obtain the target video to be compressed through the above process.

[0030] Step S002: Cluster all images in the target video to be compressed to obtain various clusters; obtain feature index values ​​corresponding to each image in the cluster based on the difference index values ​​between each image in the cluster and the other images in the cluster, and obtain the block number parameter corresponding to the cluster based on the feature index values; divide each image in the corresponding cluster according to the block number parameter corresponding to the cluster to obtain each sub-block on each image in the cluster.

[0031] In this embodiment, after obtaining the target video to be compressed, in order to further improve the compression ratio and reduce the size of the compressed video, the images in the target video to be compressed are clustered, and the clustering results are analyzed. Based on the analysis results, the images in the clusters are divided into blocks. After block division, the sub-blocks with the same pixels are coded and replaced. After replacement, compression is performed. Since the coded and replaced sub-blocks do not need to participate in compression, only the replaced codes are saved. Therefore, the purpose of improving the compression ratio and reducing the size of the compressed video can be achieved. Therefore, based on the above description, this embodiment needs to first cluster the images in the target video to be compressed to obtain each cluster. The specific process of clustering the images in the target video to be compressed to obtain each cluster is as follows:

[0032] First, the HDBSCAN clustering algorithm is used to cluster the images in the target video to be compressed, resulting in various clusters. Since the images in the same cluster have certain similarity or repetitive features, this embodiment subsequently analyzes the amount of repetitive regions or the obviousness of repetitive features between images within the cluster to determine how to divide the images in each cluster into blocks. After block division, repetitive sub-blocks or sub-blocks with equal pixels are replaced. Furthermore, the HDBSCAN clustering algorithm is a density-based hierarchical clustering algorithm, which is an improved and extended version of the DBSCAN clustering algorithm. The clustering process of this algorithm is a well-known technique and will not be described in detail here. In addition, when clustering the images in the target video to be compressed, the distance between the images used for clustering is the difference index value between the images.

[0033] After obtaining each cluster, the feature index value corresponding to each image in each cluster is obtained based on the difference index value between each image in each cluster and the other images in the cluster. The feature index value is used to reflect the amount of repeated regions or the significance of repeated features among images in the cluster. The specific calculation process of the feature index value corresponding to each image in each cluster is as follows:

[0034] For any image h in any cluster H, the set of all images remaining in cluster H except image h is denoted as the set to be analyzed for image h. The set of difference index values ​​between image h and each image in the set to be analyzed for image h is denoted as the set of difference index values ​​corresponding to image h. The mean of the set of difference index values ​​corresponding to image h is denoted as the feature index value corresponding to image h. The specific calculation expression for the feature index value corresponding to image h is as follows:

[0035]

[0036] in, Let be the feature index value corresponding to image h, and M be the total number of images in the set to be analyzed for image h. Let be the difference index value between image h and the m-th image in the set to be analyzed. The larger the value, the less similar the image h is to other images in cluster H. The smaller the value, the more similar the image h is to other images in cluster H.

[0037] After obtaining the feature index values ​​corresponding to each image in each cluster, the non-uniformity representation value of each cluster is obtained based on the differences between the feature index values ​​corresponding to the images in each cluster. The non-uniformity representation value of the cluster and the mean of the feature index values ​​corresponding to all images in the cluster are key to subsequently determining the number of blocks corresponding to the cluster. The specific process of obtaining the non-uniformity representation value of each cluster based on the differences between the feature index values ​​corresponding to the images in each cluster is as follows:

[0038] For any cluster H: First, obtain the feature difference values ​​corresponding to each image in cluster H. The feature difference value corresponding to any image is the mean of the set of absolute values ​​of the differences between the feature index value corresponding to that image and the feature index values ​​corresponding to each image in the set to be analyzed. That is, for any image h in any cluster H, the expression for calculating the feature difference value corresponding to image h is: ,in, Let h be the feature index value corresponding to the m-th image in the set to be analyzed; then calculate the mean of the feature differences corresponding to all images in cluster H, and use it as the non-uniform characterization value of cluster H, that is, the expression for the non-uniform characterization value of cluster H is:

[0039]

[0040] in, Let be the non-uniform representation value of cluster H, and N be the total number of images in cluster H. Let be the feature difference corresponding to the nth image in cluster H; and The smaller the value, the more uniform the similarity distribution among images in cluster H. The larger the value, the more uneven the distribution of similarity between images in cluster H.

[0041] After obtaining the non-uniformity representation values ​​of each cluster and the feature index values ​​corresponding to each image in each cluster, the next step is to obtain the block number control coefficient for each cluster based on these values. This block number control coefficient is crucial for determining the subsequent block number parameters for each cluster. The specific process for obtaining the block number control coefficient for each cluster is as follows: For cluster H, calculate the mean of the feature index values ​​corresponding to all images in cluster H, and denote it as the feature mean of cluster H. The product of the non-uniformity representation value of cluster H and the feature mean of cluster H is used as the block number control coefficient for cluster H. The specific calculation expression for the block number control coefficient for cluster H is as follows:

[0042]

[0043] in, This is the control coefficient for the number of blocks corresponding to cluster H. The non-uniform characterization value of cluster H, Let H be the characteristic mean of cluster H; and when When the value is larger, the number of blocks corresponding to cluster H is larger. A larger number of blocks corresponding to cluster H indicates smaller block areas and a greater number of blocks when the image in cluster H is divided into blocks. Conversely, when the value is smaller... The smaller the value, the smaller the number of blocks corresponding to cluster H. The smaller the number of blocks corresponding to cluster H, the larger the area of ​​the blocks when dividing the image in cluster H into blocks, and the fewer the number of blocks.

[0044] In addition, when A larger value indicates that there may be fewer repetitive positions or less obvious repetitive features between images in cluster H. Therefore, when dividing the data into blocks, the area of ​​each block should be as small as possible, that is, the number of blocks should be as large as possible, in order to increase the number of sub-blocks that are subsequently encoded and replaced, thereby improving the compression ratio. The calculation... Consideration The reason is that: when the calculated... When the value is large, the probability of an image with low similarity to other images within the corresponding cluster is higher, and if this is not considered... Based only on Determine This will prevent subsequent segmentation and compression from taking into account images with low similarity to other images; that is, if we do not consider... Based only on Determine This results in fewer encoded replacement regions on images within the same cluster that are less similar to other images, leading to a lower compression ratio. Therefore, in computation... Need to be considered , making As it gets bigger, The larger the value, the smaller the area of ​​the blocks when the image in the cluster H is divided into blocks, and the more blocks are divided, so as to increase the number of sub-blocks that are subsequently encoded and replaced, thereby improving the compression ratio.

[0045] After calculating the block number control coefficient for each cluster, the product of the block number control coefficient and the preset block number coefficient is rounded up and used as the block number parameter for the corresponding cluster. The block number control coefficient ranges from 0 to 1. The product of the preset block number coefficients is the maximum number of blocks per frame required in this embodiment. The larger the block number parameter for a cluster, the smaller the area of ​​the blocks and the more blocks are divided when the image in the corresponding cluster is divided. In practical applications, the implementer needs to set it according to the required compression ratio, computational load, and other actual conditions. For example, it can be set to 16. The larger the preset block number coefficient is selected, the higher the compression efficiency of the video data, but the processing time and computational complexity will be greater.

[0046] Therefore, this embodiment obtains the block quantity parameter corresponding to each cluster through the above process. After obtaining the block quantity parameter corresponding to each cluster, the images in the corresponding cluster are divided according to the block quantity parameter, resulting in sub-blocks on each image in each cluster. The specific process is as follows: For any image h in any cluster H, the block quantity parameter corresponding to cluster H is denoted as C. The image h is evenly divided into C×C small blocks, and the resulting blocks are denoted as sub-blocks on image h, with each sub-block having a length of C×C. The width of each sub-block is , where L1 is the length of image h, L2 is the width of image h, and the sub-blocks on image h do not intersect.

[0047] Therefore, this embodiment can obtain each sub-block on each image in the cluster through the above process.

[0048] Step S003: Based on the pixel difference between any two sub-blocks in the cluster, the sub-blocks on the image in the cluster are encoded and replaced to obtain the replaced video, and the replaced video is compressed to obtain compressed data.

[0049] After obtaining the sub-blocks of each image in each cluster, the sub-blocks in each cluster are encoded and replaced based on the pixel differences between any two sub-blocks in each cluster, resulting in a replaced video. The replaced video is then compressed. The specific process of encoding and replacing sub-blocks in each image based on the pixel differences between any two sub-blocks in each cluster to obtain the replaced video is as follows:

[0050] First, obtain all similar sub-block sets corresponding to each cluster, as well as the representative sub-block and its code for each similar sub-block set. The code for any sub-block consists of the position of the corresponding sub-block's image in the target video to be compressed and the position of the corresponding sub-block in the corresponding image. That is, for any sub-block g, if sub-block g belongs to the y-th sub-block in the t-th frame of the target video to be compressed, then the code for sub-block g is (t, y). Furthermore, the coordinates of the j-th sub-blocks in all images belonging to the same cluster are consistent in their corresponding images. That is, for cluster H, the center point coordinates of the j-th sub-block in image k1 of cluster H are the same as the center point coordinates of the j-th sub-block in image k2 of cluster H. Then, obtain the replaced images for each image in the target video to be compressed, and denote the video composed of the replaced images of all images in the target video to be compressed as the replaced video.

[0051] In this embodiment, the specific process of obtaining all similar sub-block sets corresponding to each cluster, as well as the representative sub-blocks and codes of each similar sub-block set, is as follows:

[0052] For any cluster H: First, the set of all sub-blocks on all images in cluster H is denoted as the comprehensive sub-block set corresponding to cluster H. Then, based on the pixel differences between the sub-blocks in the comprehensive sub-block set corresponding to cluster H, all similar sub-block sets corresponding to cluster H are obtained. For any similar sub-block set E corresponding to cluster H, any sub-block in similar sub-block set E is selected as the representative sub-block corresponding to similar sub-block set E, and the code of the representative sub-block of similar sub-block set E is denoted as the code corresponding to similar sub-block set E. In other implementations, any sub-block among all the sub-blocks that appear first in the target video to be compressed, belonging to the image in the similar sub-block set, can also be set as the representative sub-block of the corresponding similar sub-block set.

[0053] In this embodiment, the specific process of obtaining the set of all similar sub-blocks corresponding to cluster H based on the pixel differences between sub-blocks in the comprehensive sub-block set corresponding to cluster H is as follows:

[0054] First, select any sub-block from the comprehensive sub-block set corresponding to cluster H as the first sub-block. Then, denote the set of all remaining sub-blocks in the comprehensive sub-block set corresponding to cluster H (excluding the first sub-block) as the first subset. Next, determine if there are any sub-blocks in the first subset that have the same pixel count as the first sub-block. If not, select any sub-block from the first subset as the second sub-block. Denote the set of all remaining sub-blocks in the first subset (excluding the second sub-block) as the second subset. Continue to determine if there are any sub-blocks in the second subset that have the same pixel count as the second sub-block. If so, obtain all sub-blocks with the same pixel count as the second sub-block in the second subset. Finally, denote all the pixel counts of the second sub-block obtained in the second subset as... The set consisting of equal sub-blocks and the second sub-block is denoted as the first similar sub-block set corresponding to cluster H. Then, in the second subset, one sub-block is randomly selected from all the remaining sub-blocks except for all equal sub-blocks of the second sub-block as the third sub-block. That is, the third sub-block is an equal sub-block that belongs to the second subset but does not belong to the second sub-block. The set of all the remaining sub-blocks in the second subset, excluding all equal sub-blocks of the second sub-block and the third sub-block, is denoted as the third subset. Then, it is continued to check whether there are equal sub-blocks of the third sub-block in the third subset. This process is repeated until the new subset is empty. When the check stops, all similar sub-block sets corresponding to the obtained cluster H are counted.

[0055] In this embodiment, the specific process of obtaining the pixel-equal sub-blocks of any sub-block is as follows: For sub-blocks b1 and b2 in the comprehensive sub-block set corresponding to cluster H, sub-block b1 is not equal to sub-block b2:

[0056] If the pixel difference between sub-block b1 and sub-block b2 is 0, then sub-block b1 is determined to be a sub-block with equal pixels to sub-block b2, or sub-block b2 is determined to be a sub-block with equal pixels to sub-block b1. A pixel difference of 0 between sub-block b1 and sub-block b2 means that the pixel values ​​at the same position in sub-block b1 and sub-block b2 are all the same. In this embodiment, the pixel value is a color value or an RGB pixel value. For example, if the total number of pixels in sub-block b1 and sub-block b2 is Z, and the pixel value of the u-th pixel in sub-block b1 is... The pixel value of the u-th pixel on sub-block b2 is The coordinates and positions of the u-th pixel in sub-block b1 and the u-th pixel in block b2 are the same in their respective sub-blocks. If the value is 0, it indicates that the pixel difference between sub-block b1 and sub-block b2 is 0. If the value is not 0, it indicates that the pixel difference between sub-block b1 and sub-block b2 is not 0.

[0057] In this embodiment, the specific process of obtaining the replaced images of each image in the target video to be compressed is as follows:

[0058] For any image A in the target video to be compressed: First, determine whether the first sub-block of image A belongs to the set of similar sub-blocks. If it does not, do not replace the first sub-block of image A. Then, determine whether the second sub-block of image A belongs to the set of similar sub-blocks. If it does, obtain the set of similar sub-blocks to which the second sub-block of image A belongs and denote it as the set of similar sub-blocks F. Then, determine whether the second sub-block of image A is the representative sub-block of the set of similar sub-blocks F. If it is, do not replace the second sub-block of image A. If not, replace the region corresponding to the second sub-block of image A with the code of the set of similar sub-blocks F. Continue in this manner until all sub-blocks of image A have been traversed. The image A that has been traversed is recorded as the replaced image of image A. For example, if only the f-th sub-block in image A belongs to the set of similar sub-blocks, and the f-th sub-block is not the representative sub-block of the set of similar sub-blocks to which the f-th sub-block belongs, then the region corresponding to the f-th sub-block in image A can be replaced with the code of the set of similar sub-blocks to which the f-th sub-block belongs. The replaced image A is then the replaced image of image A. If none of the sub-blocks in image A belong to the set of similar sub-blocks, then image A itself is the replaced image of image A. In addition, among all the sets of similar sub-blocks corresponding to all clusters, that is, among all the sets of similar sub-blocks, if there is a sub-block or it contains a sub-block, then it means that the sub-block belongs to the set of similar sub-blocks. And if there is a sub-block in a set of similar sub-blocks, then it means that the sub-block belongs to that set of similar sub-blocks or that the set of similar sub-blocks contains the sub-block.

[0059] After obtaining the replaced video, the replaced video is compressed or the image on the replaced image is compressed to obtain compressed data. In this embodiment, the existing H.264 video encoding algorithm can be selected to encode and compress the replaced video. The process of encoding and compressing video using the H.264 video encoding algorithm is a well-known technology, so it will not be described in detail in this embodiment.

[0060] Furthermore, the sub-block regions that are replaced by encoding do not need to participate in compression; only the replaced encoding needs to be saved. That is, when transmitting or storing the sub-block regions that are replaced by encoding, only the replaced encoding needs to be transmitted or stored. During restoration, the data obtained by decoding the compressed data of the sub-block corresponding to the encoding is the data restored after the sub-block replaced by the corresponding encoding is restored. Moreover, since this embodiment first performs encoding replacement on sub-blocks of the same pixels and then compresses the replaced image or video, the compression rate can be improved, and the high fidelity of key content can also be guaranteed.

[0061] Thus, this embodiment completes the efficient compression of AI gateway videos for edge computing.

[0062] In summary, this embodiment first obtains the initial video to be compressed and extracts the feature vectors corresponding to each image in the initial video to be compressed; then, based on the difference index values ​​between the images in the initial video to be compressed, unimportant images in the initial video to be compressed are deleted to obtain the target video to be compressed; then, all images in the target video to be compressed are clustered to obtain each cluster; based on the difference index values ​​between each image in the cluster and the other images in the cluster, the feature index values ​​corresponding to each image in the cluster are obtained; based on the feature index values, the block number parameter corresponding to the cluster is obtained; based on the block number parameter corresponding to the cluster, each image in the corresponding cluster is divided to obtain each sub-block on each image in the cluster; finally, based on the pixel difference between any two sub-blocks in the cluster, the sub-blocks on the images in the cluster are encoded and replaced to obtain the replaced video; and the replaced video is compressed to obtain compressed data. Furthermore, this embodiment, through a pre-compression processing procedure that divides the image into blocks and encodes and replaces the sub-blocks in the image within a cluster based on the pixel differences between the sub-blocks, can improve the compression rate while ensuring the high fidelity of key content.

[0063] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A high-efficiency video compression method for AI gateways oriented towards edge computing, characterized in that, The method includes the following steps: Obtain the initial video to be compressed, and extract the feature vectors corresponding to each image in the initial video to be compressed; Based on the difference index value between the images in the initial video to be compressed, the unimportant images in the initial video to be compressed are deleted to obtain the target video to be compressed. The difference index between any two images is the result of negative correlation mapping between the similarity of the feature vectors corresponding to the two images. All images in the target video to be compressed are clustered to obtain various clusters; based on the difference index values ​​between each image in the cluster and the other images in the cluster, the feature index values ​​corresponding to each image in the cluster are obtained, and based on the feature index values, the number of blocks corresponding to the cluster is obtained; based on the number of blocks corresponding to the cluster, each image in the corresponding cluster is divided to obtain each sub-block on each image in the cluster; Based on the pixel difference between any two sub-blocks in the cluster, the sub-blocks on the image in the cluster are encoded and replaced to obtain the replaced video, and the replaced video is compressed to obtain compressed data; The method for obtaining the feature index values ​​corresponding to each image in the cluster includes: For any image in any cluster, the set of all images remaining in the cluster except the image is denoted as the image to be analyzed set. The set of difference index values ​​between the image and each image in the image to be analyzed set is denoted as the difference index value set corresponding to the image. The mean of the difference index value set is denoted as the feature index value corresponding to the image. The method for obtaining the number of blocks corresponding to the cluster includes: For any cluster, the feature difference values ​​corresponding to each image in the cluster are obtained. The mean of the feature differences corresponding to all images in the cluster is used as the non-uniformity representation value of the cluster. The mean of the feature index values ​​corresponding to all images in the cluster is recorded as the feature mean of the cluster. The product of the non-uniformity representation value and the feature mean of the cluster is used as the block number control coefficient corresponding to the cluster. The floor value of the product of the block number control coefficient and the preset block number coefficient is used as the block number parameter corresponding to the cluster. The feature difference corresponding to any image is the mean of the set of absolute values ​​of the differences between the feature index value corresponding to the image and the feature index values ​​corresponding to each image in the set to be analyzed.

2. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 1, characterized in that, Methods for obtaining the target video to be compressed include: The initial video to be compressed is designated as the first video. Images in the first video are marked, and it is determined whether any images in the first video are marked as unimportant. If so, all unimportant images in the first video are deleted, and the deleted first video is designated as the second video. The images in the second video are marked, and it is determined whether any unimportant images in the second video are marked. If so, all unimportant images in the second video are deleted, and the deleted second video is designated as the third video. The images in the third video are marked, and it is determined whether any unimportant images in the third video are marked. This process continues until no unimportant images are found in the newly acquired video, at which point the deletion stops, and the corresponding video is designated as the target video to be compressed.

3. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 2, characterized in that, A method for tagging images in the first video includes: The system determines whether the importance index value of the second frame of the first video is greater than a preset importance threshold. If it is, it continues to determine whether the importance index value of the third frame of the first video is greater than the preset importance threshold. If it is not, it marks the third frame of the first video as unimportant. The system then continues to determine whether the importance index value of the fifth frame of the first video is greater than the preset importance threshold. If it is, it continues to determine whether the importance index value of the sixth frame of the first video is greater than the preset importance threshold. If it is not, it marks the sixth frame of the first video as unimportant. The system then continues to determine whether the importance index value of the eighth frame of the first video is greater than the preset importance threshold, and so on, until the second-to-last frame of the first video is reached and the marking stops.

4. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 3, characterized in that, Methods for obtaining key indicator values ​​include: For the second frame image in the first video, the difference index value between the first frame image and the second frame image in the first video is recorded as the first index value, the difference index value between the second frame image and the third frame image in the first video is recorded as the second index value, and the average of the first index value and the second index value is recorded as the importance characterization value of the second frame image in the first video; the method for obtaining the importance characterization value of any frame image in any video is the same as the method for obtaining the importance characterization value of the second frame image in the first video.

5. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 1, characterized in that, The method for dividing each image in a corresponding cluster into sub-blocks based on the number of blocks corresponding to the cluster includes: For any image in any cluster, the number of blocks corresponding to the cluster is denoted as C. The image is evenly divided into C×C small blocks, which are denoted as the sub-blocks on the image.

6. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 1, characterized in that, A method for encoding and replacing sub-blocks in an image within a cluster based on pixel differences between any two sub-blocks in the cluster to obtain a replaced video includes: The set of similar sub-blocks corresponding to each cluster is obtained, as well as the representative sub-block and the code of the set of similar sub-blocks. The code of any sub-block is composed of the position of the image to which the corresponding sub-block belongs in the target video to be compressed and the position of the corresponding sub-block on the image to which the corresponding sub-block belongs. For any image A in the target video to be compressed: determine whether the first sub-block on image A belongs to the set of similar sub-blocks. If it does not belong, then the first sub-block is not replaced. Continue to determine whether the second sub-block on image A belongs to the set of similar sub-blocks. If it does, then determine whether the second sub-block is the representative sub-block of the set of similar sub-blocks. If it is, then the second sub-block is not replaced. If it is not, then the region corresponding to the second sub-block is replaced with the code of the set of similar sub-blocks to which the second sub-block belongs. This process continues until all sub-blocks on image A have been traversed. The image A that has been traversed is recorded as the replaced image of image A. The video consisting of the replaced images of all images in the target video to be compressed is denoted as the replaced video.

7. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 6, characterized in that, A method for obtaining the set of similar sub-blocks corresponding to each cluster, as well as the representative sub-blocks and codes of the set of similar sub-blocks, includes: For any cluster, the set of all sub-blocks on all images in the cluster is denoted as the comprehensive sub-block set corresponding to the cluster. Based on the pixel differences between sub-blocks in the comprehensive sub-block set corresponding to the cluster, all similar sub-block sets corresponding to the cluster are obtained. Any sub-block in the similar sub-block set is selected as the representative sub-block corresponding to the similar sub-block set, and the code of the representative sub-block of the similar sub-block set is denoted as the code of the corresponding similar sub-block set.

8. The high-efficiency video compression method for AI gateways oriented towards edge computing as described in claim 7, characterized in that, A method for obtaining a set of all similar sub-blocks corresponding to a cluster based on the pixel differences between sub-blocks in the comprehensive sub-block set corresponding to the cluster includes: Select any sub-block from the comprehensive sub-block set as the first sub-block, and denote the set of sub-blocks remaining in the comprehensive sub-block set excluding the first sub-block as the first subset. Determine whether there exists a sub-block with the same pixel count as the first sub-block in the first subset. If not, select any sub-block from the first subset as the second sub-block, and denote the set of sub-blocks remaining in the first subset excluding the second sub-block as the second subset. Determine whether there exists a sub-block with the same pixel count as the second sub-block in the second subset. If so, select all pixels of the second sub-block in the second subset. The set consisting of equal sub-blocks and the second sub-block is denoted as the first similar sub-block set corresponding to the cluster. Then, in the second subset, one sub-block is randomly selected from the remaining sub-blocks excluding the equal sub-blocks of the second sub-block as the third sub-block. The set consisting of the remaining sub-blocks excluding the equal sub-blocks of the second sub-block and the third sub-block is denoted as the third subset. The process continues to determine whether there are equal sub-blocks of the third sub-block in the third subset. This process is repeated until the new subset is empty. All similar sub-block sets corresponding to the cluster are counted. For sub-blocks b1 and b2 in the comprehensive sub-block set, if the pixel difference between sub-block b1 and sub-block b2 is 0, then sub-block b1 is determined to be a sub-block with equal pixels to sub-block b2, and sub-block b2 is a sub-block with equal pixels to sub-block b1.

Citation Information

Patent Citations

  • Group connection data processing method and system

    CN117676136A

  • Image compression method and device based on random singular value decomposition, equipment and medium

    CN120378636A