An image processing method and related equipment

By preprocessing images and performing DCT and inverse transformations on the feature matrix, the problem of low accuracy caused by malicious attacks in image recognition is solved, thereby improving the accuracy and robustness of image recognition in fields such as autonomous driving.

CN113239934BActive Publication Date: 2026-11-17CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110330193.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-27
Publication Date
2026-11-17
Estimated Expiration
2041-03-27

AI Technical Summary

Technical Problem

In critical fields such as autonomous driving, malicious attacks during image recognition can lead to low accuracy and potentially serious accidents.

Method used

By preprocessing the image to be processed, a set of feature matrices is obtained. Then, DCT transformation and feature recoding are performed on the feature matrices to obtain the feature matrices of the vertical, horizontal and diagonal regions, respectively. Subsequently, inverse DCT transformation is performed to obtain the target prediction result of the image.

Benefits of technology

It improves the accuracy of image recognition, effectively defends against attack samples, and enhances the robustness of image recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113239934B_ABST
    Figure CN113239934B_ABST
Patent Text Reader

Abstract

This application discloses an image processing method and related equipment. The method includes: preprocessing an acquired image to obtain a set of feature matrices for the image; performing a Direct Transformation (DCT) on the target feature matrices to obtain vertical, horizontal, and diagonal feature matrices; performing feature recoding and inverse DCT on the vertical, horizontal, and diagonal feature matrices to obtain the first, second, and third features of the target feature matrices, respectively; using each feature matrix in the set as the target feature matrix to determine the first, second, and third features of each feature matrix; and obtaining a target prediction result for the image to be processed based on the first, second, and third features of each feature matrix. This method can improve the accuracy of image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to an image processing method and related equipment. Background Technology

[0002] With the rapid development of artificial intelligence technology, automatic recognition technology has gradually matured. However, during the recognition process, errors can occur when malicious attacks are present. Especially in critical areas such as autonomous driving, malicious attacks could lead to serious traffic accidents if recognition errors occur. Therefore, improving the accuracy of image recognition has become an urgent technical problem to be solved. Summary of the Invention

[0003] This application provides an image processing method and related equipment that can improve the accuracy of image recognition.

[0004] In a first aspect, embodiments of this application disclose an image processing method, the method comprising:

[0005] The image to be processed is acquired and preprocessed to obtain a feature matrix set of the image to be processed, wherein the feature matrix set includes the feature matrix corresponding to each image region in the image to be processed;

[0006] Perform DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix;

[0007] The vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix are all subjected to feature recoding and inverse DCT transformation to obtain the first feature, the second feature, and the third feature of the target feature matrix, respectively.

[0008] Each feature matrix in the set of feature matrices is used as the target feature matrix to obtain the first feature, the second feature, and the third feature of each feature matrix, and the target prediction result of the image to be processed is obtained based on the first feature, the second feature, and the third feature of each feature matrix.

[0009] Secondly, embodiments of this application disclose an image processing apparatus, which includes:

[0010] An acquisition unit is used to acquire an image to be processed and preprocess the image to be processed to obtain a feature matrix set of the image to be processed, wherein the feature matrix set includes: the feature matrix corresponding to each image region in the image to be processed;

[0011] The processing unit is used to perform DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, the horizontal region feature matrix and the diagonal region feature matrix of the target feature matrix;

[0012] The processing unit is further configured to perform feature recoding and DCT inverse transformation on the vertical region feature matrix, the horizontal region feature matrix and the diagonal region feature matrix to obtain the first feature, the second feature and the third feature of the target feature matrix, respectively.

[0013] The processing unit is further configured to use each feature matrix in the feature matrix set as the target feature matrix to obtain the first feature, the second feature and the third feature of each feature matrix, and to obtain the target prediction result of the image to be processed based on the first feature, the second feature and the third feature of each feature matrix.

[0014] Thirdly, embodiments of this application disclose a computer device including a processor adapted to implement one or more computer programs; and a computer storage medium storing one or more computer programs adapted to be loaded by the processor and executed by the image processing method described above.

[0015] Fourthly, embodiments of this application disclose a computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more computer programs, the one or more computer programs being adapted to be loaded by a processor and executed by the above-described image processing method.

[0016] Fifthly, embodiments of this application disclose a computer program product or computer program, the computer program product including a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the computer device to perform the image processing method described above.

[0017] In this embodiment, a computer device acquires an image to be processed and preprocesses it to obtain a set of feature matrices. Each feature matrix in the set undergoes a Direct Transformation (DCT) to obtain vertical, horizontal, and diagonal feature matrices. Then, feature recoding and inverse DCT are performed on the vertical, horizontal, and diagonal feature matrices to obtain the first, second, and third features of each feature matrix. Based on these features, a target prediction result for the image to be processed is obtained. This method improves the accuracy of image recognition by identifying different regions of the image and determining the target prediction result based on various features. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the architecture of an image processing system disclosed in an embodiment of this application;

[0020] Figure 2 This is a schematic flowchart of an image processing method disclosed in an embodiment of this application;

[0021] Figure 3 This is a schematic diagram of an image segmentation method disclosed in an embodiment of this application;

[0022] Figure 4 This is a schematic diagram of image region division disclosed in an embodiment of this application;

[0023] Figure 5 This is a schematic diagram of the region division of a matrix disclosed in an embodiment of this application;

[0024] Figure 6 This is a schematic diagram of the structure of a ResNet network disclosed in an embodiment of this application;

[0025] Figure 7 This is a schematic flowchart of another image processing method disclosed in an embodiment of this application;

