Image classification method based on extensible quantum convolutional neural network

By adopting a method based on a scalable quantum convolutional neural network in the image classification task, using quantum systems to extract and classify image data, the problems of high computing resource requirements and limited scalability of quantum computers in the prior art are solved, and efficient image classification processing and model generalization capabilities are improved.

CN119649149APending Publication Date: 2025-03-18CHENGDU UNIVERSITY OF TECHNOLOGY

Patent Information

Application Number
CN202411868979.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The prior art requires a large amount of computing resources in image classification tasks, and the scalability and number of quantum bits of quantum computers are limited, making it difficult to efficiently handle complex image classification tasks.

Method used

The image classification method based on a scalable quantum convolutional neural network is adopted to preprocess and cut the image data, convert the sliced ​​data into quantum state information using angle encoding, and build a quantum system, including the quantum feature extraction part and the quantum classification measurement part, and replace the convolution layer and pooling layer in the convolution neural network with alternating single qubit gates and double qubit gates to perform feature extraction and classification measurement on quantum state information.

Benefits of technology

It significantly reduces the demand for computing resources, improves the processing efficiency of image classification tasks and the scalability of the system, enhances the classification accuracy and generalization capabilities of the model, and realizes efficient image classification processing under limited quantum computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649149A_ABST
    Figure CN119649149A_ABST
Patent Text Reader

Abstract

The invention discloses an image classification method based on an extensible quantum convolutional neural network, and relates to the technical field of image classification, and the method comprises the steps: carrying out the preprocessing of to-be-classified image data, and then carrying out the slicing processing; converting the slice data into quantum state information through angle coding; a quantum system is constructed, the quantum system comprises a quantum feature extraction part and a quantum classification measurement part, the quantum feature extraction part comprises a quantum variational circuit model with a quantum convolutional layer, and the model can perform feature extraction on quantum state information by using alternating single quantum bit gates and double quantum bit gates; training a quantum variational circuit model by using a part of quantum state information; and inputting the other part of quantum state information into the trained quantum variational circuit model, and measuring the output quantum state of the quantum variational circuit model. According to the method, the problems that traditional deep learning is high in computing resource demand, limited in quantum computer scale and the like are solved, and a novel and practical method is provided for efficient image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image classification, and in particular to an image classification method based on a scalable quantum convolutional neural network. Background Art

[0002] Image classification occupies an important position in the current field of machine learning and artificial intelligence, and is one of the important tasks of computer vision. The core of image classification technology is to enable computers to recognize and classify images into different categories, which lays the foundation for many practical application scenarios. Deep learning, as an important branch of machine learning, has shown great application potential in image classification tasks based on the development of big data and high-performance computing. Due to its complex network structure and a large number of parameters, deep learning models usually require more computing resources. As one of the core algorithms of deep learning, neural networks require a large amount of data training to achieve optimal performance. At the same time, quantum computing based on the laws of quantum mechanics has brought us new and exciting possibilities. As a research field full of potential, quantum machine learning combines the powerful capabilities of quantum computing and the technology of machine learning, aiming to surpass the performance of traditional computers when processing large amounts of data and solving complex problems. However, quantum machine learning currently also faces some challenges and limitations, and the number of quantum bits and the scalability of quantum computers need to be improved. Summary of the invention

[0003] The present invention provides an image classification method based on a scalable quantum convolutional neural network, which can solve the above problems and improve the efficiency of processing image classification tasks.

[0004] In order to solve the above problems, the technical solution adopted by the present invention is as follows:

[0005] The present invention provides an image classification method based on a scalable quantum convolutional neural network, comprising the following steps:

[0006] S10, preprocessing the image data to be classified, and cutting the preprocessed image data into slices of required sizes;

[0007] S20, converting slice data into quantum state information through angle encoding;

[0008] S30, constructing a quantum system, including a quantum feature extraction part and a quantum classification measurement part, wherein the quantum feature extraction part includes a quantum variational circuit model with a quantum convolution layer, and the model uses alternating single-qubit gates and double-qubit gates to replace the convolution layer and the pooling layer of the convolutional neural network to extract features of quantum state information and obtain an output quantum state;

