Image classification method of quantum convolutional neural network based on natural evolution optimizer
By constructing a quantum convolutional neural network based on a natural evolution optimizer, the problems of high computational complexity and training difficulty of quantum convolutional neural networks in image classification are solved, achieving efficient feature extraction and stable image classification.
Patent Information
- Application Number
- CN202511125988.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2045-08-12
AI Technical Summary
Existing quantum convolutional neural networks suffer from problems such as high computational complexity, long training time, insufficient model adaptability, difficulty in parameter training, and poor compatibility with classical computing frameworks in image classification, resulting in low classification accuracy and efficiency.
A quantum convolutional neural network based on a natural evolution optimizer is adopted. An image classification model is constructed by combining quantum encoding, quantum convolutional layers, quantum fully connected layers and a hybrid optimization strategy, along with quantum transformation layers and pooling layers. The model parameters are then optimized by combining the natural evolution strategy with the Adam optimizer.
It achieves progressive feature capture from local to global, improves feature extraction capabilities, enhances model training stability and optimization efficiency, and significantly improves the accuracy and efficiency of image classification.
Smart Images

Figure CN120932016B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of quantum computing technology, and in particular relates to an image classification method based on a quantum convolutional neural network with a natural evolution optimizer. Background Technology
[0002] Image classification, a crucial task in computer vision, has wide applications in autonomous driving, facial recognition, and medical image analysis. Convolutional Neural Networks (CNNs), as the core model of deep learning, excel in image feature extraction and classification. However, they face challenges such as high computational complexity and long training times when processing high-dimensional image data, especially under resource constraints. Quantum computing, as a novel computing paradigm, leverages the superposition, entanglement, and interference properties of quantum mechanics to provide parallel computing capabilities unattainable by traditional methods. Quantum computing demonstrates significant advantages in handling large-scale, high-dimensional data.
[0003] Currently, quantum neural networks still face many key challenges in image classification: Firstly, at the data processing level, it is difficult to efficiently convert image data, and more efficient quantum state encoding schemes need to be developed to adapt to different types of data characteristics; Secondly, in terms of model architecture, due to the lack of versatility of quantum circuit structures, image classification is difficult to flexibly adapt to different types and complexities of image classification tasks. A more general quantum circuit structure needs to be designed. At the same time, there is a "barren plateau phenomenon" that restricts the trainability of parameters. The training process of model parameters becomes extremely difficult. Small adjustments to parameters are unlikely to cause significant changes in model classification performance, making it difficult for the model to be continuously optimized through training. When faced with subtle features of complex images, it cannot accurately learn and distinguish them, thus affecting the accuracy and efficiency of image classification. Finally, in the algorithm optimization stage, the lack of effective training strategies and hyperparameter setting methods makes it difficult to find suitable parameter configurations during training, which may lead to poor model training results and difficulty in achieving ideal classification results. In addition, the model has low compatibility with classical computing frameworks. When processing image data, it may not be able to smoothly call the data processing tools and visualization tools in classical computing frameworks, which increases the difficulty of operation and time cost. Moreover, when interfacing and integrating with existing classical image classification systems, various adaptation problems will also occur, affecting the overall work efficiency. Summary of the Invention
[0004] The technical problem solved by this invention is to provide an image classification method based on a quantum convolutional neural network with a natural evolution optimizer, thereby solving the problems of low accuracy and efficiency in image classification.
[0005] The basic solution provided by this invention is: an image classification method based on a quantum convolutional neural network with a natural evolution optimizer, comprising: S1: Preprocess the input image data; S2: Quantum encoding of the preprocessed data; S3: Construct an image classification model based on a quantum convolutional neural network. The image classification model includes three quantum convolutional layers and a quantum fully connected layer. The three quantum convolutional layers extract low-level local features, mid-level geometric features, and global semantic information of the image data in sequence. Each quantum convolutional layer is followed by a quantum transformation layer for adjusting the quantum state and a quantum pooling layer for dimensionality reduction. The quantum fully connected layer is used to integrate all features and output the classification result. S4: Train the image classification model, use a hybrid optimization strategy combining natural evolution and Adam optimizer to optimize the image classification model, and evaluate the model. S5: Input image data into the image classification model and output the image classification result.
[0006] Preferably, S1 includes, S1-1) Collect image data and add category labels to the data; S1-2) Standardize the image data; S1-3) Dimensionality reduction of image data is achieved through principal component analysis; S1-4) Divide the dimensionality-reduced dataset into training and test sets according to a preset ratio.
[0007] Preferably, the quantum encoding method in S2 adopts one of the following: quantum bit encoding, angle encoding, amplitude encoding, dense quantum bit encoding, and IQP encoding.
[0008] Preferably, in S3, the quantum convolutional layer includes a single-qubit rotation gate and a two-qubit entanglement gate. The rotation gate is used to regulate the quantum state, and the two-qubit entanglement gate is used to introduce quantum entanglement and capture nonlocal features.
[0009] More preferably, the structure of the quantum convolutional layer is represented as follows:
[0010] In the formula, the convolutional layer uses parameterized quantum gates U(θ) to transform the quantum states. It is the first Parameterized quantum gates for each convolutional layer These are the trainable parameters of the convolutional layer.
[0011] Preferably, the mathematical expression for the quantum convolutional layer is as follows:
[0012] in, This represents a parallel operation (tensor product) on N qubits, where the same gate sequence is applied independently to each qubit. , , These represent rotating doors around the X-axis, Y-axis, and z-axis, respectively. This indicates that the gate sequence is repeated twice. This indicates two rotations along the Y-axis. This indicates a CNOT gate with the first qubit as the control bit and the zeroth qubit as the target bit. This represents a standard CNOT gate where the control bit is the 0th qubit and the target bit is the 1st qubit.
[0013] More preferably, in S3, the quantum transformation layer adopts the following structure:
[0014] In the formula, This indicates the measurement projection (usually the measurement auxiliary bits are ). state), Parameterized quantum gates for each pooling layer These are the trainable parameters of the pooling layer.
[0015] More preferably, in S3, the quantum fully connected layer adopts the following structure:
[0016] In the formula, The quantum state of the input image; It is the product of unitary operators with trained parameters in the network's convolutional layers; For quantum transformation layer, For quantum pooling layer, For unitary operators with training parameters in a quantum fully connected layer.
[0017] Preferably, S4 includes S4-1) Initialize the model parameters, randomly initialize the parameters of the quantum convolutional layer, quantum transform layer, and quantum pooling layer; set the hyperparameters of the natural evolution strategy to noise amplitude, population size, and initial learning rate; set the hyperparameters of the Adam optimizer to momentum coefficient and minimum constant. S4-2) Generate perturbation parameters based on the current parameters of the quantum convolutional layer, quantum transformation layer, and quantum pooling layer; calculate the output loss of the quantum circuit for each set of parameters, convert the loss into a reward value and standardize it; calculate multiple perturbations in a weighted manner to obtain the estimated gradient; S4-3) Calculate the first-order momentum and second-order momentum based on the estimated gradient, perform bias correction, and update the model parameters; S4-4) The model is evaluated and validated using a test set, and the parameters of the best-performing model are saved to output the optimal model.
[0018] Preferably, in S4-4, the model is evaluated by calculating accuracy, precision, recall, and F1 score.
[0019] The principles and advantages of this invention are as follows: 1. The image classification model extracts low-level local features (such as edges and textures), mid-level geometric features (such as shape and structure), and global semantic information (such as the overall attributes of objects) sequentially through three quantum convolutional layers. This achieves a progressive capture of features from local to global, which conforms to the hierarchical expression of image features and can more completely uncover the essential information of the image. 2. Gradient estimation using population perturbation and reward mechanisms in the Natural Evolutionary Strategy (NES) is suitable for handling non-convex optimization problems in quantum models caused by measurement noise and complex parameter spaces, enhancing the model's ability to escape local optima. The Adam optimizer uses first-order momentum (momentum term) to accelerate convergence and second-order momentum (adaptive learning rate) to dynamically adjust the parameter update step size, reducing oscillations and improving training stability. This hybrid optimization approach, combining the Natural Evolutionary Strategy (NES) with the Adam optimizer, ensures both global search capability and faster local convergence, effectively improving the training stability and optimization efficiency of quantum neural networks.
[0020] Preferably, in the quantum convolutional layer, the single-qubit rotation gate can flexibly adjust the quantum state, and the two-qubit entanglement gate introduces quantum entanglement, which can capture non-local features that are difficult for traditional convolutional neural networks to handle (such as the correlation between distant pixels in an image), significantly improving the parallel capability of feature extraction and optimization, and is especially suitable for processing high-dimensional images, with more comprehensive hierarchical feature extraction; the quantum transformation layer and pooling layer further optimize the quantum state, reduce dimensionality, reduce redundant information, and improve the effectiveness of features. High-efficiency parallel computing: the superposition and entanglement properties of quantum computing.
[0021] Preferably, multiple quantum encoding methods (qubit encoding, angle encoding, etc.) are provided, and the appropriate encoding method can be selected according to the dimension and complexity of the image data. Quantum encoding is flexible and adaptable to different data. This flexibility enables the model to better convert classical image data into quantum states, retain key information, and lay the foundation for subsequent quantum feature extraction. Attached Figure Description
[0022] Figure 1 This is a flowchart of the present invention; Figure 2The graph shows the changes in training accuracy and loss value for the three types of datasets in this invention under different optimization algorithms. Figure 3 This is a comparison chart of the classification performance of different models of this invention on the Breast_Cancer dataset; Figure 4 This is a comparison chart of the classification performance of different models of this invention on the Wine dataset; Figure 5 This is a comparison chart of the classification performance of different models of this invention on the Spambase dataset; Figure 6 Diagrams showing the layer structures of five existing sub-volumes; Figure 7 These are different quantum convolution structures of the present invention. Detailed Implementation
[0023] The following detailed description illustrates the specific implementation methods: The specific implementation process is as follows: See Figures 1 to 7 An image classification method based on a quantum convolutional neural network with a natural evolution optimizer, including... In this embodiment, three datasets are specifically selected for model training and evaluation, including: The WisconsinBreastCancerDataset is used for a binary classification task, containing 569 samples and 30 features. The goal is to predict whether a tumor is benign or malignant. Features are derived from cell nucleus image analysis and include radius, texture, perimeter, and area. Each feature has a mean, standard error, and maximum value.
[0024] The WineDataset is a three-class classification dataset containing 178 samples and 13 features, primarily distinguishing three types of wine based on their chemical composition. Features include alcohol content, malic acid, magnesium content, and color intensity, which are related to the flavor and quality of the wine and can be used for classification algorithm testing and feature selection.
[0025] The Spambase dataset is used for spam classification and contains 4,601 emails, of which 39.4% are spam. It has 57 features, such as word and character frequency and capitalization, and its goal is to predict whether an email is spam.
[0026] S1: Preprocess the input image data and divide the dataset; S1-1) Data loading and category filtering; Given dataset .in, It is the input feature vector. ∈{0,1} and ∈{0,1,2} is the category label.
[0027] S1-2) Data standardization; Since the numerical ranges of different features may differ, the data is standardized to prevent certain features from having an excessive impact on the model.
[0028] in, and Let these represent the mean and standard deviation of the feature, respectively. Let N represent the original feature value of the i-th sample, and N represent the total number of samples.
[0029] After standardization, all features have a mean of 0 and a variance of 1, ensuring the stability of model training.
[0030] S1-3) PCA dimensionality reduction; To reduce computational complexity and accommodate the limitations of quantum computing resources, PCA (Principal Component Analysis) is used to reduce the dimensionality of the data, reducing the original n-dimensional features to 16 dimensions.
[0031] in, It is the principal component matrix of PCA. It is obtained through singular value decomposition (SVD). It is a standardized data matrix.
[0032] The S1-4 dataset is divided into a training set and a test set.
[0033] The dataset is divided into a training set:test set ratio of 8:2. The training set is used for model training, and the test set is used to evaluate the model's generalization ability.
[0034] In this embodiment, the label one-hot encoding is also performed on the three-class classification dataset, specifically as follows: Since the Wine dataset is a three-class classification problem, and the output of a quantum convolutional neural network is a probability distribution, one-hot encoding of the labels is necessary. One-hot encoding ensures the correctness of the cross-entropy loss function calculation and allows the neural network to learn the probability distribution between classes.
[0035] in, .
[0036] S2: Quantum encoding of the preprocessed data; In S2, the quantum encoding method employs one of the following: qubit encoding, angle encoding, amplitude encoding, dense qubit encoding, or IQP encoding.
[0037] Quantum bit encoding requires the use of constant-depth quantum circuits, while also needing A number of qubits to embed classical data points The data points were rescaled so that their values were between 0 and 1. Between, embedded in a single qubit ,in Therefore, qubit encoding maps the input data. arrive The formula for 1 qubit is:
[0038] Among them, for all satisfy The encoding circuit can use a unitary operator. express, .
[0039] Angular encoding utilizes the rotation operations of qubits (such as Pauli-Y rotation). Pauli-Y rotation Pauli-Z rotation To encode data, the number of qubits is equal to the dimension of classical information, as shown in the formula:
[0040] in, Represents the encoded quantum state, Let be the tensor product, representing a parallel operation on n qubits. This indicates a revolving door operation, used to transfer classic data. Encoding the state into a single quantum bit This represents the initial state of n qubits.
[0041] Amplitude encoding encodes an N-dimensional classical vector x into a quantum state with n qubits, where Assuming the classic data vector is The goal of amplitude encoding is to encode this vector into a quantum state. In, so that: , here It is the first of the classic data. One element, This corresponds to the computational ground state. To ensure this is a valid quantum state, the data vector typically needs to be normalized so that... .
[0042] For example, when At that time, the quantum state obtained after encoding is .
[0043] Dense qubit encoding, since the quantum state of a qubit can be described by two real-number parameters, allows each qubit to encode two classical data points. Qubit encoding can be extended to encode two classical vectors for each qubit by rotations around two orthogonal axes (x-axis and y-axis) on a Bloch sphere. The classical data points in this method... The state is encoded as a single quantum bit. Therefore, dense qubit encoding maps N-dimensional input data. to The core formula for qubits is:
[0044] in, Represents the tensor product of N / 2 qubits. and These represent the exponential form of the revolving door operation.
[0045] Instantaneous quantum polynomial-time (IQP) encoding embeds classical data into a quantum state using instantaneous quantum polynomial-time circuits. It typically involves a set of controlled off-diagonal gates and a set of diagonal gates. For classical data, IQP encoding constructs a quantum circuit of the following form: first, a Hadamard gate is applied to each qubit; then, parameterized diagonal gates are applied, their parameters depending on the classical data.
[0046] We encode a classic piece of information x into... Here, 𝑟 represents the depth of the circuit, which is... The number of times it is repeated. It is a Hadamard gate that acts on all qubits. This is the most important step in IQP coding: Here, 𝑆 is a set, and for each pair of qubits in this set, we need to act on them. The door. And... middle, It will act on every pair of qubits belonging to set 𝑆.
[0047] First, let's consider a simple two-qubit gate: Its mathematical expression This can be viewed as a two-qubit rotation gate revolving around ZZ, causing the two qubits to become entangled. It's worth noting that in the more generalized IQP encoding scheme, we can... Replace with or You can also put Replace with or For example, given classic data The initial quantum state is set as Then apply a Hadamard gate to each qubit. Finally, a parameterized Z-revolving door is applied. ,in It is a value from classic data.
[0048] S3: Construct an image classification model based on a quantum convolutional neural network. The image classification model includes three quantum convolutional layers and a quantum fully connected layer. The three quantum convolutional layers extract low-level local features, mid-level geometric features, and global semantic information of the image data in sequence. Each quantum convolutional layer is followed by a quantum transformation layer for adjusting the quantum state and a quantum pooling layer for dimensionality reduction. The quantum fully connected layer is used to integrate all features and output the classification result.
[0049] In S3, the quantum convolutional layer includes a single-qubit rotation gate and a two-qubit entanglement gate. The rotation gate is used to regulate the quantum state, and the two-qubit entanglement gate is used to introduce quantum entanglement and capture nonlocal features.
[0050] The structure of a quantum convolutional layer is represented as follows:
[0051] In the formula, the convolutional layer uses parameterized quantum gates U(θ) to transform the quantum state. It is the first Parameterized quantum gates for each convolutional layer These are the trainable parameters of the convolutional layer.
[0052] Specifically, in this embodiment, the quantum convolutional layer structure is as follows: Figure 7 The neutron diagram Convolutional circuit 10 is shown, and its mathematical expression is as follows:
[0053] in, This represents a parallel operation (tensor product) on N qubits, where the same gate sequence is applied independently to each qubit. , , These represent rotating doors around the X-axis, Y-axis, and z-axis, respectively. This indicates that the gate sequence is repeated twice. This indicates two rotations along the Y-axis. This indicates a CNOT gate with the first qubit as the control bit and the zeroth qubit as the target bit. This represents a standard CNOT gate where the control bit is the 0th qubit and the target bit is the 1st qubit.
[0054] In S3, the quantum transformation layer adopts the following structure:
[0055] In the formula, This indicates the measurement projection (usually the measurement auxiliary bits are ). state), Parameterized quantum gates for each pooling layer These are the trainable parameters of the pooling layer.
[0056] In S3, the quantum fully connected layer adopts the following structure:
[0057] In the formula, The quantum state of the input image; It is the product of unitary operators with trained parameters in the network's convolutional layers; For quantum transformation layer, For quantum pooling layer, For unitary operators with training parameters in a quantum fully connected layer.
[0058] S4: Train the image classification model, use the Natural Evolutionary Strategy (NES) and Adam optimizer to optimize the image classification model, and evaluate the model. S4 includes S4-1) Initialize the model parameters, randomly initialize the parameters of the quantum convolutional layer, quantum transform layer, and quantum pooling layer; set the hyperparameters of the natural evolution strategy to noise amplitude, population size, and initial learning rate; set the hyperparameters of the Adam optimizer to momentum coefficient and minimum constant. S4-2) Generate perturbation parameters based on the current parameters of the quantum convolutional layer, quantum transformation layer, and quantum pooling layer; calculate the output loss of the quantum circuit for each set of parameters, convert the loss into a reward value and standardize it; calculate multiple perturbations in a weighted manner to obtain the estimated gradient; Specifically, in each iteration, a Gaussian perturbation is added to the current model parameter θ:
[0059] in, These are the current model parameters. It is the noise amplitude (exploration intensity). It is a standard normal distribution The generated random perturbation vector has the same dimension as θ. It is a parameter instance after the i-th perturbation, used for subsequent evaluation.
[0060] After adding the perturbation, calculate the loss function value for each group of parameters after the perturbation. Calculate the negative loss value as the "reward," and the reward value is calculated using the following formula:
[0061] in, It is the original reward value of the i-th sample. It uses the perturbed parameters. The calculated function value is the cross-entropy loss.
[0062] Next, to standardize the reward value, NES needs to normalize the reward value to ensure stable updates:
[0063] in, It is a standardized reward. It is the original reward value of the i-th sample. It is the average of all rewards in the current batch. It is the standard deviation of the reward. It is a performance constant.
[0064] Finally, NES uses these normalized rewards to weighted average the perturbation directions, thereby estimating the gradient direction:
[0065] in, This is the gradient estimate of the model parameters, where N is the total number of perturbation samples. It is generated The random perturbation vector used at that time It is a standardized reward.
[0066] This step allows the model to be updated in the direction where noise leads to lower loss (higher reward).
[0067] S4-3) Calculate the first-order momentum and second-order momentum based on the estimated gradient, perform bias correction, and update the model parameters; Since NES itself lacks adaptive learning rate capabilities, it may lead to instability during training. Therefore, the Adam optimizer is incorporated, which adaptively adjusts the estimated gradient using an exponentially weighted average of the first and second moments. The update process is as follows: The first step is to calculate the first-order momentum (exponentially weighted average of the gradients) and the second-order momentum (exponentially weighted average of the squared gradients), as shown in the following formulas:
[0068] in, It is the first-order momentum at the current moment. It is the decay rate of first-order momentum, controlling the weight of momentum. It is the first-order momentum from the previous moment. It is the gradient estimate of the model parameters.
[0069]
[0070] in, It is the second-order momentum at the current moment, reflecting the range of gradient fluctuations. It is the decay rate of the second momentum, which controls the adjustment of the learning rate. It is the second momentum from the previous moment. It is the gradient squared element by element.
[0071] and It is usually set to a value close to 1.
[0072] Due to the initial stage and The value will be close to zero, therefore bias correction is required:
[0073] in, and These are the corrected first and second momentum. , It is the decay rate raised to the power of t.
[0074] The second step is to update the parameters using the corrected first-order moment estimates and second-order moment estimates:
[0075] in, These are the current model parameters, and η is the initial learning rate. It is the adaptive learning rate adjustment term, where, The learning rate is reduced based on gradient fluctuations, where ϵ is a very small constant (e.g., ...). (for numerical stability) It is the corrected gradient direction.
[0076] By combining NES and Adam, a highly efficient hybrid optimization strategy is formed, suitable for high-dimensional non-convex optimization problems. NES estimates the gradient direction through random sampling, eliminating the need for explicit gradient calculation and enhancing global search capabilities, making it particularly suitable for situations where gradients are difficult to compute or loss functions are non-smooth. Adam, as an adaptive optimization algorithm, dynamically adjusts the learning rate based on the first and second moments, improving training stability and convergence speed. The combination of the two retains the advantages of global exploration while achieving fine-grained local updates, thereby improving training efficiency.
[0077] In S4, model hyperparameters include learning rate, batch size, number of qubits, and number of iterations.
[0078] To find suitable model hyperparameters, multiple rounds of experiments and system debugging were conducted. Ten rereading experiments were performed on each of the three datasets, and the mean and standard deviation of each performance index were calculated to disclose random errors and enhance the credibility of the conclusions.
[0079] The hyperparameter settings and experimental parameters are shown in Table 1. Table 1. List of Model Hyperparameters and Experimental Parameter Settings
[0080] In S4, the model loss function is the cross-entropy loss function, which adjusts the model parameters by calculating the difference between the model's predictions and the actual labels, making it better suited for classification tasks.
[0081] First, select the category with the highest probability as the prediction result:
[0082] Then, the cross-entropy loss function is used to measure the difference between the probability distribution of the model output and the true label distribution:
[0083] in, It is the one-hot encoding of the real label. It is the probability distribution predicted by the model.
[0084] The cross-entropy loss function plays a crucial role throughout the training and evaluation process. By minimizing the loss function, the model gradually learns more accurate classification decisions.
[0085] S4-4) The model is evaluated and validated using a test set, and the parameters of the best-performing model are saved to output the optimal model.
[0086] In S4-4, the model is evaluated by calculating accuracy, precision, recall, and F1 score.
[0087] Accuracy is the proportion of samples correctly classified by the classifier out of the total number of samples, and the formula is as follows:
[0088] In this context, TP is a true positive instance, a sample that is predicted to be positive by the model and is actually positive; TN is a true negative instance, a sample that is predicted to be negative by the model and is actually negative; FP is a false positive instance, a sample that is predicted to be positive by the model but is actually negative; and FN is a false negative instance, a sample that is predicted to be negative by the model but is actually positive.
[0089] Precision refers to the proportion of samples that are actually positive out of all samples predicted as positive. It measures the accuracy of the model in predicting positive classes, and the formula is as follows:
[0090] TP represents a true positive, which is a sample that the model predicts to be positive and is actually positive; FP represents a false positive, which is a sample that the model predicts to be positive but is actually negative.
[0091] Recall is the proportion of samples that are correctly predicted as positive out of all samples that are actually positive. It measures the model's ability to identify positive samples, and the formula is as follows:
[0092] In this context, TP is a true positive, which is a sample that the model predicts to be positive and is actually positive; FP is a false positive, which is a sample that the model predicts to be positive but is actually negative; and FN is a false negative, which is a sample that the model predicts to be negative but is actually positive.
[0093] The F1 score is the harmonic mean of precision and recall, a metric that comprehensively considers both the model's precision and recall. The formula is as follows:
[0094] in, It's about accuracy. It's the recall rate.
[0095] S5: Input image data into the image classification model and output the image classification result.
[0096] To verify the performance of the image classification model of this invention, the classification performance of eight optimization algorithms on different datasets was compared. These included four classic optimization methods (Adam, Adagrad, RMSprop, and GradientDescent) and four hybrid optimization methods combining the Natural Evolutionary Strategy (NES) (NES-Adam, NES-Adagrad, NES-RMSprop, and NES-Gradient). The optimization methods were evaluated on three standard datasets: BreastCancer, Wine, and Spambase, with analysis focusing on four metrics: accuracy, precision, recall, and F1 score (see Table 2 for details).
[0097] Table 2. Results of four evaluation metrics for the three datasets on different algorithms.
[0098] In addition, to further illustrate the training process of each optimization algorithm more intuitively, curves showing the changes in training accuracy and loss value under different optimization algorithms were plotted for three types of datasets, such as... Figure 2 As shown in the figure, this graph clearly reflects the convergence speed and stability of each method during the training phase, providing a dynamic basis for comparing model performance. Figure 2 The training dynamics of different optimization algorithms on three types of datasets are shown. Subplot (a) shows the change in training accuracy with the number of iterations, and subplot (b) shows the decreasing trend of training loss. Each model is marked with a different color for easy comparison of its convergence speed and optimization effect.
[0099] According to Table 2 and Figure 2 As can be seen, the NES-ADAM optimizer exhibits stable and significant performance advantages in all three tasks, particularly excelling in generalization ability and classification quality, making it a representative of the optimal solution. Taking the Breast_Cancer dataset as an example, NES-ADAM achieves a training accuracy of 98.25% and a test accuracy of 99.12%, with an F1 score as high as 99.06%, the highest among all optimizers. This result not only reflects the model's strong fitting ability during training but also demonstrates its superior generalization performance on unseen data. Furthermore, NES-ADAM maintains a good balance between precision and recall, indicating its excellent robustness and discriminative ability in classifying positive and negative samples.
[0100] On the Wine and Spambase datasets, NES-ADAM achieved test accuracies of 100% and 96.23%, respectively, significantly outperforming other traditional optimization methods. NES-ADAM also achieved state-of-the-art performance on each task across other metrics. This further demonstrates that this optimizer not only possesses excellent overall classification capabilities but also effectively identifies minority class samples and adapts to complex and imbalanced data distributions.
[0101] In summary, NES-ADAM demonstrates excellent adaptability under varying data scales and structures. It possesses both global search capabilities and rapid local convergence, effectively mitigating the vanishing gradient and "barren plateau" problems commonly found in quantum neural network training, showcasing strong optimization potential and broad application prospects.
[0102] Furthermore, the image classification model based on quantum convolutional neural networks (NESADAM-QCNN model) of this invention was systematically compared with various classical machine learning and deep learning methods. The specific comparison results are as follows: Figure 3 , Figure 4 and Figure 5 As shown. The comparison models include SVM, Random Forest, Gaussian Naïve Bayes, Gradient Boosting, AdaBoost, Voting, KNN, Decision Tree, FNN, CNN, QNN, and QCNN. Evaluation metrics cover accuracy, precision, recall, and F1 score to comprehensively measure the classification performance of each model.
[0103] Figure 3 The following is a comparison of the classification performance of different models on the Breast_Cancer dataset. Subplot (a) shows the training and testing accuracy of each model, subplot (b) shows the precision of each model, subplot (c) shows the recall of each model, and subplot (d) shows the F1 score. Figure 4 The following is a comparison of the classification performance of different models on the Wine dataset. Subplot (a) shows the training and testing accuracy of each model, subplot (b) shows the precision of each model, subplot (c) shows the recall of each model, and subplot (d) shows the F1 score. Figure 5 The following is a comparison of the classification performance of different models on the Spambase dataset. Subplot (a) shows the training and testing accuracy of each model, subplot (b) shows the precision of each model, subplot (c) shows the recall of each model, and subplot (d) shows the F1 score.
[0104] from Figure 3 , 4As shown in Figures 5 and 6, the NESADAM-QCNN model of this invention outperforms most traditional models in multiple key metrics such as accuracy, precision, recall, and F1 score, demonstrating excellent generalization ability and stability. On the Breast_Cancer dataset, the NESADAM-QCNN model achieves a training accuracy of 98.25%, significantly higher than QNN (69.30%) and Gaussian (92.11%). On the Wine dataset, its accuracy is 97.22%, also outperforming other models. On the Spambase dataset, the model achieves an accuracy of 93.68%, significantly exceeding QNN (55.70%) and Gaussian (84.94%). NESADAM-QCNN also demonstrates outstanding performance in other metrics. For example, in the Breast_Cancer task, its precision is 99.31%, which is 4.57 percentage points higher than CNN; in the Wine dataset, its recall and F1-Score both reach 97.62%, which are 8.73 and 8.83 percentage points higher than CNN, respectively; in the Spambase task, its F1 score is 93.75%, which is better than most traditional models.
[0105] Overall, NESADAM-QCNN demonstrates superior classification performance, improves the reliability of classification results, and provides strong support for the promotion of quantum machine learning in practical applications.
[0106] Example 2 Compared to Example 1, the difference in this example is that the structure of the quantum convolutional layer is as follows: Figure 7 The neutron diagram Convolutional circuit 9 is shown, and its formula is expressed as follows:
[0107] in, This represents a parallel operation (tensor product) on N qubits, where the same gate sequence is applied independently to each qubit. middle, and The tables represent rotating doors around the Y-axis and X-axis. This indicates that the gate sequence is repeated twice. This represents a revolving door around the Z-axis. This indicates two rotations along the Y-axis. This indicates a CNOT gate with the first qubit as the control bit and the zeroth qubit as the target bit. This indicates that a CNOT gate is applied to a specific pair of qubits (such as adjacent qubits) to generate an entangled state.
[0108] Example 3 Compared to Example 1, the difference in this example is that the structure of the quantum convolutional layer is as follows: Figure 7 The neutron diagram Convolutional circuit 8 is shown, and its formula is expressed as follows:
[0109] Where N represents the total number of qubits, , , These represent revolving doors around the X-axis, Y-axis, and X-axis, respectively. This represents a parallel operation (tensor product) on N qubits. This indicates a CNOT gate with the first qubit as the control bit and the zeroth qubit as the target bit. This indicates that a CNOT gate is applied to a specific pair of qubits (such as adjacent qubits) to generate an entangled state.
[0110] Example 4 Compared to Example 1, the difference in this example is that the structure of the quantum convolutional layer is as follows: Figure 7 The neutron diagram Convolutional circuit 7 is shown, and its formula is expressed as follows:
[0111] in, This represents a parallel operation (tensor product) on N qubits. , , These represent revolving doors around the X-axis, Y-axis, and X-axis, respectively. This indicates that the gate sequence is repeated twice. This indicates a CNOT gate with the first qubit as the control bit and the zeroth qubit as the target bit. This represents a standard CNOT gate where the control bit is the 0th qubit and the target bit is the 1st qubit.
[0112] Example 5 Compared to Example 1, the difference in this example is that the structure of the quantum convolutional layer is as follows: Figure 7 The neutron diagram Convolutional circuit 6 is shown, and its formula is expressed as follows:
[0113] in, This represents a parallel operation (tensor product) on N qubits. , , These represent revolving doors around the X-axis, Y-axis, and X-axis, respectively. This indicates that the gate sequence is repeated twice. This represents a standard CNOT gate where the control bit is the 0th qubit and the target bit is the 1st qubit.
[0114] like Figure 6 The diagram shows five existing quantum convolutional structures. To illustrate the advantages of the different quantum convolutional structures in Examples 1-5 of this invention, the performance of Examples 1 (Circuit 10), 2 (Circuit 9), 3 (Circuit 8), 4 (Circuit 7), and 5 (Circuit 6) is compared with that of the five existing quantum convolutional structures on three datasets. The comparison results are shown in Tables 3, 4, and 5 below, where circuit 1, circuit 2, circuit 3, circuit 4, and circuit 5 in the tables represent the five existing quantum convolutional structures, respectively. Table 3. Validation and test accuracy of the Breast Cancer dataset on different data encodings and quantum convolutional circuits.
[0115] Table 4. Validation and testing accuracy of the Wine dataset on different data encodings and quantum convolutional circuits.
[0116] Table 5. Validation and testing accuracy of the Spambase dataset on different data encodings and quantum convolution circuits.
[0117] As shown in Tables 3-5, among various combinations, the quantum convolution circuits of Examples 1 to 5 of this application demonstrate superior performance in both verification and testing accuracy compared to the five existing quantum convolution structures. In particular, the quantum convolution circuit in Example 1 shows the best performance in handling complex data distributions, especially when combined with angle encoding, significantly improving the classification accuracy for the three types of datasets. Angle encoding efficiently embeds data features through Ry single-qubit rotation operations, preserving key distribution information while significantly reducing quantum resource overhead, thus exhibiting strong adaptability in processing high-dimensional sparse data.
[0118] In summary, the present invention improves the classification performance, training stability, and generalization ability of the QCNN model by rationally selecting the data encoding method and quantum convolution kernel structure.
[0119] The above are merely embodiments of the present invention. Commonly known structures and characteristics are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. An image classification method based on a quantum convolutional neural network with a natural evolution optimizer, characterized in that, include S1: Preprocess the input image data; S2: Quantum encoding of the preprocessed data; S3: Construct an image classification model based on a quantum convolutional neural network. The image classification model includes three quantum convolutional layers and a quantum fully connected layer. The three quantum convolutional layers extract low-level local features, mid-level geometric features, and global semantic information of the image data in sequence. Each quantum convolutional layer is followed by a quantum transformation layer for adjusting the quantum state and a quantum pooling layer for dimensionality reduction. The quantum fully connected layer is used to integrate all features and output the classification result. In S3, the quantum convolutional layer includes a single-qubit rotation gate and a two-qubit entanglement gate. The rotation gate is used to regulate the quantum state, and the two-qubit entanglement gate is used to introduce quantum entanglement and capture non-local features. The structure of a quantum convolutional layer is represented as follows: In the formula, the convolutional layer uses parameterized quantum gates U(θ) to transform the quantum states. It is the first Parameterized quantum gates for each convolutional layer These are the trainable parameters of the convolutional layer; S4: Train the image classification model, use a hybrid optimization strategy combining natural evolution and Adam optimizer to optimize the image classification model, and evaluate the model. S5: Input image data into the image classification model and output the image classification result.
2. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 1, characterized in that, S1 includes, S1-1) Collect image data and add category labels to the data; S1-2) Standardize the image data; S1-3) Dimensionality reduction of image data is achieved through principal component analysis; S1-4) Divide the dimensionality-reduced dataset into training and test sets according to a preset ratio.
3. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 1, characterized in that, The quantum coding method in S2 employs one of the following: quantum bit coding, angle coding, amplitude coding, dense quantum bit coding, or IQP coding.
4. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 1, characterized in that, The mathematical expression for a quantum convolutional layer is as follows: in, This represents a parallel operation of tensor product form on N qubits, where each qubit independently applies the same gate sequence. , , These represent rotating doors around the X-axis, Y-axis, and z-axis, respectively. This indicates that the gate sequence is repeated twice. This indicates two rotations along the Y-axis. This indicates a CNOT gate with the first qubit as the control bit and the zeroth qubit as the target bit. This represents a standard CNOT gate where the control bit is the 0th qubit and the target bit is the 1st qubit.
5. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 4, characterized in that, In S3, the quantum pooling layer adopts the following structure: In the formula, This indicates that the auxiliary bits will be projected to... Measurement projection of state, It is the first Parameterized quantum gates for each pooling layer These are the trainable parameters of the pooling layer.
6. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 5, characterized in that, In S3, the quantum fully connected layer adopts the following structure: In the formula, The quantum state of the input image; It is the product of unitary operators with trained parameters in the network's convolutional layers; For quantum transformation layer, For quantum pooling layer, For unitary operators with training parameters in a quantum fully connected layer.
7. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 1, characterized in that, S4 includes S4-1) Initialize the model parameters, randomly initialize the parameters of the quantum convolutional layer, quantum transform layer, and quantum pooling layer; set the hyperparameters of the natural evolution strategy to noise amplitude, population size, and initial learning rate; set the hyperparameters of the Adam optimizer to momentum coefficient and minimum constant. S4-2) Generate perturbation parameters based on the current parameters of the quantum convolutional layer, quantum transformation layer, and quantum pooling layer; calculate the output loss of the quantum circuit for each set of parameters, convert the loss into a reward value and standardize it; calculate multiple perturbations in a weighted manner to obtain the estimated gradient; S4-3) Calculate the first-order momentum and second-order momentum based on the estimated gradient, perform bias correction, and update the model parameters; S4-4) The model is evaluated and validated using a test set, and the parameters of the best-performing model are saved to output the optimal model.
8. The image classification method based on a quantum convolutional neural network with a natural evolution optimizer according to claim 7, characterized in that, In S4-4, the model is evaluated by calculating accuracy, precision, recall, and F1 score.
Citation Information
Patent Citations
Image multi-classification method based on multi-branch mixed quantum classical neural network
CN117237715A
Image classification method based on extensible quantum convolutional neural network
CN119649149A
Image classification method, system and device based on quantum convolutional neural network, medium and product
CN120125909A