[0026] Figure 8 This is a schematic flowchart of another image processing method disclosed in the embodiments of this application;

[0027] Figure 9 This is a schematic diagram of the structure of an image processing apparatus disclosed in an embodiment of this application;

[0028] Figure 10 This is a schematic diagram of the structure of a computer device disclosed in an embodiment of this application. Detailed Implementation

[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0030] Please see Figure 1 , Figure 1 This is a schematic diagram of the architecture of an image processing system according to an embodiment of this application, such as... Figure 1 As shown in the figure, the architecture diagram 100 of the image processing system includes a terminal device 101 and a computer device 102, wherein the terminal device 101 and the computer device 102 can be connected in communication.

[0031] Specifically, terminal device 101 can be a handheld device, in-vehicle device, wearable device, or computing device with wireless communication capabilities. For example, the user terminal can be a mobile phone, tablet computer, or computer with wireless transceiver capabilities. The client can also be a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal device in industrial control, a wireless terminal device in autonomous driving, a wireless terminal device in telemedicine, a wireless terminal device in a smart grid, a wireless terminal device in a smart city, a wireless terminal device in a smart home, etc.; computer device 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0032] In one feasible embodiment, computer device 102 acquires an image to be processed and preprocesses the image to obtain a set of feature matrices for the image to be processed; performs Discrete Cosine Transform (DCT) on the target feature matrices in the set of feature matrices to obtain the vertical region feature matrix, horizontal region feature matrix, and diagonal region feature matrix of the target feature matrix; performs feature recoding and inverse DCT on the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix to obtain the first feature, the second feature, and the third feature of the target feature matrix, respectively; uses each feature matrix in the set of feature matrices as the target feature matrix to obtain the first feature, the second feature, and the third feature of each feature matrix; determines the first feature, the second feature, and the third feature of the image to be processed based on the first feature, the second feature, and the third feature of the image to be processed; and finally determines the target prediction result of the image to be processed based on the first feature, the second feature, and the third feature of the image to be processed. This embodiment can improve the accuracy of image recognition. Since an image is processed by dividing it into a set of feature matrices, it can be recognized more accurately. In addition, it can effectively defend against attack samples during the processing.

[0033] Based on the image processing system described above, this application discloses an image processing method. Please refer to [link to relevant documentation]. Figure 2 This is a flowchart illustrating an image processing method disclosed in an embodiment of this application. The image processing method can be executed by a computer and specifically includes the following steps:

[0034] S201. The computer device acquires the image to be processed and preprocesses the image to be processed to obtain a set of feature matrices of the image to be processed.

[0035] The feature matrix set may include feature matrices corresponding to each image region in the image to be processed. The number of image regions is multiple, which can be represented by N. In this embodiment, N is at least 4.

[0036] In one feasible embodiment, before preprocessing the image to be processed, the computer device first performs color space conversion on the image to be processed to obtain the image to be processed in the YUV color space of the brightness-hue-saturation system, and then performs resampling processing on the image to be processed in the YUV color space to obtain the resampled image to be processed.

[0037] The specific implementation method of the computer device converting the image to be processed into a YUV color space is as follows: the original image to be processed, which is an RGB image, is obtained by the computer device. The computer device uses the YUV image data representation method to convert the RGB color space image to be processed into a YUV color space image. The specific conversion relationship is shown in formula (1), formula (2), and formula (3).

[0038] Y = 0.299R + 0.587G + 0.114B (1)

[0039] U = 0.148R - 0.289G + 0.473B (2)

[0040] V = 0.615R - 0.515G - 0.1B (3)

[0041] The process involves converting each point of the image to be processed from (R, G, B) to (Y, U, V), where Y represents the color's luminance, brightness, and grayscale value; U represents hue; and V represents saturation. YUV is a good image data representation method, especially in the video field. YUV is a general term encompassing many specific formats, such as YUV420, YUV444, and YUV422. Some YUV formats, compared to RGB, require significantly less data. For example, YUV420 requires one Y value per pixel and one U / V value for every four pixels; therefore, an 8x8 image block requires only 8*8*3 / 2 = 96 bytes of data. RGB, on the other hand, requires 8*8*3 = 192 bytes of data—half the data volume. Many videos now use YUV420 as their color gamut. Among them, RGB images are also known as true color images. They use three components, R, G, and B, to identify the color of a pixel. R, G, and B represent three different basic colors, red, green, and blue, respectively. Any color can be synthesized using these three primary colors.

[0042] It is important to note that a color space is a specific color organization, and its color model represents the mathematical formulas for representing these colors. One color model can be converted into another, meaning that the mathematical expression for a given color can be transformed into a completely different set of values. These values ​​appear the same to the human eye, but can be represented by different sets of values. For example, converting from the RGB color model to the "Y, Cb, Cr color model," where Y is luminance, Cb is chromaticity (blue), and Cr is chromaticity (red). The human eye is more sensitive to luminance than chromaticity, meaning we can ignore large chromaticity changes without affecting our perception of the image. Therefore, we can double the compression of the Cb and Cr channels before the human eye perceives them. Optionally, this application can also convert the RGB image to be processed into the "Y, Cb, Cr" image. The corresponding conversion formulas are shown in formulas (4), (5), and (6):

[0043] Y=0.2987R+0.58661G+0.11448B (4)

[0044] Cb=-0.16874R-0.33126G+0.50000B (5)

[0045] Cr=0.50000R-0.41869G-0.08131B (6)

[0046] That is, to transform each point of the image to be processed from (R, G, B) to (Y, Cb, Cr).

