Image recognition system and method based on quantum support vector machine
The image recognition system based on quantum support vector machines solves the problems of high-dimensional data processing and complex feature mapping, achieves efficient image recognition, improves accuracy and recall, and is adaptable to different application scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies struggle to effectively handle high-dimensional data, construct complex feature maps, and improve computational efficiency in the field of image recognition, and traditional support vector machines face challenges in this regard.
An image recognition system based on quantum support vector machines is adopted, including an image preprocessing module, a quantum computing module, and a classical computing module. Through unified grayscale, size standardization, entanglement perception hybrid dimensionality reduction and normalization processing, combined with quantum kernel matrix calculation and classical support vector machine training, efficient image recognition is achieved.
Quantum support vector machines improve the accuracy, precision, and recall of image recognition, enhance classification performance, and excel in complex data processing, while also offering a flexible and scalable architecture.
Smart Images

Figure CN121767686A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an image recognition system and method based on quantum support vector machines. Background Technology
[0002] Support Vector Machine (SVM), a classic machine learning algorithm, has demonstrated significant application value in image recognition and classification since its development in the 1990s. Based on the principle of minimizing structural risk, it achieves pattern recognition by finding the optimal classification hyperplane, making it particularly suitable for handling high-dimensional data and nonlinear classification problems. With the widespread application of image recognition technology in fields such as medical diagnosis, industrial inspection, remote sensing monitoring, and security surveillance, SVM has received continuous attention due to its powerful generalization ability and excellent handling of small sample data.
[0003] Although traditional machine learning techniques have achieved remarkable results in tasks such as image recognition through feature extraction and classifier optimization, they still face serious challenges in processing high-dimensional data, constructing complex feature maps, and improving computational efficiency. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide an image recognition system and method based on quantum support vector machines.
[0005] To achieve the above objectives, the technical solution provided by this invention is as follows: An image recognition system based on quantum support vector machines includes an image processing module for preprocessing input images, a quantum computing module for calculating quantum kernel matrices, and a classical computing module for controlling the process, training the model, and outputting results. The image processing module includes: A unified grayscale processing unit is used to convert input images from different channels into single-channel grayscale data. Size normalization unit is used to scale grayscale images to a fixed resolution; Entanglement-aware hybrid dimensionality reduction unit is used for nonlinear dimensionality reduction based on the fusion of mutual information matrix and covariance matrix; The normalization processing unit is used to map the dimensionality-reduced data to the angle range of the quantum rotation gate to obtain the preprocessed data; The quantum computing module includes: The data encoding unit is used to map the preprocessed data into quantum states through angle encoding. A quantum evolution unit is used to apply parameterized quantum circuits to the encoded state for feature mapping; A quantum measurement unit used to estimate kernel function values via quantum measurement; The classical computing module includes: Generate kernel matrix units, used to coordinate the quantum computing module to generate the complete kernel matrix; A classic support vector machine training unit is used to train a classification model based on the kernel matrix. The output prediction result unit is used to predict new data using the trained classification model.
[0006] Furthermore, to achieve the above objectives, the present invention also provides an image recognition method based on quantum support vector machines, implemented using the aforementioned image recognition system based on quantum support vector machines, comprising: S1. Image preprocessing: Image data is received and processed sequentially through a unified grayscale processing unit, a size standardization unit, an entanglement-aware hybrid dimensionality reduction unit, and a normalization processing unit to obtain preprocessed data. S2, Quantum Kernel Estimation: S2-1. The preprocessed data is mapped by angle encoding using the data encoding unit to obtain the quantum state; S2-2. The encoded quantum state is evolved by applying a parameterized quantum circuit to the quantum evolution unit to obtain the evolved quantum state. S2-3. The evolved quantum state is measured by a quantum measurement unit to estimate the inner product between any two data points as the kernel function value. S2-4. Generate the nuclear matrix unit collaborative quantum computing module, repeat S2-1 to S2-3, and generate the complete nuclear matrix; S3. Classical Model Training and Prediction: S3-1. Input the complete kernel matrix into the classical support vector machine training unit for training to obtain the classification model.
[0007] S3-2. Use the trained classification model to classify and predict new image data to be identified.
[0008] Furthermore, the hybrid dimensionality reduction processing of entanglement perception includes: Calculate the covariance matrix of the standardized image data. : ; Corresponding to the Feature vectors of each sample; This is the sample mean vector; The number of samples; the mutual information matrix With standard covariance matrix Combined, construct the entanglement-perceptual divergence matrix : ; Weights are used to balance linear variance and nonlinear correlation in order to harmonize hyperparameters; For the entangled sensing divergence matrix Perform eigenvalue decomposition to obtain the feature matrix with eigenvalues arranged in descending order; ; in The characteristic matrix, ; Based on a preset information retention threshold, select the previous The eigenvectors corresponding to the largest eigenvalues Construct the projection matrix, where The minimum number of qubits required to satisfy the information retention condition; The dimensionality of the standardized image data is reduced using a projection matrix to obtain the dimensionality-reduced data: .
[0009] Furthermore, mutual information matrix any two pixel features and mutual information Calculation based on joint histogram: ; in, and Corresponding pixel features and Specific grayscale intensity values pixel features and The joint probability distribution, and This represents a marginal probability distribution.
[0010] Furthermore, the smallest number of qubits Satisfy the following formula: .
[0011] Furthermore, the preprocessed data undergoes angle encoding mapping, including: Preprocessed data Each feature component Rotation angle mapped to qubit , =1,2,…, ; The number of qubits; For each qubit Executing a quantum rotating door The operation encodes the preprocessed data into a quantum state, wherein, ; Rotation angle The range of values for is [ ], It is an imaginary number.
[0012] Furthermore, in step S2-2, the quantum evolution unit performs an inverse encoding operation on the data points, that is, applies... conjugate transpose To achieve superposition interference of two-way quantum states to ensure the symmetry of the kernel function.
[0013] Further, in steps S2-3, the quantum measurement unit employs ground-state probability measurement, projecting the quantum state onto the subspace corresponding to the ground state through projection measurement, and calculating the probability distribution of each quantum state in that subspace. The ground-state projection measurement operator is... For any Quantum bit system The probability corresponding to the measurement result for: ; Kernel function value , Let be any two data points.
[0014] Furthermore, in the classical support vector machine training unit, the pre-computed kernel matrix is input into the classical support vector machine model to construct a classification hyperplane in the high-dimensional feature space; wherein, the training kernel function matrix is: ; in and It is the index of the training samples. The training set represents the first... One sample point, The training set represents the first... One sample point; The test kernel function matrix is defined as follows: ; in Indicates the first test set One sample point, Indicates the first test set 1 sample point.
[0015] Furthermore, the unified grayscale processing unit processes the following steps: If the input image is a grayscale image, it is first converted into a pseudo-color image to achieve channel standardization, and then the image is grayscaled using ITU-R BT.601 standard coefficients. The grayscale calculation formula is as follows: ; in, 、 、 Representing pixels The red, green, and blue channel values.
[0016] Compared with existing technologies, the principles and advantages of this technical solution are as follows: 1. High preprocessing accuracy: The problem of inconsistent input image formats is solved by "unified grayscale + size standardization" to ensure the uniformity of data interface; the entanglement-aware hybrid dimensionality reduction unit combines mutual information matrix and covariance matrix to capture nonlinear correlation of data, retaining key features while adapting to the number of qubits, and the data after dimensionality reduction is more in line with the characteristics of quantum computing.
[0017] 2. Quantum computing has significant advantages: angle encoding efficiently maps classical data, parameterized quantum circuits realize high-dimensional feature mapping, and ground state probability measurement simplifies kernel function calculation; quantum superposition and entanglement characteristics enhance the expressive power of kernel functions and can handle complex data patterns that are difficult for classical SVM to fit.
[0018] 3. Excellent classification performance: Experiments based on the publicly available dataset "AiGeneratedDogs.jpgVsRealDogs.jpg" (licensed by CC0PublicDomain) on the Kaggle platform show that the quantum support vector machine (QSVM) of this invention improves accuracy by 8.08% (0.7677 vs 0.6869), precision by 9.2% (0.7647 vs 0.6727), recall by 4% (0.7800 vs 0.7400), and F1 score by 6.75% (0.7723 vs 0.7048) compared to the classical SVM. It also performs better in class balance and control of the positive class false negative rate.
[0019] 4. Flexible and scalable architecture: The image processing module, quantum computing module, and classical computing module have separate responsibilities and can be independently optimized and upgraded; each unit provides alternative solutions (such as the encoding method can be replaced with amplitude encoding, dimensionality reduction can be replaced with autoencoder, and classical model can be replaced with kernel ridge regression) to adapt to different application scenarios. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the services required in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a structural block diagram of an image recognition system based on a quantum support vector machine according to an embodiment of the present invention; Figure 2 This is a structural block diagram of an image processing module in an image recognition system based on a quantum support vector machine, according to an embodiment of the present invention. Figure 3 This is a structural block diagram of a quantum computing module in an image recognition system based on a quantum support vector machine, according to an embodiment of the present invention. Figure 4 This is a block diagram of the classical computing module in an image recognition system based on a quantum support vector machine, according to an embodiment of the present invention. Figure 5 This is a flowchart illustrating the principle of an image recognition method based on quantum support vector machines according to an embodiment of the present invention. Detailed Implementation
[0022] The present invention will be further described below with reference to specific embodiments: As shown in Figure 1, the image recognition system based on quantum support vector machine described in this embodiment includes an image processing module for preprocessing the input image, a quantum computing module for calculating the quantum kernel matrix, and a classical computing module for controlling the process, training the model, and outputting the results.
[0023] Among them, such as Figure 2 As shown, the image processing module includes: The unified grayscale processing unit is used to convert input images with different channels into single-channel grayscale data. The reason for this design is that input images may contain grayscale or color images, representing single-channel and three-channel data respectively. Different channel numbers can lead to inconsistencies in subsequent processing. Therefore, when encountering a grayscale image, it is first converted to a pseudo-color image to standardize the channels. Then, the image is uniformly converted to grayscale to reduce computational load and eliminate color interference. Size normalization unit, used to scale grayscale images to 32*32 resolution; Entanglement-aware hybrid dimensionality reduction unit is used for nonlinear dimensionality reduction based on the fusion of mutual information matrix and covariance matrix. The reason for the design of the entanglement-aware hybrid dimensionality reduction unit is to take into account the limitation of the number of qubits and the need to eliminate the difference in dimensions, while traditional PCA dimensionality reduction can only take into account the linear variance of the data. The normalization processing unit is used to map the dimensionality-reduced data to the angle range of the quantum rotation gate to obtain the preprocessed data.
[0024] like Figure 3 As shown, the quantum computing module includes: The data encoding unit maps preprocessed data to quantum states using angle encoding; the angle encoding used maps pixel data to rotation angles. Dimensional data correspondence Each quantum bit preserves the original data distribution while reducing dimensionality compression loss; Quantum evolution units are used to apply parameterized quantum circuits (PQCs) to encoded states to implicitly map data to Hilbert space; A quantum measurement unit is used to estimate the kernel function value, i.e., the inner product of two data points in the quantum feature space, through quantum measurement.
[0025] like Figure 4 As shown, the classical computing module includes: The kernel matrix generation unit is used to coordinate the quantum computing module to generate a complete kernel matrix; the classical support vector machine training unit is used to train a classification model based on the kernel matrix; and the prediction result output unit is used to predict new data using the trained classification model.
[0026] like Figure 5 As shown, the working process of an image recognition system based on quantum support vector machines includes: S1. Image preprocessing: Image data is received and processed sequentially through a unified grayscale processing unit, a size standardization unit, an entanglement-aware hybrid dimensionality reduction unit, and a normalization processing unit to obtain preprocessed data. In this step, the unified grayscale processing unit processes the image as follows: If the input image is a grayscale image, it is first converted into a pseudo-color image to achieve channel standardization, and then the image is grayscaled using ITU-R BT.601 standard coefficients. The grayscale calculation formula is as follows: ; in, 、 、 Representing pixels The red, green, and blue channel values.
[0027] The size normalization unit normalizes the image size, scaling the image uniformly to a 32*32 resolution.
[0028] The processing steps of the entanglement-aware hybrid dimensionality reduction unit include: calculating the covariance matrix of the standardized image data. : ; Corresponding to the Feature vectors of each sample; The sample mean vector; the mutual information matrix With standard covariance matrix Combined, construct the entanglement-perceptual divergence matrix : ; Weights are used to balance linear variance and nonlinear correlation in order to harmonize hyperparameters; Mutual information matrix any two pixel features and mutual information Calculation based on joint histogram: ; in, and Corresponding pixel features and Specific grayscale intensity values pixel features and The joint probability distribution, and This represents a marginal probability distribution.
[0029] For the entangled sensing divergence matrix Perform eigenvalue decomposition to obtain the feature matrix with eigenvalues arranged in descending order; ; in It is the characteristic matrix, and ; To achieve an optimal balance between information retention and computational feasibility, ensuring that subsequent quantum circuits are neither too difficult to simulate due to excessive qubit counts nor suffer from excessive information loss affecting classification accuracy, this embodiment selects the preceding information based on a preset information retention threshold. The eigenvectors corresponding to the largest eigenvalues Construct the projection matrix, where The minimum number of qubits required to satisfy the information retention condition. Satisfy the following formula: .
[0030] The dimensionality of the standardized image data is reduced using a projection matrix to obtain the dimensionality-reduced data: .
[0031] The normalization processing unit will reduce the dimensionality of the data. Normalized to [ The interval is set to meet the angle requirements of the rotating gate in quantum support vector machines and eliminate dimensional differences.
[0032] S2, Quantum Kernel Estimation: S2-1. The preprocessed data is mapped by angle encoding using the data encoding unit to obtain the quantum state; The basic unit of information in quantum computing is the qubit. A qubit in a quantum superposition state is usually represented as:
[0033] in, and The superposition coefficients of quantum states satisfy the normalization condition. .
[0034] In the angle encoding process, the input data samples are first... Each feature component Rotation angle mapped to qubit , = 1,2,…, Then, for each qubit Executing a quantum rotating door Operation, among which It is an imaginary number.
[0035]
[0036] It is important to note that angle encoding has certain requirements for classical data; the dimension of the input parameters must equal the number of qubits, otherwise a dimension error will be triggered; rotation angle The range of values is [ The range is defined to avoid phase confusion caused by angle overflow.
[0037] S2-2. The encoded quantum state is evolved by applying a parameterized quantum circuit to the quantum evolution unit to obtain the evolved quantum state. Quantum state evolution using unitary operators Represents. For any unitary operator ,satisfy ; in, It is an operator The conjugate transpose is also The inverse operation. A quantum rotating gate used for angle encoding. It is a positive operator.
[0038] In quantum support vector machine models, kernel functions are an important tool for handling high-dimensional data and solving nonlinear problems. As a special function, the kernel function is used to calculate the inner product of two data points in a high-dimensional feature space, and its definition is as follows:
[0039] in, and Represents two arbitrary data points participating in the kernel calculation. It is to put data points ( The mapping function to a high-dimensional feature space. The properties of the quantum state inner product guarantee the mathematical properties of the kernel function.
[0040] Quantum evolution layer for data points Perform reverse encoding, that is, execute By defining the kernel function, two data points can be computed. and The similarity. If = Then, according to unitarity The quantum state remains unchanged; if ≠ If the quantum state rotates after quantum evolution, the rotation angle is related to the characteristics of the input data.
[0041] S2-3. The evolved quantum state is measured by a quantum measurement unit to estimate the inner product between any two data points as the kernel function value. In this step, the quantum measurement unit employs ground-state probability measurement. It projects the quantum state onto the subspace corresponding to the ground state using projection measurement, and calculates the probability distribution of each quantum state in that subspace. The ground-state projection measurement operator is... For any Quantum bit system The probability corresponding to the measurement result for: ; Kernel function value , Let be any two data points.
[0042] S2-4. Generate the nuclear matrix unit collaborative quantum computing module, repeat S2-1 to S2-3, and generate the complete nuclear matrix; S3. Classical Model Training and Prediction: S3-1. Input the complete kernel matrix into the classical support vector machine training unit for training to obtain the classification model.
[0043] S3-2. Use the trained classification model to classify and predict new image data to be identified.
[0044] In the classic support vector machine (SVM) training unit, the pre-computed kernel matrix is input into the classic SVM model to construct a classification hyperplane in the high-dimensional feature space; the training kernel function matrix is: ; in and It is the index of the training samples. The training set represents the first... One sample point, The training set represents the first... One sample point; The test kernel function matrix is defined as follows: ; in Indicates the first test set One sample point, Indicates the first test set 1 sample point.
[0045] In this embodiment, the problem of inconsistent input image channels is solved by using a "unified grayscale processing unit," ensuring the uniformity of the subsequent quantum coding interface.
[0046] By combining "entanglement-aware hybrid dimensionality reduction units" with "size normalization", the bottleneck of the current limited number of qubits is effectively solved, and high-dimensional image data is intelligently compressed to a scale suitable for quantum circuit processing, while retaining key features.
[0047] By using a "normalization processing unit," classical data is mapped to the angular range of a quantum rotating gate, enabling the data to be processed efficiently and accurately by quantum hardware, thus reducing encoding errors.
[0048] The three modules—image processing, quantum computing, and classical computing—have clearly defined responsibilities, facilitating independent optimization and upgrades.
[0049] By using parameterized quantum circuits to map data to high-dimensional or even infinite-dimensional Hilbert spaces, this quantum feature mapping can automatically generate complex kernel functions that are difficult to simulate on classical computers. This promises to achieve higher classification accuracy than classical support vector machines when processing highly complex, nonlinearly separable image data.
[0050] The data used in the experiment came from a publicly available dataset on the Kaggle platform, titled "AiGenerated Dogs.jpg Vs Real Dogs.jpg". This dataset is a publicly licensed CC0 PublicDomain dataset, so there are no copyright disputes or privacy violations. Quantum Support Vector Machine (QSVM) and classic Support Vector Machine (SVM) models were run on the same dataset, and the evaluation metrics of the two models were compared. The results are shown in Table 1 below.
[0051] Table 1 Comparison of evaluation metrics between QSVM and SVM The data in the table shows that QSVM significantly outperforms SVM in accuracy, precision, recall, and F1 score. The 0.0675 improvement in F1 score indicates that QSVM has better class balance. The improved recall suggests that quantum machine learning has a lower false negative rate for positive classes, meaning that QSVM may be more advantageous in data-sensitive scenarios.
[0052] The above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Therefore, any changes made in accordance with the shape and principle of the present invention should be covered within the protection scope of the present invention.
Claims
1. A quantum support vector machine based image recognition system, characterized in that, The image processing module for pre-processing the input image, the quantum computing module for calculating the quantum kernel matrix, the classical computing module for controlling the flow, training the model and outputting the result; The image processing module comprises: The unified gray processing unit is configured to convert input images of different channels into single-channel gray data uniformly; The size normalization unit is configured to scale the gray image to a fixed resolution; The entanglement-aware hybrid dimension reduction unit is configured to perform nonlinear dimension reduction based on the fusion of the mutual information matrix and the covariance matrix; The normalization processing unit is configured to map the dimension-reduced data to the angle interval of the quantum rotation gate to obtain pre-processed data; The quantum computing module comprises: The data encoding unit is configured to map the pre-processed data to a quantum state through angle encoding; The quantum evolution unit is configured to apply a parameterized quantum circuit to the encoded state to perform feature mapping; The quantum measurement unit is configured to estimate the kernel function value through quantum measurement; The classical computing module comprises: The kernel matrix generation unit is configured to coordinate the quantum computing module to generate a complete kernel matrix; The classical support vector machine training unit is configured to train a classification model based on the kernel matrix; The output prediction result unit is configured to use the trained classification model to predict new data.
2. A quantum support vector machine based image recognition method, implemented by the quantum support vector machine based image recognition system of claim 1, characterized in that, It comprises: S1, image preprocessing: Receive image data, and sequentially perform unified gray processing, size normalization, entanglement-aware dimension reduction based on mutual information and covariance fusion, and normalization processing through the unified gray processing unit, the size normalization unit, the entanglement-aware hybrid dimension reduction unit, and the normalization processing unit to obtain pre-processed data; S2, quantum kernel estimation: S2-1, the data encoding unit is configured to map the pre-processed data to a quantum state through angle encoding; S2-2, the quantum evolution unit is configured to evolve the encoded quantum state by applying a parameterized quantum circuit to obtain an evolved quantum state; S2-3, the quantum measurement unit is configured to estimate the inner product between any two data points as the kernel function value through quantum measurement of the evolved quantum state; S2-4, the kernel matrix generation unit coordinates the quantum computing module to repeat S2-1 to S2-3 to generate a complete kernel matrix; S3, classical model training and prediction: S3-1, input the complete kernel matrix into the classical support vector machine training unit for training to obtain a classification model; S3-2, use the trained classification model to classify and predict new image data to be recognized. 3.The image recognition method based on quantum support vector machine of claim 1, wherein, The entanglement-aware hybrid dimension reduction processing comprises: computing a covariance matrix of the normalized image data : ; Corresponding to the Feature vectors of each sample; This is the sample mean vector; The number of samples; the mutual information matrix With standard covariance matrix Combined, construct the entanglement-perceptual divergence matrix : ; To reconcile hyperparameters, weights for balancing linear variance and nonlinear correlation; on the entangled sensing dispersion matrix performing eigen decomposition to obtain an eigen matrix with eigen values arranged in descending order; ; wherein is a feature matrix, and ; Based on a preset information retention threshold, select the previous d The eigenvectors corresponding to the largest eigenvalues Construct the projection matrix, where d The minimum number of qubits required to satisfy the information retention condition; The projection matrix is used to reduce the dimension of the normalized image data to obtain dimension-reduced data: 。 4. The image recognition method based on quantum support vector machine according to claim 3, characterized in that, Mutual information matrix Any two pixel features And Mutual information Based on joint histogram computation: ; wherein, and corresponding pixel features and a specific gray intensity value, is a pixel feature and a joint probability distribution, and is an edge probability distribution.
5. The image recognition method based on quantum support vector machine according to claim 3, characterized in that, Minimum number of qubits satisfies the following equation: 。 6. The image recognition method based on quantum support vector machine according to claim 2, characterized in that, The pre-processed data is angle-encoded and mapped, which comprises: each feature component of the preprocessed data is mapped to a rotation angle of a qubit , , =1,2,…, ; is the number of qubits; for each qubit performing a quantum rotation gate operating to encode the pre-processed data into a quantum state, wherein, ; Rotation angle is in the range of ], is imaginary.
7. The quantum support vector machine based image recognition method of claim 6, wherein, In step S2-2, the quantum evolution unit performs an inverse encoding operation on the data points, i.e. applies the conjugate transpose of , achieving superposition interference of the two-qubit state to guarantee the symmetry of the kernel function. 8. The image recognition method based on quantum support vector machine according to claim 7, characterized in that, In step S2-3, the quantum measurement unit adopts the ground state probability measurement, projects the quantum state to the subspace corresponding to the ground state by the projection measurement, calculates the probability distribution of each quantum state in the subspace, and the ground state projection measurement operator is For any Quantum bit system , the probability corresponding to the measurement result is : ; kernel function value , is the distance between any two data points.
9. The image recognition method based on quantum support vector machine according to claim 8, characterized in that, In the classical support vector machine training unit, the pre-calculated kernel matrix is input into the classical support vector machine model to construct a classification hyperplane in a high-dimensional feature space; wherein the training kernel function matrix is: ; wherein l and is an index of the training sample, denotes the l-th sample point of the training set, denotes the l-th sample point of the training set; The test kernel function matrix is defined as: ; in Indicates the first test set l One sample point, Indicates the first test set 1 sample point.
10. The image recognition method based on quantum support vector machine according to claim 2, characterized in that, The unified gray processing unit processing process is: if the input image is a gray image, first convert it to a pseudo-color image to realize channel standardization, and then use the ITU-R BT.601 standard coefficient to perform gray processing on the image, and the gray processing formula is: ; in, 、 、 Representing pixels The red, green, and blue channel values.