[0009] S40, using a portion of the quantum state information obtained in step S20 to train the quantum variational circuit model, and optimizing the parameters of the quantum variational circuit model based on the loss function and the Adam optimizer during the training process;

[0010] S50, inputting another part of the quantum state information obtained in step S20 into the trained quantum variational circuit model, measuring the output quantum state of the quantum variational circuit model, and obtaining an image classification result.

[0011] As a further description of the above technical solution, in step S10, the method for preprocessing the image data to be classified includes: for the same image, if there are multiple different labels, then the image is removed.

[0012] As a further description of the above technical solution, the encoding formula used in step S20 is:

[0013]

[0014] Among them, x i represents the i-th slice data vector, R is the rotation matrix, and n is the total number of samples.

[0015] As a further description of the above technical solution, in step S30, the single quantum bit gate includes a Hadamard gate, an R X Door and R Y Gates, a two-qubit gate consists of CNOT gates on a pair of nearest-neighbor qubits.

[0016] As a further description of the above technical solution, for step S40, during the training process of the quantum variational circuit model, the measurement results of the output quantum state are collected by the quantum prediction layer to perform the final classification prediction.

[0017] As a further description of the above technical solution, for step S40, the parameter optimization process of the quantum variational circuit model starts with calculating the loss function and is performed in a classical device. The classical device compares the predicted classification label with the actual label of the corresponding sample, and calculates the loss function L=l(E,y) according to the objective function l(·) of the task, where y is the actual label and E is the predicted classification label.

[0018] As a further description of the above technical solution, during the training process of the quantum variational circuit model, when the set number of iterations is reached, the training of the quantum variational circuit model is completed and the model parameter weights are determined.

[0019] As a further description of the above technical solution, the quantum variational circuit model parameter update process includes:

[0020] Calculate the variational parameters θ of each layer k The gradient of is given by

[0021] The calculation of depends on the expectation value of the quantum state, which is given by Among them U + and U - is the product of quantum gates;

[0022] The automatic differentiation framework is used to perform gradient expansion on the expected value of the quantum feature map. The specific gradient calculation formula is:

[0023]

[0024] in, Indicates that in θ j After the gradient calculation is completed, the gradient descent method is used to update the variational parameter θ of the quantum circuit. The update formula is: where η is the learning rate.

[0025] Compared with the prior art, the present invention has the following beneficial effects:

[0026] 1) By constructing a quantum variational circuit model and using alternating single-qubit gates and double-qubit gates to replace the convolutional layers and pooling layers in the traditional convolutional neural network, efficient feature extraction of quantum state information is achieved, which significantly reduces the demand for computing resources compared to the classical deep learning model.

[0027] 2) By cutting the image data into multiple small slices and using multiple small quantum devices to process feature extraction tasks in parallel, each quantum device operates independently, avoiding the difficulty of building a large quantum computer and greatly improving the system's operating efficiency and scalability.

[0028] 3) Combining the characteristics of the quantum variational circuit model, the loss function based on quantum state information and the Adam optimizer are used to optimize the model parameters for training, which improves the classification accuracy of the quantum model and enhances the generalization ability of the model.

[0029] 4) In response to the current reality of the limited number of quantum bits, the present invention utilizes small quantum devices for collaboration and, through the rational design of the quantum feature extractor and the quantum classification measurement part, achieves efficient processing of complex image classification tasks under the condition of limited quantum computing resources.

[0030] 5) This invention uses the powerful parallel computing and feature extraction capabilities of quantum computing to provide a new solution for processing large-scale image classification tasks. It not only reduces the dependence on data and computing resources, but also provides the possibility for the implementation of quantum machine learning in practical applications.