[0047] The computer equipment resamples the image to be processed in the YUV color space to obtain a resampled image. Specifically, the computer equipment uses a 411 sampling method, meaning the sampling ratio of the Y, U, and V components is 4:1:1. This means that in a 2x2 cell, the Y component is sampled four times, while the U and V components are each sampled once, resulting in the sampled image. Since the human eye is more sensitive to brightness changes than to color changes, the Y component can be considered more important than the U and V components. Although this sampling method sacrifices some precision, it reduces data storage requirements while remaining virtually imperceptible to the human eye.

[0048] The image to be processed, acquired by the computer equipment, can be sent by the terminal equipment, with the aim of recognizing the image to be processed.

[0049] In one feasible embodiment, after acquiring the image to be processed, the computer device preprocesses the image, including: performing mean filtering on the image to be processed to obtain a filtered image to be processed; and then performing image segmentation on the filtered image to obtain multiple feature matrices of the image to be processed. The purpose of filtering the image to be processed is to filter out outliers in the image. An outlier can be understood as a set of measured values ​​whose deviation from the mean exceeds N times the standard deviation, where N is an integer greater than or equal to 1. Based on experience, N can be set to 2.

[0050] Optionally, the computer device performs pre-filtering on the image to be processed to obtain a filtered image. This includes: using a 3x3 filter, iterating through each pixel in the image; if the value of a pixel differs significantly from the values ​​of its eight surrounding pixels, then this pixel is replaced with the average value of the 9x3 grid filter, resulting in the filtered image. This method is called mean filtering, and its purpose is to remove outliers from the image. In practical applications, this removal may be due to abnormal values ​​introduced by attackers. It should be noted that there are many pre-filtering algorithms available, including simple local mean filtering, 3D block matching (BM3D), or complex algorithms based on deep neural networks (DNN) systems.

[0051] Optionally, the computer device performs image segmentation processing on the filtered image to obtain multiple matrix representations of the image to be processed. This can include: dividing the filtered image into several small 8*8 matrices, such as... Figure 3 The image shown contains multiple feature matrices of the image to be processed. The reason for dividing the filtered image into 8x8 pixel blocks is that 8x8 pixel blocks are generally considered to have little difference; even in complex images, pixels in local areas often exhibit similarity, which aids in image compression. Furthermore, the subsequent Discrete Cosine Transform (DCT) processes these 8x8 sub-blocks; therefore, the original image data must be divided into blocks before the DCT transformation. In the filtered image, the three components of each point alternate; these three components must first be separated and stored in three tables. Then, the 8x8 sub-blocks are read sequentially from left to right and top to bottom, stored in a table of length 64, and then the DCT transformation is performed.

[0052] S202. The computer device performs DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix.

[0053] In one feasible embodiment, a computer device performs a DCT transformation on the target feature matrix to obtain the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix of the target feature matrix. The target feature matrix is ​​the feature matrix corresponding to any image region in the feature matrix set.

[0054] In the specific implementation process, the computer device performs DCT transformation on the target feature matrix to obtain the vertical region feature matrix, horizontal region feature matrix, and diagonal region feature matrix of the target feature matrix. Specifically, as mentioned earlier, each pixel in the feature matrix has three YUV components, so each 8*8 submatrix needs to undergo three DCT transformations. Generally, two-dimensional discrete cosine transform (DCT) is used for image processing. After dividing the image to be processed into an 8*8 data unit matrix, each value must be subtracted by 128 before being substituted into the DCT transformation formula. The image data values ​​must be subtracted by 128 because the DCT formula accepts numbers between -128 and 127 to achieve the purpose of DCT transformation.

[0055] Based on the above description, the 8*8 two-dimensional DCT is defined as shown in formula (7):

[0056]

[0057] Among them, u>=0, v<8; α(u)=α(u), g x,y It is the input of 8x8 pixel coordinates, G u,v These are the coordinates of the output 8x8 pixel transformation result.

[0058] For example, using a matrix to illustrate, the original matrix is ​​as shown in formula (8):

[0059]

[0060] The transformed matrix is ​​shown in formula (9):

[0061]

[0062] The computer equipment performs a DCT transformation on the target feature matrix to obtain the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix. Here, the vertical region (V), the horizontal region (H), and the diagonal region (D) are included, along with a low-frequency region (L). The positions of the four regions are as follows: Figure 4As shown, the matrices corresponding to the four regions are as follows: Figure 5 As shown, 501 corresponds to the low-frequency region (L), 502 corresponds to the horizontal region (H), 503 corresponds to the vertical region (V), and 504 corresponds to the diagonal region (D). Since the low-frequency region (L) concentrates most of the image's energy and is relatively complex to process, its feature matrix is ​​not included in the calculation in this application.

[0063] S203. The computer equipment performs feature recoding and DCT inverse transformation on the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix to obtain the first feature, the second feature, and the third feature of the target feature matrix, respectively.

[0064] In one feasible embodiment, the computer device performs feature recoding and inverse DCT transformation on the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix to obtain the first feature, the second feature, and the third feature of the target feature matrix, respectively. Specifically, the computer device inputs the vertical region feature matrix into the vertical region channel and performs feature recoding to obtain the encoded vertical region feature matrix. Then, it performs an inverse DCT transformation on the encoded vertical region feature matrix to obtain the first feature of the vertical region feature matrix. This first feature of the vertical region feature matrix is ​​used as the first feature of the target feature matrix. Then, the horizontal region feature matrix... The matrix is ​​input into the horizontal region channel and re-encoded to obtain the encoded horizontal region feature matrix. The encoded horizontal region feature matrix is ​​then subjected to inverse DCT to obtain the second feature of the horizontal region feature matrix, which is used as the second feature of the target feature matrix. Similarly, the diagonal region feature matrix is ​​input into the diagonal region channel and re-encoded to obtain the encoded diagonal region feature matrix. The encoded diagonal region feature matrix is ​​then subjected to inverse DCT to obtain the third feature of the diagonal region feature matrix, which is used as the third feature of the target feature matrix.

