A JPEG image compression method, device, medium and equipment for target detection
By performing feature extraction and regression model training on the target detection dataset, the optimal quality factor of JPEG images is calculated, solving the problem of high resource consumption during image transmission and realizing efficient image compression in intelligent monitoring devices, which is suitable for computer vision tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ELECTRIC POWER RESEARCH INSTITUTE OF STATE GRID SHANDONG ELECTRIC POWER COMPANY
- Filing Date
- 2022-09-30
- Publication Date
- 2026-04-28
AI Technical Summary
In existing technologies, JPEG images consume a lot of resources during transmission, which affects the efficiency of computer vision processing tasks. Furthermore, traditional methods and deep learning methods are difficult to apply in intelligent monitoring devices with limited hardware resources.
By processing the target detection dataset, selecting image feature vectors, constructing a regression sample set and training a regression model, calculating the optimal quality factor, and using the lasso regression algorithm to optimize JPEG image compression, resource consumption during transmission is reduced.
Without affecting the accuracy of downstream computer vision tasks, image compression is optimized to reduce resource consumption and improve image processing efficiency, making it suitable for intelligent monitoring devices with limited hardware resources.
Smart Images

Figure CN115660953B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a JPEG image compression method, apparatus, medium, and device for target detection. Background Technology
[0002] With the continuous development and advancement of computer vision processing technology, various intelligent surveillance devices are widely used in security, power grids, transportation, and other fields. The working principle of intelligent surveillance devices is to transmit the acquired image frames to a central node for real-time intelligent analysis and calculation, mainly including visual processing processes such as target detection and target recognition. The images acquired by surveillance devices are usually in JPEG format or PNG images that can be converted to JPEG format. However, as the application and deployment scale of these devices continue to expand, the massive image transmission becomes limited by the network, severely impacting subsequent processing. A feasible solution is to compress and optimize the acquired images before network transmission without affecting the computational metrics of the visual task, thereby reducing network resource consumption. Researchers have made many explorations in image compression-related technologies. Traditional methods include optimizing JPEG quantization tables, and in recent years, deep learning technology has been applied to this field, giving rise to end-to-end image compression methods based on CNN or LSTM. However, these methods are mostly geared towards human visual perception and are not suitable for computer vision processing tasks. Furthermore, image compression based on deep learning methods usually requires considerable hardware computing power, making it difficult to apply to practical large-scale intelligent surveillance tasks.
[0003] Therefore, it is necessary and meaningful to propose a JPEG image optimization method specifically for computer vision processing tasks based on the traditional JPEG compression method to solve the problem of high resource consumption during image transmission. Summary of the Invention
[0004] This invention provides a JPEG image compression method, apparatus, medium, and device for target detection, addressing the problem of high resource consumption during JPEG image transmission in the prior art. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.
[0005] According to a first aspect of the present invention, a JPEG image compression method for object detection is provided, comprising:
[0006] The publicly available target detection dataset is processed to obtain a regression sample set;
[0007] Image features associated with JPEG image compression were selected from the regression sample set, and the image feature vector was calculated.
[0008] Based on the obtained regression sample set and image feature vector, the optimal quality factor is regressed, the regression model is trained, and the regression parameters are obtained.
[0009] The input image is compressed using a regression model.
[0010] In one embodiment, the method includes: the step of processing the publicly available object detection dataset to obtain a regression sample set, comprising:
[0011] Construct training samples, validation samples, and test samples.
[0012] In one embodiment, the method includes: the step of processing the publicly available object detection dataset to obtain a regression sample set, further comprising:
[0013] In the training samples, validation samples, and test samples, multiple compression quality factors are used to divide all images into several image sub-blocks, and all image sub-blocks are compressed.
[0014] The compressed image is fed into the object detection model for prediction and inference to obtain the optimal quality factor, which is then used as the annotation value for the image.
[0015] In one embodiment, the method includes the step of selecting image features associated with JPEG image compression in a regression sample set and calculating an image feature vector, wherein the image features include:
[0016] Image brightness features, image color richness features, image texture information features, and image edge information features.
[0017] In one embodiment, the method includes: the feature vector of the image brightness feature is represented by the average gray value of the image pixels.
[0018] In one embodiment, the method includes: the feature vector of the image color richness feature is represented by the degree of dispersion of the image pixel grayscale values relative to the mean.
[0019] In one embodiment, the method includes: the step of selecting image features associated with JPEG image compression in a regression sample set and calculating a feature vector of image texture information features, comprising:
[0020] The image describes the cyclic direction and cyclic two-dimensional pattern. The spatial domain of the image is transformed by Fourier transform to obtain the frequency domain and spectrum.
[0021] Using the spectrum, we can obtain the functional relationship between the spatial domain and the spectrum;
[0022] Based on the functional relationship between the spatial domain and the spectrum, the target parameters of image texture information features are determined, and the target parameter function is obtained.
[0023] In one embodiment, the method includes the step of using the spectrum to obtain the functional relationship between the spatial domain and the spectrum, determining the target parameters of image texture information features, and obtaining the target parameter function, which includes:
[0024] The image texture information feature target parameters include contrast, which represents the sharpness of the image texture, and texture entropy, which represents the amount of texture information contained in the image.
[0025] In one embodiment, the method includes: representing the feature vector of the image edge information features using an average gradient.
[0026] In one embodiment, the method includes: the step of regressing the optimal quality factor based on the obtained regression sample set and image feature vectors, training a regression model, and obtaining regression parameters, including:
[0027] Construct an image feature vector matrix, use the lasso regression algorithm to calculate the optimal quality factor, train the regression model, and obtain the regression parameters.
[0028] In one embodiment, the method includes: the step of processing the publicly available object detection dataset to obtain a regression sample set, comprising:
[0029] The quantitative relationship between the training samples, validation samples, and test samples is: training samples > test samples > validation samples.
[0030] In one embodiment, the method includes the specific steps of dividing all images into several image sub-blocks using multiple compression quality factors in training samples, validation samples, and test samples, and compressing all image sub-blocks, including:
[0031] Using an arithmetic progression as the compression quality factor, all images are divided into several image sub-blocks, and all image sub-blocks are compressed.
[0032] In one embodiment, the method includes the specific steps of feeding the compressed image into a target detection model for prediction and inference to obtain an optimal quality factor as the annotation value of the image, including:
[0033] The SSD model is used as the object detection model. The pre-trained model of SSD on the VOC training set is used to perform inference on the compressed image and the inference results are recorded.
[0034] Based on the analysis and reasoning results, for all images of the same image with different compression ratios, the image with a confidence level greater than one and the smallest compression ratio is selected as the optimal quality factor and used as the label value for the regression sample set of that image.
[0035] According to a second aspect of the present invention, a JPEG image compression apparatus for target detection is provided, comprising:
[0036] The regression sample set module is used to process publicly available target detection datasets to obtain regression sample sets;
[0037] The image feature selection and calculation module is used to select image features associated with JPEG image compression from the regression sample set and calculate the image feature vector.
[0038] The optimal quality factor regression module is used to regress the optimal quality factor based on the obtained regression sample set and image feature vector, train the regression model, and obtain the regression parameters.
[0039] The data compression module is used to compress the input image using a regression model.
[0040] According to a third aspect of the present invention, a computer-readable storage medium is provided for storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the JPEG image compression method for object detection.
[0041] According to a fourth aspect of the present invention, a computer device is provided.
[0042] In some embodiments, the computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the JPEG image compression method for object detection.
[0043] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:
[0044] This invention first processes the regression sample dataset, then determines the image feature vectors that are simultaneously associated with the computer vision task and the JPEG compression algorithm, and finally constructs a feature matrix by combining the regression dataset and the image feature vectors and uses the lasso regression algorithm to calculate the optimal quality factor. Oriented towards computer vision processing tasks, this invention solves the problem of excessively large image size during transmission and network limitations by optimizing image compression without affecting the relevant calculation indicators of downstream tasks. It has the advantages of not being based on deep learning algorithms, having low hardware requirements, excellent performance, low cost, and high image compression optimization efficiency.
[0045] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0046] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0047] Figure 1 This is a flowchart illustrating a JPEG image compression method for target detection according to an exemplary embodiment;
[0048] Figure 2 This is a flowchart illustrating the construction of a regression sample set according to an exemplary embodiment;
[0049] Figure 3 This is a flowchart illustrating a JPEG image compression method for object detection according to an exemplary embodiment;
[0050] Figure 4 This is a schematic diagram of the structure of a JPEG image compression apparatus for target detection according to an exemplary embodiment;
[0051] Figure 5 This is a schematic diagram of the structure of a computer device according to an exemplary embodiment. Detailed Implementation
[0052] The following description and accompanying drawings fully illustrate specific embodiments described herein to enable those skilled in the art to practice them. Some embodiments may include or substitute parts and features of other embodiments. The scope of the embodiments herein encompasses the entire scope of the claims and all available equivalents thereof. Throughout this document, the terms “first,” “second,” etc., are used only to distinguish one element from another without requiring or implying any actual relationship or order between the elements. Indeed, a first element can also be referred to as a second element, and vice versa. Furthermore, the terms “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, such that a structure, apparatus, or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a structure, apparatus, or device. Without further limitation, an element defined by the phrase “comprising one…” does not exclude the presence of other identical elements in the structure, apparatus, or device that includes said element. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments; similar or identical parts between embodiments can be referred to interchangeably.
[0053] The terms "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer" used in this document to indicate orientations or positional relationships are based on the orientations or positional relationships shown in the accompanying drawings. They are used solely for the convenience of describing the document and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. In the description herein, unless otherwise specified and limited, the terms "installed," "connected," and "linked" should be interpreted broadly. For example, they can refer to mechanical or electrical connections, or internal connections between two elements; they can be direct connections or indirect connections through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms according to the specific circumstances.
[0054] In this document, unless otherwise stated, the term "multiple" means two or more.
[0055] In this article, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0056] In this article, the term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0057] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0058] Figure 1 An embodiment of a JPEG image compression method for target detection according to the present invention is shown.
[0059] In this optional embodiment, the JPEG image compression method for object detection includes:
[0060] Step S1: Preparation of the regression sample set
[0061] The publicly available target detection dataset is processed to obtain a regression sample set;
[0062] In the specific implementation process, the publicly available object detection dataset Pascal VOC2007 needs to be processed, divided into training samples, validation samples and test samples, and the images of the sample set are compressed sequentially using different quality factors and labeled accordingly.
[0063] Step S2: Selection and Calculation of Image Features
[0064] Image features associated with JPEG image compression were selected from the regression sample set, and the image feature vector was calculated.
[0065] In the specific implementation process, image features associated with the visual task are selected: image brightness features, image color richness features, image texture information features, and image edge information features. The correlation between the selected features and the quality factor is proved, and the image feature vector is obtained.
[0066] Step S3: Optimal quality factor regression
[0067] Based on the obtained regression sample set and image feature vector, the optimal quality factor is regressed, the regression model is trained, and the regression parameters are obtained.
[0068] In the specific implementation process, a feature matrix is constructed by combining the regression sample set and image feature vectors, and the optimal quality factor is calculated using the lasso regression algorithm.
[0069] Step S4: Image Compression
[0070] The input image is compressed using a regression model.
[0071] In the specific implementation process, based on the regression parameters calculated in step S3, the input image is subsequently compressed and optimized using the regression model.
[0072] As can be seen, this application first processes and creates the sample dataset used for regression; secondly, it selects image features associated with computer vision and JPEG image compression and calculates the image feature matrix; finally, combining the sample data and the method for calculating image feature rectangles, it uses the lasso regression algorithm to calculate the optimal quality factor of the image. Without affecting the accuracy of downstream visual processing tasks, by calculating the optimal quality factor of the JPEG image, the image is adaptively compressed, reducing resource consumption during transmission.
[0073] Based on the above embodiments and preferred embodiments, a preferred embodiment is provided. Figure 2 A flowchart for constructing a regression sample set according to an embodiment of the present invention is shown below. Figure 2 As shown, the step of processing the publicly available target detection dataset to obtain a regression sample set includes:
[0074] Step S101: Construct training samples, validation samples, and test samples;
[0075] In the specific implementation process, the publicly available target detection dataset Pascal VOC2007 is processed and divided into training samples, validation samples and test samples. The quantitative relationship between the training samples, validation samples and test samples is training samples > test samples > validation samples.
[0076] Step S102: Using multiple compression quality factors, divide all images into several image sub-blocks in the training samples, validation samples, and test samples, and compress all image sub-blocks.
[0077] In the specific implementation, an arithmetic progression is used as the compression quality factor. All images are divided into several image sub-blocks, and compression is applied to all sub-blocks. This includes dividing the image into four equal-sized sub-blocks, ensuring that the number of rows and columns in each sub-block is a multiple of 8. If the number of rows or columns is not a multiple of 8, the last row or column is padded as needed. An optimal quality factor is assigned to each image sub-block. Because different regions of an image have varying brightness, color, and content richness, using the same quantization table indiscriminately can easily lead to high redundancy in some images. Therefore, using multiple compression quality factors to compress the image can further improve the compression ratio without affecting the overall compression quality.
[0078] Step S103: The compressed image is fed into the target detection model for prediction and inference to obtain the optimal quality factor, which is used as the annotation value of the image;
[0079] In the specific implementation process, the 4952 images in the test set of the VOC2007 dataset were randomly grouped in a 5:2:3 ratio to form training samples, validation samples, and test samples for the regression experiment. A quality factor ranging from 1 to 100 with a step size of 1 was used to compress all the data using JPEG, resulting in 495,200 images. These 495,200 images were then fed into the object detection task for prediction. The prediction results obtained from the images compressed using different quality factors were analyzed. The sigmoid function was used to fit the detection score of each image, and the minimum quality factor that makes the detection score tend to remain stable was found. This quality factor is the optimal quality factor that can be compressed relative to that image.
[0080] The SSD model is used as the object detection model. The pre-trained model of SSD on the VOC training set is used to perform inference on the compressed image and the inference results are recorded.
[0081] Step S104: Analyze the reasoning results. For all images of the same image with different compression ratios, select the image with a confidence score greater than one and the smallest compression ratio as the optimal quality factor and use it as the label value of the regression sample set for that image.
[0082] Based on the above embodiments and preferred embodiments, a preferred embodiment is provided, wherein image features associated with JPEG image compression are selected from the regression sample set, and an image feature vector is calculated. The image features include: image brightness features, image color richness features, image texture information features, and image edge information features. The correlation between the selected image features and the quality factor includes:
[0083] a: Image brightness features
[0084] Image brightness features refer to the brightness of an image, usually represented by the average value of pixels, as shown in formula (1). In the JPEG compression algorithm, due to the different sensitivities of the human eye to brightness and chromaticity, a brightness component quantization table is specifically provided for compression.
[0085]
[0086] Where M represents the length of the image, N represents the width of the image, g(x,y) represents the pixel gray level at (x,y), and l represents the average pixel value, i.e., the image brightness.
[0087] b: Image color richness features
[0088] Image color richness refers to the number of colors in an image. Different color levels stimulate the human eye to different degrees. Image color richness is usually expressed using standard deviation, which is the degree of dispersion of the image pixel gray value relative to the mean. The formula is as shown in (2).
[0089]
[0090] Where c represents the color richness of the image, M represents the length of the image, N represents the width of the image, g(x,y) represents the pixel gray level at (x,y) in the image, and l represents the average pixel value, i.e., the image brightness.
[0091] c: Image texture information features
[0092] The steps for calculating the feature vector of image texture information features include:
[0093] Step S201: Describe the cyclic direction and cyclic binary pattern in the image. The spatial domain of the image is transformed by Fourier transform to obtain the frequency domain and spectrum.
[0094] Step S202: Using the spectrum, obtain the functional relationship between the spatial domain and the spectrum;
[0095] Step S203: Determine the target parameters of image texture information features based on the functional relationship between the spatial domain and the spectrum, and obtain the target parameter function.
[0096] Here, image texture information features reflect the homogeneity of the image, demonstrating the slowly changing or periodically changing surface structure and arrangement attributes of the object's surface. Due to the technical limitations of statistical methods for describing image texture, the overall texture information of the image cannot be detected. Fourier transform can effectively describe the cyclic direction and cyclic binary pattern in an image.
[0097]
[0098] In the above formula, u, v, x, and y are all integers, with values ranging from 0 ≤ u, x ≤ M-1 and 0 ≤ v, y ≤ N-1; j is the imaginary unit; M represents the length of the image, N represents the width of the image, f(x, y) represents a digital image of size M × N, and the coordinate system in which it is located is called the spatial domain; F(u, v) is the two-dimensional discrete Fourier transform of f(x, y), usually called the spectrum of f(x, y), and the coordinate system in which it is located is called the frequency domain. Components within a certain cutoff frequency (u0, v0) in the spectrum are called low-frequency components, and components outside the cutoff frequency are called high-frequency components. Low frequencies mainly determine the overall grayscale level of the image in smooth regions, while high frequencies determine the details of the image, such as edges and noise.
[0099] According to Passevar's theorem, the energy of a signal is equal in the spatial domain and the frequency domain. Therefore, there is the following relationship between the energy of the spatial domain image f(x,y) and its corresponding spectrum F(u,v):
[0100]
[0101] Therefore, the spectrum characterizes the texture and energy features of an image. If the low-frequency components of an image's spectrum are more abundant than the high-frequency components, then the image has a relatively flat texture; conversely, the texture features are more complex. Regardless of their location, edge features in the same direction in the spatial domain will contribute to the frequency domain by being superimposed, forming a spectral line that passes through the origin of the spectrum and is perpendicular to the original direction.
[0102] Contrast ratio and texture entropy are two of the most important parameters for describing texture complexity. Contrast ratio reflects the sharpness of image texture; to a certain extent, the higher the value, the sharper the overall image. Texture entropy refers to the amount of texture information contained in an image; the higher the value, the more texture distribution in the image.
[0103] When describing texture complexity, two parameters are used: texture entropy and contrast, as in equation (5).
[0104] Note: Texture complexity is defined by texture entropy and contrast together.
[0105]
[0106] In the above formula, t represents the image texture complexity. Represents texture entropy. This represents the contrast ratio, where M represents the length of the image and N represents the width of the image. This represents the count of gray-level pairs in the image.
[0107] d. Image edge information features
[0108] The frequency of an image is an indicator of the drastic changes in gray levels, representing the gradient of gray levels in a spatial plane. From a purely mathematical perspective, the Fourier transform converts a function into a series of periodic functions. Physically, the Fourier transform converts an image from the spatial domain to the frequency domain, while its inverse transform converts it back to the spatial domain. In other words, the physical meaning of the Fourier transform is to transform the gray-level distribution function of an image into its frequency distribution function, and the inverse Fourier transform is to transform the frequency distribution function back into its gray-level distribution function.
[0109] The average gradient characterizes the rate of change of gray level at the image boundary, reflects the rate of change of image details, and to a certain extent reflects the sharpness of image edges. Its formula (6) is shown:
[0110]
[0111] Where g represents the image edge information, i.e., the average gradient of the image, M represents the length of the image, N represents the width of the image, and f(x,y) represents the pixel gray level of the image at (x,y).
[0112] Based on the above embodiments and preferred embodiments, a preferred embodiment is provided, wherein the steps of constructing an image feature vector matrix, calculating the optimal quality factor using a lasso regression algorithm, training a regression model, and obtaining regression parameters include:
[0113] Based on the aforementioned image feature vectors and regression sample set, a feature vector matrix is constructed, and regression parameters are calculated using the lasso regression algorithm. The lasso regression algorithm uses L1 regularization on top of the linear regression model, improving its accuracy. In the optimal quality factor regression, a loss function J(w) is used to learn the regression parameters W. lasso .
[0114]
[0115] Where F represents the feature matrix extracted using the image feature algorithm described above, F represents the corresponding optimal quality factor matrix, and W is the parameter to be regressed, i.e., W0. lasso λ is a non-negative number. Solving the above equation using gradient descent yields the rule for updating the parameters:
[0116] W lasso =[W lasso -∈*(FT FW lasso )-F T Q]-∈*λ*sgn(W lasso (8)
[0117] In the formula, sgn(W lasso ) is a sign function, ∈ is a non-negative number, F T This represents the transpose of the characteristic matrix F.
[0118] Based on the above embodiments and preferred embodiments, a specific embodiment is provided. Figure 3 This is a flowchart of a JPEG image compression method for target detection according to an embodiment of the present invention. The process includes the following steps:
[0119] S101: The original VOC2007 dataset;
[0120] Specifically, since the regression dataset annotation of this invention requires the use of a target detection model pre-trained on the VOC training set, the regression sample dataset is made using the test set portion of VOC2007. This test set portion includes 4952 images, which are divided into training samples, validation samples, and test samples in a 5:2:3 ratio.
[0121] S102: Compress images using different quality factors;
[0122] Specifically, an arithmetic sequence from 1 to 100 with a step size of 1 was used as the quality factor to compress the data in the sample set, resulting in 459,200 images for subsequent annotation work.
[0123] S103: Feed the compressed image into the object detection network for inference;
[0124] Specifically, the pre-trained model of SSD on the VOC training set is used to perform inference on the image obtained in the previous step, and the inference results are recorded.
[0125] S104: Analyze the reasoning results and annotate the images;
[0126] Specifically, analyzing the inference results obtained in the previous step, for all images of the same image with different compression ratios, we find the smallest compression ratio with a valid (greater than 0) confidence level and stability, and use it as the labeled value of the regression dataset for that image.
[0127] S201: Prepare the regression sample set;
[0128] The regression sample set is created by compressing the sample dataset according to steps S101-S104.
[0129] S202: Calculate the image feature vectors of the images in the regression sample set;
[0130] Specifically, the value of each image feature is first obtained through the calculation formulas for image brightness feature, image color richness feature, image texture information feature, and edge image information feature. The calculation formulas are shown in equations (1) to (6), respectively using I l I c I e and I g This means that the feature vector I = [I] of the entire image is obtained by stitching the images together. l ,I c ,I e ,I g ] 4×1 .
[0131] S203: Train the regression network and calculate the regression parameters;
[0132] Specifically, the combination of feature vectors from N images is called matrix X = [I1, I2, ..., I...]. N ] 4×N Meanwhile, the lasso regression parameters W are calculated for the corresponding optimal quality factor matrix Y, where the calculation formulas for lasso regression are shown in equations (7) and (8).
[0133] S204: Compress the image based on the calculated regression parameters.
[0134] Specifically, based on the regression parameters calculated in step S203, the input image is subsequently compressed and optimized using a regression model.
[0135] Regression parameters are parameters in a regression equation that represent the magnitude of the influence of the independent variable F on the dependent variable Q, i.e., W mentioned above. lasso The regression model is equivalent to the regression network.
[0136] In the technical solution of this invention, the sample dataset used for regression is first processed and created. Next, image features associated with computer vision and JPEG image compression are selected, and the image feature matrix is calculated. Finally, combining the sample data and the method for calculating image feature rectangles, lasso regression is used to calculate the optimal quality factor of the image. This solution adaptively compresses the image by calculating the optimal quality factor of the JPEG image without affecting the accuracy of downstream visual processing tasks, thereby reducing resource consumption during image transmission.
[0137] like Figure 4 As shown in the figure, this application discloses a JPEG image compression device for target detection, comprising:
[0138] The regression sample set module 11 is used to process the publicly available target detection dataset to obtain a regression sample set;
[0139] The image feature selection and calculation module 12 is used to select image features associated with JPEG image compression from the regression sample set and calculate the image feature vector.
[0140] The optimal quality factor regression module 13 is used to perform regression on the optimal quality factor based on the obtained regression sample set and image feature vector, train the regression model, and obtain the regression parameters.
[0141] The data compression module 14 is used to compress the input image using a regression model.
[0142] As can be seen, this application first processes and creates the sample dataset used for regression, then selects image features associated with computer vision and JPEG image compression and calculates the image feature matrix, and finally combines the sample data and the image feature rectangle calculation method to use lasso regression to calculate the optimal quality factor of the image. This scheme, without affecting the accuracy of downstream visual processing tasks, adaptively compresses images by calculating the optimal quality factor of JPEG images, reducing resource consumption during image transmission, saving storage space, and improving image processing efficiency. Furthermore, using the same compression method for all image data can improve the compression efficiency of digital images, further enhancing image processing efficiency.
[0143] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores static and dynamic information data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the above method embodiments.
[0144] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0145] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0146] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0147] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0148] This invention is not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this invention is limited only by the appended claims.
Claims
1. A JPEG image compression method for target detection, characterized in that, include: The publicly available target detection dataset is processed to obtain a regression sample set; Image features associated with JPEG image compression are selected from the regression sample set, and image feature vectors are calculated, including: describing the loop direction and loop binary pattern in the image; the spatial domain of the image is transformed by Fourier transform to obtain the frequency domain and spectrum; using the spectrum, the functional relationship between the spatial domain and the spectrum is obtained; based on the functional relationship between the spatial domain and the spectrum, the target parameters of image texture information features are determined, and the target parameter function is obtained. The target parameters of image texture information features include contrast, which represents the sharpness of the image texture, and texture entropy, which represents the amount of texture information contained in the image. Based on the obtained regression sample set and image feature vector, the optimal quality factor is regressed, the regression model is trained, and the regression parameters are obtained. The input image is compressed using a regression model.
2. The JPEG image compression method for target detection according to claim 1, characterized in that, The step of processing the publicly available target detection dataset to obtain a regression sample set includes: Construct training samples, validation samples, and test samples.
3. The JPEG image compression method for target detection according to claim 2, characterized in that, The step of processing the publicly available target detection dataset to obtain a regression sample set further includes: In the training samples, validation samples, and test samples, multiple compression quality factors are used to divide all images into several image sub-blocks, and all image sub-blocks are compressed. The compressed image is fed into the object detection model for prediction and inference to obtain the optimal quality factor, which is then used as the annotation value for the image.
4. The JPEG image compression method for target detection according to claim 1, characterized in that, The step of selecting image features associated with JPEG image compression in the regression sample set and calculating the image feature vector includes: Image brightness features, image color richness features, image texture information features, and image edge information features.
5. The JPEG image compression method for target detection according to claim 4, characterized in that, The feature vector of the image brightness feature is represented by the average gray value of the image pixels.
6. The JPEG image compression method for target detection according to claim 4, characterized in that, The feature vector of the image color richness feature is represented by the degree of dispersion of the image pixel gray values relative to the mean.
7. The JPEG image compression method for target detection according to claim 4, characterized in that, The feature vector of the image edge information features is represented by the average gradient.
8. The JPEG image compression method for target detection according to claim 1, characterized in that, The steps of regressing the optimal quality factor based on the obtained regression sample set and image feature vectors, training the regression model, and obtaining the regression parameters include: Construct an image feature vector matrix, use the lasso regression algorithm to calculate the optimal quality factor, train the regression model, and obtain the regression parameters.
9. The JPEG image compression method for target detection according to claim 2, characterized in that, The step of processing the publicly available target detection dataset to obtain a regression sample set includes: The quantitative relationship between the training samples, validation samples, and test samples is: training samples > test samples > validation samples.
10. The JPEG image compression method for target detection according to claim 3, characterized in that, The specific steps for dividing all images into several image sub-blocks using multiple compression quality factors in the training, validation, and test samples, and compressing all image sub-blocks, include: Using an arithmetic progression as the compression quality factor, all images are divided into several image sub-blocks, and all image sub-blocks are compressed.
11. The JPEG image compression method for target detection according to claim 3, characterized in that, The specific steps of feeding the compressed image into the target detection model for prediction and inference to obtain the optimal quality factor as the annotation value of the image include: The SSD model is used as the object detection model. The pre-trained model of SSD on the VOC training set is used to perform inference on the compressed image and the inference results are recorded. Based on the analysis and reasoning results, for all images of the same image with different compression ratios, the image with a confidence level greater than one and the smallest compression ratio is selected as the optimal quality factor and used as the labeled value of the regression sample set for that image.
12. A JPEG image compression device for target detection, characterized in that, include: The regression sample set module is used to process publicly available target detection datasets to obtain regression sample sets; The image feature selection and calculation module is used to select image features associated with JPEG image compression from the regression sample set and calculate the image feature vector, including: describing the loop direction and loop binary pattern in the image; obtaining the frequency domain and spectrum from the spatial domain of the image through Fourier transform; using the spectrum, obtaining the functional relationship between the spatial domain and the spectrum; determining the target parameters of image texture information features based on the functional relationship between the spatial domain and the spectrum, and obtaining the target parameter function. The target parameters of image texture information features include contrast, which represents the sharpness of the image texture, and texture entropy, which represents the amount of texture information contained in the image. The optimal quality factor regression module is used to regress the optimal quality factor based on the obtained regression sample set and image feature vector, train the regression model, and obtain the regression parameters. The data compression module is used to compress the input image using a regression model.
13. The JPEG image compression apparatus for target detection according to claim 12, characterized in that, The process of processing the publicly available target detection dataset to obtain a regression sample set includes: Construct training samples, validation samples, and test samples.
14. The JPEG image compression apparatus for target detection according to claim 13, characterized in that, The process of processing the publicly available target detection dataset to obtain a regression sample set also includes: In the training samples, validation samples, and test samples, multiple compression quality factors are used to divide all images into several image sub-blocks, and all image sub-blocks are compressed. The compressed image is fed into the object detection model for prediction and inference to obtain the optimal quality factor, which is then used as the annotation value for the image.
15. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the steps of a JPEG image compression method for object detection as described in any one of claims 1-11.
16. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the JPEG image compression method for target detection as described in any one of claims 1-11.
Citation Information
Patent Citations
System for enhancing sound definition
CN101105941A
Speaker online pure voice failure diagnosis method
CN101170843A