[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the embodiments of the present invention are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 is an overall strategy diagram of an embodiment of the present invention;

[0034] Figure 2 It is the circuit structure of the quantum extraction feature part of the embodiment of the present invention;

[0035] Figure 3 1 is a schematic diagram of an example of an MNIST handwriting data set image used in a test in an embodiment of the present invention;

[0036] Figure 4 is the accuracy change curve of the MNIST test data set in the embodiment of the present invention;

[0037] Figure 5 Schematic diagram of FashionMNIST dataset image samples used in the test of the embodiments of the present invention. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0039] According to an embodiment of the present invention, a method for image classification based on a scalable quantum convolutional neural network is provided, comprising the following steps:

[0040] S10, preprocess the image data to be classified, and cut the preprocessed image data into slices of required size x = {x1, x2, ..., x k}.

[0041] In this embodiment, the preprocessing method includes: for the same image, if there are multiple different labels, then the image is removed.

[0042] S20, converting the slice data x into quantum state information through angle encoding, expressed as:

[0043]

[0044] Among them, x i represents the i-th slice data vector, R is the rotation matrix, and n is the total number of samples.

[0045] The state preparation unit can efficiently convert classical data into quantum states by selecting a suitable encoding method, which is a key step in quantum machine learning because quantum computers cannot directly process classical data. In the case of angle encoding, the state preparation unit encodes a feature for each quantum bit, as shown in the following formula:

[0046]

[0047] S30, reference Figure 1 As shown, a quantum system is constructed, including a quantum feature extraction part and a quantum classification measurement part. The quantum feature extraction part includes a quantum variational circuit (PQC) model with a quantum convolution layer. The model uses alternating single-qubit gates and double-qubit gates to replace the convolution layer and pooling layer of the convolutional neural network to perform feature learning on the quantum state information and obtain the output quantum state.

[0048] Assuming that the quantum system is composed of k+1 small quantum devices, the first k are the quantum feature extraction part, that is, k quantum variational circuit (PQC) models with quantum convolution layers, which are used to extract features. The obtained k features are concentrated and sent to the last quantum device (that is, the last small quantum device, which is the quantum classification measurement part), and prediction and classification can be performed to finally obtain the classification output result.

[0049] In this embodiment, the single-qubit gates include Hadamard gates, R X Door and R Y Gates, two-qubit gates consist of CNOT gates on a pair of nearest neighbor qubits, which can be reversed if necessary. For example, in order to achieve a specific quantum state transformation, a CNOT gate can be used to create an entangled state between two qubits. In multi-qubit systems, CNOT gates usually act on two qubits: a control bit and a target bit. The reversal of a CNOT gate is usually achieved by applying another CNOT gate after it. Specifically, first, a CNOT gate is applied to the selected control bit and target bit, and the reversal operation can be achieved by applying another CNOT gate on the same two qubits to offset the effect of the previous CNOT gate.

[0050] Hadamard Gate and R X The gate constitutes the encoding part. The function of the Hadamard gate is to initialize the quantum bit to the superposition state. X The gate is used to perform precise angular rotations based on classical information.

[0051] In the quantum feature extraction part of the present invention, the circuit structure is designed using the idea similar to that in the convolutional neural network (CNN). However, unlike CNN, the present invention uses PQC to replace the hidden layer in the traditional convolutional neural network. In our model, alternating single-qubit and double-qubit gates are used to replace the convolutional layer and the pooling layer for feature learning. The specific circuit design is as follows Figure 2 .