[0065] The system uses three channels: V (vertical region), H (horizontal region), and D (diagonal region). Each channel identifies a different region feature matrix; for example, V identifies the vertical region feature matrix, H identifies the horizontal region feature matrix, and D identifies the diagonal region feature matrix. The feature recoding for each region feature matrix involves using random noise between 0 and 1 to recode the 4x4 partitions corresponding to each channel's feature matrix. The random noise used in the 4x4 matrices corresponding to different positions in the original image is different. This approach ensures encoding diversity while minimizing the impact of noise on model accuracy.

[0066] For example, an image with a 160*160 pixel matrix can be divided into 20 smaller 8*8 matrices. Each matrix has three partitions (V, H, D) for feature recoding. The Gaussian noise used for the 8*8 smaller matrices at different locations in the original image is different. Each channel requires 20 different Gaussian noises. Since there are three channels, there are 20*3=60 different 4*4 matrix Gaussian noises.

[0067] The transformation formula corresponding to the above-mentioned inverse DCT transformation is shown in formula (10):

[0068]

[0069] Among them, f x,y Input the coordinates of an 8x8 pixel array, F u,v These are the coordinates of the 8x8 pixel transformation result. Why is inverse DCT needed? Because most images have relatively small high-frequency components, the corresponding DCT coefficients for these components are often close to 0. Furthermore, high-frequency components only contain subtle details of the image, and the human eye is not very sensitive to this distortion. Therefore, we can discard these high-frequency components to reduce the amount of data that needs to be transmitted. In this way, the encoding length required to transmit the DCT transform coefficients is much smaller than the encoding length for transmitting image pixels. At the receiving end, the original data can be obtained through inverse discrete cosine transform. Although this introduces some distortion, it is acceptable to the human eye, and the human eye is not sensitive to such minute changes.

[0070] S204. The computer device uses each feature matrix in the feature matrix set as the target feature matrix to obtain the first feature, second feature and third feature of each feature matrix, and obtains the target prediction result of the image to be processed based on the first feature, second feature and third feature of each feature matrix.

[0071] According to steps S202 and S203, the first feature, the second feature, and the third feature of the target feature matrix can be obtained. Therefore, each feature matrix in the feature matrix set is treated as the target feature matrix, and steps S202 and S203 are repeated to obtain the first feature, the second feature, and the third feature of each feature matrix.

[0072] In a feasible embodiment, after determining the first, second, and third features of each feature matrix, the computer device then determines the first, second, and third features of the image to be processed based on the first, second, and third features of each feature matrix. Specifically, since each image to be processed is divided into N feature matrices and then processed through three channels (V channel, H channel, and D channel), each channel will have N first features of the feature matrices. In order to stitch all the 8*8 matrices into a new large matrix of the same size as the original image, the computer device will stitch together the N first features of the N feature matrices of the V channel to obtain the first feature of the image to be processed; similarly, it will stitch together the N second features of the N feature matrices of the H channel to obtain the second feature of the image to be processed, and it will stitch together the N third features of the N feature matrices of the D channel to obtain the third feature of the image to be processed.

[0073] Furthermore, the computer device uses a classifier to classify the first feature, second feature, and third feature of the image to be processed, obtaining a first prediction result, a second prediction result, and a third prediction result for the image to be processed. Further, the computer device aggregates these three prediction results to obtain the target prediction result for the image to be processed. Specifically, the computer device aggregates the results of each channel predicted by the ResNet18 neural network, which can be achieved by performing a summation operation to obtain the final prediction result, i.e., the target prediction result. Optionally, there are many ways to achieve aggregation; it can be by accumulating the classification results of each channel, or by using a complex aggregation network to aggregate the first, second, and third prediction results.

[0074] Here, "classifier" refers to a classification model, such as ResNet, which can employ different depth structures, such as ResNet18, ResNet34, ResNet50, ResNet101, and ResNet152. The depth of each network refers to the number of layers that "need to update parameters through training," such as convolutional layers and fully connected layers. More specifically, ResNet network structures of various depths can be like... Figure 6As shown, based on the Block type, these five ResNets can be divided into two categories: (1) one is based on BasicBlock, and shallow networks ResNet18 and 34 are built using BasicBlock; (2) the other is based on Bottleneck, and deep networks ResNet50, 101, 152 and even deeper networks are built using Bottleneck. A Block is like a building block, and each layer is built from several Blocks, which in turn form the entire network. Each ResNet has 4 layers (not counting the initial 7×7, convolutional layer and 3×3, maxpooling layer), such as Figure 6 conv2_x corresponds to layer1, conv3_x corresponds to layer2, conv4_x corresponds to layer3, and conv5_x corresponds to layer4. The "×2", "×3", etc. in the box indicate that the layer is composed of several identical structures.

[0075] In this embodiment, a computer device acquires an image to be processed and preprocesses it to obtain a set of feature matrices. Each feature matrix in the set undergoes a DCT transformation to obtain vertical, horizontal, and diagonal feature matrices. Then, feature recoding and inverse DCT transformation are performed on the vertical, horizontal, and diagonal feature matrices to obtain the first, second, and third features of each feature matrix. Based on these features, a target prediction result for the image to be processed is obtained. By processing the image using this method, different regions of the image are identified, and the target prediction result is determined based on each feature, thereby improving the accuracy of image recognition.

[0076] Based on the above description of the image processing method, this application discloses another image processing method, please refer to... Figure 7 This is a flowchart illustrating another image processing method disclosed in an embodiment of this application, which may specifically include the following steps:

[0077] S701. The computer device performs color space conversion on the image to be processed, obtaining the image to be processed in the YUV color space of the brightness-hue-saturation system.

[0078] S702. The computer device resamples the image to be processed in the YUV color space to obtain the resampled image to be processed.

[0079] S703. The computer equipment performs mean filtering on the resampled image to be processed, and obtains the filtered image to be processed.

[0080] S704. The computer equipment performs image segmentation processing on the filtered image to obtain a set of feature matrices of the image to be processed.

[0081] S705. The computer device performs DCT transformation on the target feature matrix of the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix.

[0082] S706 and the computer equipment perform feature recoding and DCT inverse transformation on the vertical region feature matrix, the horizontal region feature matrix and the diagonal region feature matrix respectively to obtain the first feature, the second feature and the third feature of the target feature matrix.

[0083] S707. The computer device uses each feature matrix in the feature matrix set as the target feature matrix to obtain the first feature, second feature, and third feature of each feature matrix.

[0084] S708, The computer device determines the first feature, second feature, and third feature of the image to be processed based on the first feature, second feature, and third feature of each feature matrix.

[0085] S709. The computer device determines the target prediction result of the image to be processed based on the first feature, the second feature, and the third feature of the image to be processed.

[0086] The above steps S701 to S709 have already been completed. Figure 2 The corresponding embodiments have been described in detail, and the steps will not be described again here. Optionally, the above steps S701 to S709 can be simplified as follows: Figure 8 The flowchart shown mainly includes seven steps: pre-filtering, image segmentation, DCT transform, feature recoding, inverse DCT transform, image stitching, classification model, and aggregation. Figure 8The flowchart shown can be summarized as follows: An input image is first pre-filtered to remove outliers; then, the pre-filtered image is segmented into several small matrices; each small matrix undergoes a Directional Transform (DCT) and is divided into multiple channels for feature recoding, making it robust against attacks; the feature recoding of each channel's small matrix is ​​kept secret from the attacker, preventing them from creating adversarial examples through gradient propagation; next, an inverse DCT is performed to restore the input image to its recoded form, which is then passed to a classifier for classification; finally, the results from each classifier are aggregated to obtain the final classification result. These operations effectively defend against adversarial examples and improve the classification accuracy of the classifier.

[0087] pass Figure 8 To illustrate the processing procedure, the image to be processed undergoes pre-filtering, image segmentation, and DCT transformation to obtain N feature matrices. These N feature matrices are then input into three channels for processing. Taking the V channel as an example, after inputting the first feature matrix into the V channel, feature recoding and inverse DCT transformation are performed to obtain the first feature of the first feature matrix. Similarly, the second feature matrix is ​​input into the V channel to obtain the first feature of the second feature matrix, and so on, until the Nth feature matrix is ​​input into the V channel. Then, feature recoding and inverse DCT transformation are performed to obtain the first feature of the Nth feature matrix. The first features of the first feature matrix to the first feature of the Nth feature matrix are then concatenated in module 801 to obtain a matrix of the same size as the image to be processed, thus obtaining the first feature of the image to be processed. Furthermore, the first feature of the image to be processed is input into the classifier in 802 to obtain the first prediction result of the image to be processed. Similarly, the H and D channels are processed in the same way. The H channel yields the second prediction result of the image to be processed, and the D channel yields the third prediction result of the image to be processed. Finally, the first, second, and third prediction results of the image to be processed are aggregated to obtain the final target prediction result of the image to be processed.

[0088] Based on the above method embodiments, this application also provides a schematic diagram of the structure of an image processing apparatus. See also... Figure 9 This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application. Figure 9 The image processing apparatus shown can operate the following units:

[0089] The acquisition unit 901 is used to acquire the image to be processed and preprocess the image to be processed to obtain a feature matrix set of the image to be processed. The feature matrix set includes the feature matrix corresponding to each image region in the image to be processed.

[0090] Processing unit 902 is used to perform DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix;

[0091] The processing unit 902 is further configured to perform feature recoding and DCT inverse transformation on the vertical region feature matrix, the horizontal region feature matrix and the diagonal region feature matrix to obtain the first feature, the second feature and the third feature of the target feature matrix, respectively.

[0092] The processing unit 902 is further configured to use each feature matrix in the feature matrix set as the target feature matrix to obtain the first feature, the second feature and the third feature of each feature matrix, and to obtain the target prediction result of the image to be processed based on the first feature, the second feature and the third feature of each feature matrix.

[0093] In a feasible embodiment, the processing unit 902 obtains the target prediction result of the image to be processed based on the first feature, second feature, and third feature of each feature matrix, and can be specifically used for:

[0094] The first feature, second feature, and third feature of the image to be processed are determined based on the first feature, second feature, and third feature of each feature matrix;

[0095] The target prediction result of the image to be processed is determined based on the first feature, the second feature, and the third feature of the image to be processed.

[0096] In a feasible embodiment, the processing unit 902 determining the first feature, second feature, and third feature of the image to be processed based on the first feature, second feature, and third feature of each feature matrix can be specifically used for:

[0097] The first feature of the image to be processed is obtained by concatenating the first features of each feature matrix, the second feature of the image to be processed is obtained by concatenating the second features of each feature matrix, and the third feature of the image to be processed is obtained by concatenating the third features of each feature matrix.