[0052] The quantum classification measurement part aggregates the local features derived from k quantum feature extractors over the conventional communication channel, which are represented by real numbers f = {f1,f2,…,f k In the quantum variational circuit, k data qubits are used to load the extracted local features, and the readout qubits are used to output predictions.

[0053] In this embodiment, the Ising gate is applied to entangle qubits in a quantum variational circuit, and local properties can be learned and predicted at the same time.

[0054] In this embodiment, the quantum prediction layer is represented as U pre (θ pre ), θ pre Represents trainable parameters.

[0055] The prediction result of slice data x can be expressed as

[0056]

[0057] where ∣Ψ f > is the quantum state of the extracted feature f, is the conjugate transpose of the variational quantum circuit representing the quantum classification measurement part, where θ pre is a trainable parameter of the quantum classification measurement part, M represents the measurement operator, which is used to perform measurement operations on quantum states, and U pre (θ pre ) represents the variational quantum circuit of the quantum classification measurement part, y ′ is a real number in the range [-1,1]. For a binary classification task with labels -1 and 1, if the result y ′ If it is negative, we map it to label -1; otherwise, we map it to label 1.

[0058] S40, using a portion of the quantum state information obtained in step S20 to train the quantum variational circuit model, and optimizing the parameters of the quantum variational circuit model based on the loss function and the Adam optimizer during the training process.

[0059] The output quantum state is measured to obtain a scalar. This process can be repeated and the final result is further collected by the quantum prediction layer for the final classification prediction.

[0060] The parameter optimization process of the quantum variational circuit model starts with the calculation of the loss function and is performed in a classical device. The classical device compares the predicted classification label with the actual label of the corresponding sample and calculates the loss function L = l(E,y) based on the objective function l(·) of the task, where y is the actual label and E is the predicted classification label.

[0061] During the model training process, when the set number of iterations is reached, the training of the quantum variational circuit model is completed and the model parameter weights are determined.

[0062] The quantum variational circuit model parameter update process includes:

[0063] Calculate the variational parameters θ of each layer k The gradient of is given by

[0064] The calculation of depends on the expectation value of the quantum state, which is given by Among them U + and U - is the product of quantum gates;

[0065] The automatic differentiation framework is used to perform gradient expansion on the expected value of the quantum feature map. The specific gradient calculation formula is:

[0066]

[0067] in, Represents the parameter θ j The partial derivative of is the initial quantum state |ψ o >Expected value under tensor product of Pauli-Z gate, represents the tensor product of N Pauli-Z gates, |ψ i > represents the quantum state after the parameterized quantum gate transformation, and Respectively represent parameters The corresponding controlled NOT gate and its conjugate, Indicates that in θ j After the gradient calculation is completed, the gradient descent method is used to update the variational parameter θ of the quantum circuit. The update formula is: where η is the learning rate.

[0068] S50, inputting another part of the quantum state information obtained in step S20 into the trained quantum variational circuit model, measuring the output quantum state of the quantum variational circuit model, and obtaining an image classification result.

[0069] The embodiment of the present invention uses the TensorFlow Quantum (TFQ) platform to perform a simulation experiment of SQCNN, as follows:

[0070] First, the data set was preprocessed. Taking binary classification as an example, instances with labels 3 and 6 were selected, and then samples with conflicting labels were removed. That is, for the same image, if there are multiple different labels, the image will be removed.

[0071] After dataset preprocessing, the original MNIST dataset is screened into 12,049 training samples and 1,968 test samples. Figure 3 Some image examples from the MNIST dataset are shown. Three groups of classification experiments were selected on the MNIST dataset, which were 0 or 1, 2 or 5, and 3 or 6 classification tasks. The experiment was carried out for a total of 50 epochs, and the obtained data was organized into a change curve diagram as shown below Figure 4 shown.

[0072] After dataset preprocessing, the Fashion MNIST dataset is filtered to contain 12,000 training samples and 2,000 test samples. Figure 5 Shows some image examples from the Fashion MNIST dataset. On the Fashion MNIST dataset, we generated 2 or 5, 4 or 7, and 8 or 9 classification tasks.

[0073] In comparison, the reference (J.Wu, Z.Tao, Q.Li, wp scalable quantum neural networks for classification, in: 2022 IEEE International Conference on Quantum Computing and Engineering (QCE), IEEE, 2022, pp. 38–48.) provides a scalable quantum classifier based on QNN, which can perform binary classification on the Fashion MNIST data set. The comparison effect of the data set processed by the present invention and the reference is shown in the following table.

[0074]

[0075] It can be seen that the method of the present invention achieves higher accuracy on the MNIST handwritten digit dataset and the Fashion MNIST image dataset, and can be achieved using smaller parameters. Therefore, the present invention has significant advantages over existing conventional methods.

[0076] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An image classification method based on a scalable quantum convolutional neural network, characterized in that: The following steps are involved: S10, preprocessing the image data to be classified, and cutting the preprocessed image data into slices of required sizes; S20, converting slice data into quantum state information through angle encoding; S30, constructing a quantum system, including a quantum feature extraction part and a quantum classification measurement part, wherein the quantum feature extraction part includes a quantum variational circuit model with a quantum convolution layer, and the model uses alternating single-qubit gates and double-qubit gates to replace the convolution layer and the pooling layer of the convolutional neural network to extract features of quantum state information and obtain an output quantum state; S40, using a portion of the quantum state information obtained in step S20 to train the quantum variational circuit model, and optimizing the parameters of the quantum variational circuit model based on the loss function and the Adam optimizer during the training process; S50, inputting another part of the quantum state information obtained in step S20 into the trained quantum variational circuit model, measuring the output quantum state of the quantum variational circuit model, and obtaining an image classification result.

2. The method according to claim 1, characterized in that In step S10, the method for preprocessing the image data to be classified includes: for the same image, if there are multiple different labels, then the image is removed.

3. The method according to claim 1, characterized in that The encoding formula used in step S20 is: Among them, x i represents the i-th slice data vector, R is the rotation matrix, and n is the total number of samples.

4. The method according to claim 1, characterized in that: In step S30, the single quantum bit gate includes a Hadamard gate, an R X Door and R Y Gates, a two-qubit gate consists of CNOT gates on a pair of nearest-neighbor qubits.

5. The method according to claim 1, characterized in that For step S40, during the training of the quantum variational circuit model, the measurement results of the output quantum state are collected by the quantum prediction layer to perform the final classification prediction.

6. The method according to claim 1, characterized in that For step S40, the parameter optimization process of the quantum variational circuit model starts with calculating the loss function and is performed in a classical device. The classical device compares the predicted classification label with the actual label of the corresponding sample and calculates the loss function L = l(E, y) according to the objective function l(·) of the task, where y is the actual label and E is the predicted classification label.

7. The method according to claim 6, characterized in that During the training process of the quantum variational circuit model, when the set number of iterations is reached, the training of the quantum variational circuit model is completed and the model parameter weights are determined.

8. The method according to claim 7, characterized in that The quantum variational circuit model parameter update process includes: Calculate the variational parameters θ of each layer k The gradient of is The calculation of depends on the expectation value of the quantum state, which is given by Among them U + and U - is the product of quantum gates; The automatic differentiation framework is used to perform gradient expansion on the expected value of the quantum feature map. The specific gradient calculation formula is: in, Represents the parameter θ j The partial derivative of is the initial quantum state |ψ o >Expected value under tensor product of Pauli-Z gate, represents the tensor product of N Pauli-Z gates, |ψ i > represents the quantum state after the parameterized quantum gate transformation, and Respectively represent parameters The corresponding controlled NOT gate and its conjugate, Indicates that in θ j After the gradient calculation is completed, the gradient descent method is used to update the variational parameter θ of the quantum circuit. The update formula is: where η is the learning rate.

Citation Information

Patent Citations

  • Design method and system of quantum convolutional neural network based on quantum circuit

    CN116341666A

  • Time sequence classification deep learning system based on hybrid quantum neural network

    CN116342961A

  • Image multi-classification method based on multi-branch mixed quantum classical neural network

    CN117237715A

  • Multi-purpose distribution line protection device for safety-type apartment complexes

    KR102942831B1

  • Quantum modulation classifier system and method

    WO2024182883A1

Cited By

  • Brand-new quantum intelligent calculation method specially designed for smart city

    CN119918689A

  • Data feature extraction method and device based on quantum convolutional neural network

    CN120541498A

  • Image classification method of quantum convolutional neural network based on natural evolution optimizer

    CN120932016A

  • Image classification method of quantum convolutional neural network based on natural evolution optimizer

    CN120932016B

  • Quantum classical mixed image classification method based on group isovariant and delayed aggregation

    CN121962777A