[0098] In a feasible embodiment, the processing unit 902 obtains the target prediction result of the image to be processed based on the first feature, the second feature, and the third feature of the image to be processed, and can be specifically used for:

[0099] A classification model is used to classify the first feature, the second feature, and the third feature of the image to be processed, to obtain the first prediction result, the second prediction result, and the third prediction result of the image to be processed.

[0100] The first prediction result, the second prediction result, and the third prediction result of the image to be processed are aggregated to determine the target prediction result of the image to be processed.

[0101] In one feasible embodiment, the processing unit 902 preprocesses the image to be processed to obtain a feature matrix set of the image to be processed, which can be specifically used for:

[0102] The image to be processed is pre-filtered to remove outliers, resulting in a filtered image. The outliers are measured values ​​whose deviation from the mean exceeds N times the standard deviation, where N is an integer greater than or equal to 1.

[0103] The filtered image to be processed is subjected to image segmentation processing to obtain the feature matrix set of the image to be processed.

[0104] In a feasible embodiment, the processing unit 902 performs feature recoding and inverse DCT transformation on the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix to obtain the first feature, the second feature, and the third feature of the target feature matrix, which can be specifically used for:

[0105] The vertical region feature matrix is ​​input into the vertical region channel and re-encoded to obtain the encoded vertical region feature matrix; the horizontal region feature matrix is ​​input into the horizontal region channel and re-encoded to obtain the encoded horizontal region feature matrix; the diagonal region feature matrix is ​​input into the diagonal region channel and re-encoded to obtain the encoded diagonal region feature matrix.

[0106] Perform inverse DCT transformation on the encoded vertical region feature matrix, the encoded horizontal region feature matrix, and the encoded diagonal region feature matrix respectively to obtain the first feature of the vertical region feature matrix, the second feature of the horizontal region feature matrix, and the third feature of the diagonal region feature matrix;

[0107] The first feature of the vertical region feature matrix is ​​used as the first feature of the target feature matrix, the second feature of the horizontal region feature matrix is ​​used as the second feature of the target feature matrix, and the third feature of the diagonal region feature matrix is ​​used as the third feature of the target feature matrix.

[0108] In a feasible embodiment, before preprocessing the image to be processed, the processing unit 902 is further configured to:

[0109] The image to be processed is converted from the RGB color space to the YUV color space.

[0110] The image to be processed in the YUV color space is resampled.

[0111] After the resampling process is performed, the step of preprocessing the image to be processed is executed.

[0112] According to one embodiment of this application, Figure 2 as well as Figure 7 The image processing method shown can involve various steps that can be derived from... Figure 9 This is performed by the individual units in the image processing apparatus shown. For example, Figure 2 In the image processing method shown, step S201 can be performed by... Figure 9 The acquisition unit 901 in the image processing apparatus shown executes the steps S202-S204, which can be performed by... Figure 9 The image processing unit 902 in the illustrated image processing apparatus performs the operation; for example, Figure 7 In the image processing method shown, steps S701-S709 can be derived from... Figure 9 The processing unit 902 in the image processing apparatus shown performs the operation.

[0113] According to another embodiment of this application, Figure 9 The various units in the image processing apparatus shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the image processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0114] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 2 as well as Figure 7 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 9 The image processing apparatus shown herein, and the image processing method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer-readable storage medium, loaded onto a computer device via the computer-readable storage medium, and executed therein.

[0115] In this embodiment, a computer device acquires an image to be processed and preprocesses it to obtain a set of feature matrices. Each feature matrix in the set undergoes a DCT transformation to obtain vertical, horizontal, and diagonal feature matrices. Then, feature recoding and inverse DCT transformation are performed on the vertical, horizontal, and diagonal feature matrices to obtain the first, second, and third features of each feature matrix. Based on these features, a target prediction result for the image to be processed is obtained. By processing the image using this method, different regions of the image are identified, and the target prediction result is determined based on each feature, thereby improving the accuracy of image recognition.

[0116] Based on the above methods and apparatus embodiments, this application provides a computer device. See also... Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 10 The computer device shown includes at least a processor 1001, an input interface 1002, an output interface 1003, and a computer storage medium 1004. The processor 1001, input interface 1002, output interface 1003, and computer storage medium 1004 can be connected via a bus or other means.

[0117] The computer storage medium 1004 can be stored in the memory of the computer device. The computer storage medium 1004 is used to store computer programs, which include program instructions. The processor 1001 is used to execute the program instructions stored in the computer storage medium 1004. The processor 1001 (or CPU (Central Processing Unit)) is the computing and control core of the computer device. It is suitable for implementing one or more instructions, specifically for loading and executing one or more computer instructions to achieve corresponding methods or functions.

[0118] This application embodiment also provides a computer storage medium (memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer storage medium provides storage space that stores the operating system of the computer device. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by the processor 1001, which can be one or more computer programs (including program code). It should be noted that the computer storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer storage medium located remotely from the aforementioned processor.

[0119] In one embodiment, the computer storage medium may be loaded by the processor 1001 and one or more instructions stored in the computer storage medium may be executed to achieve the aforementioned related... Figure 2 as well as Figure 7 The corresponding steps of the image processing method shown. In specific implementation, one or more instructions in the computer storage medium are loaded by the processor 1001 and executed as follows:

[0120] The image to be processed is acquired and preprocessed to obtain a feature matrix set of the image to be processed, wherein the feature matrix set includes the feature matrix corresponding to each image region in the image to be processed;

[0121] Perform DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix;

[0122] The vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix are all subjected to feature recoding and inverse DCT transformation to obtain the first feature, the second feature, and the third feature of the target feature matrix, respectively.

[0123] Each feature matrix in the set of feature matrices is used as the target feature matrix to obtain the first feature, the second feature, and the third feature of each feature matrix, and the target prediction result of the image to be processed is obtained based on the first feature, the second feature, and the third feature of each feature matrix.

[0124] In a feasible embodiment, the processor 1001 obtains the target prediction result of the image to be processed based on the first feature, the second feature, and the third feature of each feature matrix, including:

[0125] The first feature, second feature, and third feature of the image to be processed are determined based on the first feature, second feature, and third feature of each feature matrix;

[0126] In one feasible embodiment, the target prediction result of the image to be processed is determined based on a first feature, a second feature, and a third feature of the image to be processed.

[0127] The processor 1001 determines the first feature, second feature, and third feature of the image to be processed based on the first feature, second feature, and third feature of each feature matrix, including:

[0128] The first feature of the image to be processed is obtained by concatenating the first features of each feature matrix, the second feature of the image to be processed is obtained by concatenating the second features of each feature matrix, and the third feature of the image to be processed is obtained by concatenating the third features of each feature matrix.

[0129] In a feasible embodiment, the processor 1001 obtains the target prediction result of the image to be processed based on a first feature, a second feature, and a third feature of the image to be processed, including:

[0130] A classification model is used to classify the first feature, the second feature, and the third feature of the image to be processed, to obtain the first prediction result, the second prediction result, and the third prediction result of the image to be processed.

[0131] The first prediction result, the second prediction result, and the third prediction result of the image to be processed are aggregated to determine the target prediction result of the image to be processed.

[0132] In one feasible embodiment, the processor 1001 preprocesses the image to be processed to obtain a feature matrix set of the image to be processed, including:

[0133] The image to be processed is pre-filtered to remove outliers, resulting in a filtered image. The outliers are measured values ​​whose deviation from the mean exceeds N times the standard deviation, where N is an integer greater than or equal to 1.

[0134] The filtered image to be processed is subjected to image segmentation processing to obtain the feature matrix set of the image to be processed.

[0135] In a feasible embodiment, the processor 1001 performs feature recoding and inverse DCT transform on the vertical region feature matrix, the horizontal region feature matrix, and the diagonal region feature matrix to obtain the first feature, the second feature, and the third feature of the target feature matrix, respectively, including:

[0136] The vertical region feature matrix is ​​input into the vertical region channel and re-encoded to obtain the encoded vertical region feature matrix; the horizontal region feature matrix is ​​input into the horizontal region channel and re-encoded to obtain the encoded horizontal region feature matrix; the diagonal region feature matrix is ​​input into the diagonal region channel and re-encoded to obtain the encoded diagonal region feature matrix.

[0137] Perform inverse DCT transformation on the encoded vertical region feature matrix, the encoded horizontal region feature matrix, and the encoded diagonal region feature matrix respectively to obtain the first feature of the vertical region feature matrix, the second feature of the horizontal region feature matrix, and the third feature of the diagonal region feature matrix;

[0138] The first feature of the vertical region feature matrix is ​​used as the first feature of the target feature matrix, the second feature of the horizontal region feature matrix is ​​used as the second feature of the target feature matrix, and the third feature of the diagonal region feature matrix is ​​used as the third feature of the target feature matrix.

[0139] In a feasible embodiment, before preprocessing the image to be processed, the processor 1001 is further configured to:

[0140] The image to be processed is converted from the RGB color space to the YUV color space.

[0141] The image to be processed in the YUV color space is resampled.

[0142] After the resampling process is performed, the step of preprocessing the image to be processed is executed.

[0143] In this embodiment, a computer device acquires an image to be processed and preprocesses it to obtain a set of feature matrices. Each feature matrix in the set undergoes a DCT transformation to obtain vertical, horizontal, and diagonal feature matrices. Then, feature recoding and inverse DCT transformation are performed on the vertical, horizontal, and diagonal feature matrices to obtain the first, second, and third features of each feature matrix. Based on these features, a target prediction result for the image to be processed is obtained. By processing the image using this method, different regions of the image are identified, and the target prediction result is determined based on each feature, thereby improving the accuracy of image recognition.

[0144] According to one aspect of this application, an embodiment of this application also provides a computer product, which includes a computer program stored in a computer-readable storage medium. A processor 1001 reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform... Figure 2 as well as Figure 7 The image processing method shown.

[0145] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0146] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, and the division of the units described above is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0147] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An image processing method, characterized in that, The method includes: The image to be processed is acquired and preprocessed to obtain a feature matrix set of the image to be processed, wherein the feature matrix set includes the feature matrix corresponding to each image region in the image to be processed; Perform DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix, and discard the feature matrix of the low frequency region. In the vertical region channel, feature recoding and inverse DCT transformation are performed on the vertical region feature matrix to obtain the first feature of the target feature matrix. In the horizontal region channel, feature recoding and inverse DCT transformation are performed on the horizontal region feature matrix to obtain the second feature of the target feature matrix. In the diagonal region channel, feature recoding and inverse DCT transformation are performed on the diagonal region feature matrix to obtain the third feature of the target feature matrix. The feature recoding involves applying random noise to the 4... Feature recoding is performed in 4 partitions, corresponding to 8 different locations in the original image. The 4 used in the 8 small matrix The random noise of the four matrices is different; Each feature matrix in the feature matrix set is used as the target feature matrix to obtain a first feature, a second feature, and a third feature of each feature matrix. The target prediction result of the image to be processed is obtained based on the first feature, the second feature, and the third feature of each feature matrix. The target prediction result is obtained by aggregating the first prediction result determined by the first feature of each feature matrix, the second prediction result determined by the second feature of each feature matrix, and the third prediction result determined by the third feature of each feature matrix.

2. The method according to claim 1, characterized in that, The step of obtaining the target prediction result of the image to be processed based on the first feature, second feature, and third feature of each feature matrix includes: The first feature, second feature, and third feature of the image to be processed are determined based on the first feature, second feature, and third feature of each feature matrix; The target prediction result of the image to be processed is determined based on the first feature, the second feature, and the third feature of the image to be processed.

3. The method according to claim 2, characterized in that, The step of determining the first feature, second feature, and third feature of the image to be processed based on the first feature, second feature, and third feature of each feature matrix includes: The first feature of the image to be processed is obtained by concatenating the first features of each feature matrix, the second feature of the image to be processed is obtained by concatenating the second features of each feature matrix, and the third feature of the image to be processed is obtained by concatenating the third features of each feature matrix.

4. The method according to claim 2, characterized in that, Determining the target prediction result of the image to be processed based on the first feature, the second feature, and the third feature of the image to be processed includes: A classification model is used to classify the first feature, the second feature, and the third feature of the image to be processed, to obtain the first prediction result, the second prediction result, and the third prediction result of the image to be processed. The first prediction result, the second prediction result, and the third prediction result of the image to be processed are aggregated to determine the target prediction result of the image to be processed.

5. The method according to claim 1, characterized in that, The preprocessing of the image to be processed to obtain the feature matrix set of the image to be processed includes: The image to be processed is pre-filtered to remove outliers, resulting in a filtered image. The outliers are measured values ​​whose deviation from the mean exceeds N times the standard deviation, where N is an integer greater than or equal to 1. The filtered image to be processed is subjected to image segmentation processing to obtain the feature matrix set of the image to be processed.

6. The method according to claim 1, characterized in that, The process involves performing feature recoding and inverse DCT transformation on the vertical region feature matrix in the vertical region channel to obtain the first feature of the target feature matrix; performing feature recoding and inverse DCT transformation on the horizontal region feature matrix in the horizontal region channel to obtain the second and third features of the target feature matrix; and performing feature recoding and inverse DCT transformation on the diagonal region feature matrix in the diagonal region channel to obtain the third feature of the target feature matrix, including: The vertical region feature matrix is ​​input into the vertical region channel and re-encoded to obtain the encoded vertical region feature matrix; the encoded vertical region feature matrix is ​​then subjected to inverse DCT transformation to obtain the first feature of the vertical region feature matrix. The horizontal region feature matrix is ​​input into the horizontal region channel and re-encoded to obtain the encoded horizontal region feature matrix; the encoded horizontal region feature matrix is ​​then subjected to inverse DCT transformation to obtain the second feature of the horizontal region feature matrix. The diagonal region feature matrix is ​​input into the diagonal region channel and re-encoded to obtain the encoded diagonal region feature matrix; the encoded diagonal region feature matrix is ​​then subjected to inverse DCT transformation to obtain the third feature of the diagonal region feature matrix. The first feature of the vertical region feature matrix is ​​used as the first feature of the target feature matrix, the second feature of the horizontal region feature matrix is ​​used as the second feature of the target feature matrix, and the third feature of the diagonal region feature matrix is ​​used as the third feature of the target feature matrix.

7. The method according to claim 1, characterized in that, Before preprocessing the image to be processed, the method includes: The image to be processed is converted from the RGB color space to the YUV color space. The image to be processed in the YUV color space is resampled. After the resampling process is performed, the step of preprocessing the image to be processed is executed.

8. An image processing apparatus, characterized in that, The device includes: An acquisition unit is used to acquire an image to be processed and preprocess the image to be processed to obtain a feature matrix set of the image to be processed, wherein the feature matrix set includes: the feature matrix corresponding to each image region in the image to be processed; The processing unit is used to perform DCT transformation on the target feature matrix in the feature matrix set to obtain the vertical region feature matrix, horizontal region feature matrix and diagonal region feature matrix of the target feature matrix, and discard the feature matrix of the low frequency region. The processing unit is further configured to perform feature recoding and inverse DCT transformation on the vertical region feature matrix in the vertical region channel to obtain the first feature of the target feature matrix; perform feature recoding and inverse DCT transformation on the horizontal region feature matrix in the horizontal region channel to obtain the second feature of the target feature matrix; and perform feature recoding and inverse DCT transformation on the diagonal region feature matrix in the diagonal region channel to obtain the third feature of the target feature matrix; wherein, feature recoding is performed by applying random noise to the 4-bit feature matrix corresponding to each channel. Feature recoding is performed in 4 partitions, corresponding to 8 different locations in the original image. The 4 used in the 8 small matrix The random noise of the four matrices is different; The processing unit is further configured to use each feature matrix in the feature matrix set as the target feature matrix to obtain a first feature, a second feature, and a third feature of each feature matrix, and to obtain a target prediction result of the image to be processed based on the first feature, the second feature, and the third feature of each feature matrix. The target prediction result is obtained by aggregating the first prediction result determined by the first feature of each feature matrix, the second prediction result determined by the second feature of each feature matrix, and the third prediction result determined by the third feature of each feature matrix.

9. A computer device, characterized in that, The computer device includes: A processor, suitable for implementing one or more computer programs; and, A computer storage medium storing one or more computer programs adapted to be loaded by the processor and executed as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more computer programs adapted to be loaded by a processor and executed by the image processing method as described in any one of claims 1-7.