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

By optimizing quantum image encoding and convolution methods and combining them with quantum pooling layer dimensionality reduction, a quantum convolutional neural network was designed, which solved the problem of insufficient performance of traditional algorithms on quantum devices and achieved efficient image classification in noisy environments.

CN116341666BActive Publication Date: 2026-01-06CHENGDU DIGITAL CHAIN ALLIANCE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310260720.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2026-01-06
Estimated Expiration
2043-03-17

AI Technical Summary

Technical Problem

In existing technologies, image classification algorithms rely on manual feature extraction, have poor generalization ability, and cannot meet the processing efficiency requirements of the big data era. Furthermore, traditional convolutional neural networks have insufficient performance in noisy environments on quantum computing devices.

Method used

We designed a quantum convolutional neural network based on quantum circuits. By optimizing quantum image encoding and convolution methods, using quantum data reloading technology to reduce the number of qubits, performing dimensionality reduction extraction in the quantum pooling layer, and combining parameterized quantum circuits for classification.

Benefits of technology

With fewer parameters, the model performance is improved, adapting to current noisy, medium-sized quantum devices, reducing the number of qubits, and achieving better feature extraction and classification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116341666B_ABST
    Figure CN116341666B_ABST
Patent Text Reader

Abstract

The application relates to a design method and system of a quantum convolutional neural network based on a quantum circuit, and belongs to the field of quantum computing.The method comprises the following steps: S1, standardizing a to-be-classified image and partitioning the image according to a classical convolution method; S2, designing a quantum circuit for quantum image coding and convolution, and coding and processing the image partitioned in S1; S3, performing pooling processing on the image data processed in S2, and extracting feature information on multiple quantum bits to one quantum bit; and S4, designing a quantum fully-connected neural network to process and analyze the feature information pooled in S3 and split the image.The application optimizes quantum coding and preparation through a quantum data reloading method, reduces the consumption of the number of quantum bits of an algorithm model, retains the characteristics of partial connection and weight sharing of a classical convolutional neural network, and reduces the number of parameters in the circuit under the premise of not losing accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of quantum computing and relates to a design method and system for a quantum convolutional neural network based on quantum circuits. Background Technology

[0002] Images, as one of the most important information transmission carriers in human life, provide the most intuitive and clear representation of various things and scenes in real life, and are also an important means for people to obtain information. Image classification, as the foundation of image processing, machine learning, and artificial intelligence, has become a key and hot research direction. Image classification is the problem of classifying images by extracting their feature representations after a series of mathematical operations, thus indicating whether the image belongs to a certain class within a predefined category. Image classification mainly includes three parts: image preprocessing, image feature extraction, and classifier. Traditional image classification algorithms are mostly based on image features, which are extracted manually. These manually extracted features have poor generalization ability and rely heavily on the designer's prior knowledge and subjective understanding of the task. This method of relying on human intervention to analyze and study data is clearly insufficient to meet the efficiency requirements of the big data era. Machine learning technology enables people to use computers to intelligently analyze and process massive amounts of data.

[0003] Deep learning has significant advantages in image processing, and combining quantum neural networks with deep learning to design quantum machine learning algorithms for image classification is of great importance. Convolutional neural networks are the primary image processing model in deep learning. Therefore, using neural networks based on parameterized quantum circuits to replace classical convolutional neural networks is a crucial entry point for applying quantum machine learning algorithms to image classification. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a design method and system for a quantum convolutional neural network based on quantum circuits. This method optimizes the quantum convolutional neural network circuitry by using quantum data reloading for the quantum convolutional layers. This avoids the limitation that a single qubit only provides a simple superposition of two states and is intended for rotation within a Bloch sphere, allowing a single qubit to serve as a convolutional kernel for feature extraction of relevant image regions. Furthermore, a quantum pooling layer is designed to reduce the dimensionality of feature extraction, decreasing the number of parameters in subsequent quantum circuits. The proposed algorithm reduces the overall number of qubits in the quantum circuitry and exhibits good model performance with fewer parameters, making it easier to implement on current noisy, medium-scale quantum devices.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] A design method and system for quantum convolutional neural networks based on quantum circuits, the method comprising the following steps:

[0007] S1: Standardize the image to be classified and partition the image according to the classic convolution method;

[0008] S2: Design quantum circuits for quantum image encoding and quantum convolutional layers to encode images and extract features;

[0009] S3: Design the quantum circuitry of the quantum pooling layer to extract dimensionality reduction features from the image after quantum convolution;

[0010] S4: Input the pooled quantum image information into a fully connected quantum neural network built on parameterized quantum circuits to classify the image.

[0011] Optionally, S1 specifically includes:

[0012] S11, The image to be classified is standardized. The standardization and partitioning method is to standardize all pixel values ​​of the image to be classified to the range of [0,1] so that the image information can be accurately expressed in the quantum state.

[0013] S12. After the image to be classified is standardized, according to the classic convolution method, a 4×4 image is divided into 4 regions of size 3×3 according to the rule of convolution kernel size 3×3 and convolution stride 1.

[0014] Optionally, S2 specifically includes:

[0015] S21, the four 3×3 image regions divided in S12 are encoded onto four qubits and processed; the encoding and processing method is as follows: the pixel data of each 3×3 image region is processed by the quantum rotation operator R. Z R Y R Z Encoding onto a single qubit, the rotation operator comprises three parameters; that is, encoding a 3×3 image requires three R values. Z R Y R Z Rotation operator;

[0016] S22, the qubits encoded in the previous S21 are applied to a parameterized quantum rotation gate. The parameters of the rotation gate are adjustable, so as to process the encoded image pixel data.

[0017] S23 uses S21 and S22 as a processing layer. Each qubit in a processing layer uses the same parameters. By stacking multiple processing layers, feature extraction is performed on the image of the corresponding region. That is, each processing layer contains the re-encoding of the image. Finally, the qubit stores the features extracted from each region.

[0018] Optionally, S3 specifically includes:

[0019] S31. After processing by S23, the quantum state is pooled. The qubits to be pooled are grouped. First, the qubits of the corresponding pooling group are entangled by H gate and CNOT gate. Then, each qubit is treated by a parameterized rotation gate Ry gate, where the parameters are adjustable. Each group of pooling qubits uses the same set of parameters.

[0020] S32, after processing in S31, performs sequential measurement operations on the qubits in each pooling group, and determines whether to perform an R operation on the next qubit based on the measurement result of the current qubit. z The rotating door operation has fixed parameters; finally, one qubit is left to store image feature information.

[0021] Optionally, S4 specifically includes:

[0022] S41: The remaining qubits after processing in S32 are input into a fully connected quantum layer based on parameterized quantum circuits for further processing. First, the remaining qubits are entangled through a two-qubit CNOT gate. Then, a parametric rotation gate is applied to each qubit, choosing Ry and R... Z R Y R Z The door evolves;

[0023] S42, taking the quantum layer described in S41 as a layer, different circuit expressibility is obtained by stacking these quantum layers, Z expectation value is measured for each quantum bit, and the measured expectation value is input into a classical neural network with a corresponding number of neurons for classification processing;

[0024] Using the open-source quantum computing toolkit Pennylane and the package and environment management functions provided by Anaconda, we simulated and implemented an experimental simulation of a quantum convolutional neural network in Python.

[0025] A design system for a quantum convolutional neural network based on parameterized quantum circuits, comprising a quantum part and a classical part, is provided based on the method described above.

[0026] The classic part includes image preprocessing and classification output;

[0027] The quantum component includes quantum convolutional layers and quantum neural networks;

[0028] The image to be classified first undergoes classical preprocessing, including standardization and image partitioning. Next, the regions segmented from the image are encoded into a trained quantum circuit according to method S2 for quantum processing. First, image features are extracted from each region using a quantum convolutional layer. Then, the extracted features are pooled according to method S3 to reduce dimensionality. The remaining qubits form a quantum neural network to classify the image according to method S4. Finally, all qubits are measured, and the expected value of the measurement is input into a classical neural network layer to obtain the image classification result, i.e., the image label. The beneficial effects of this invention are:

[0029] 1. This invention optimizes the quantum image encoding and convolution methods. Although both use angle encoding, it reduces the number of qubits required to prepare images of the same size and can extract features well. Compared with amplitude encoding, it reduces the encoding complexity by appropriately increasing the number of qubits, so that the algorithm model can be adapted to the first-generation quantum computers of medium-scale quantum devices with noise.

[0030] 2. This invention retains the characteristics of partial connections and weight sharing in classical convolutional neural networks, which can reduce the number of parameters and improve the classification performance of the model compared with using quantum fully connected neural network models to achieve classification tasks.

[0031] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description

[0032] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:

[0033] Figure 1 This is a technical roadmap of the method of the present invention;

[0034] Figure 2 The image to be classified; Figure 2 (a) is a classic schematic diagram of an 8×8 image to be classified. 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 2(h), 2(i), 2(j), 2(k), 2(l), 2(m), 2(n), 2(o), 2(p), and 2(q) are the 16 convolution regions of the image to be classified according to the classic convolution method.

[0035] Figure 3 This is a diagram showing the image encoding and single-layer convolutional layer circuitry designed based on the quantum data reloading method of this invention.

[0036] Figure 4 The N-layer circuit diagram of the encoding and convolution circuit designed for this invention;

[0037] Figure 5 The circuit diagram of the quantum pooling layer designed for this invention;

[0038] Figure 6 A quantum circuit diagram of quantum encoding, convolutional layers, and quantum pooling layers; Figure 6 (a) shows the quantum coding and convolutional quantum circuit of the present invention on an 8×8 image, and (b) shows the quantum circuit diagram of the present invention for pooling 4 qubits into 1 qubit.

[0039] Figure 7 This refers to the single-layer quantum neural network quantum circuit used in this invention;

[0040] Figure 8 This is the classic output layer circuit for the binary classification task in this invention;

[0041] Figure 9 This is the complete model circuit diagram of the present invention;

[0042] Figure 10 This is a diagram showing the training results of the present invention on a handwritten digit binary classification task; Figure 10 (a) A graph showing the model accuracy for a binary classification task of the digits “3” and “6” in the UCI handwritten digit dataset; Figure 10 (b) Model loss diagram for binary classification of the digits “3” and “6” in the UCI handwritten digit dataset;

[0043] Figure 11 This is a system framework diagram of the present invention. Detailed Implementation

[0044] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0045] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0046] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.

[0047] Please see Figures 1 to 11 This paper presents a design method and system for quantum convolutional neural networks based on quantum circuits.

[0048] Specifically in this embodiment, S1 is as follows:

[0049] The first step is to obtain the basic information of the image to be processed, and normalize the image pixels to the range of [0,1] to obtain an 8×8 image with pixel values ​​in the range of [0,1]. Since subsequent steps require padding of the 8×8 image, it is padded to become a 9×9 image.

[0050] The second step is to use a 3×3 convolution kernel template to partition the image, with a stride of 2 in both the vertical and horizontal directions; then extract the data as follows: Figure 2 (b) to Figure 2 (q) consists of 16 3×3 image regions to be encoded.

[0051] In this embodiment, similar to that in classical convolutional neural networks, different convolutional regions can be identified based on the image size and selection, and then the corresponding number of qubits is selected to encode them based on the number of convolutional regions.

[0052] S2 specifically involves designing the quantum circuitry for the encoding and convolution parts of a quantum convolutional neural network, and performing encoding and convolution operations on the image partitioned in step S1.

[0053] The first step is to encode the 16 regions to be encoded onto 16 qubits, using the R encoding method. Z R Y R ZThe rotation operator is used for encoding, which contains three parameters. Each set of three parameters contains three pixel values ​​from the region to be encoded, represented by three R values. Z R Y R Z Rotation operators encode data;

[0054] The second step involves encoding the data into the 16 qubits, and then using an R on each qubit. Z R Y R Z As a parameter layer, it's important to note that the same adjustable parameters are used on each qubit. The unitary evolution in the quantum circuit can be represented as:

[0055]

[0056] The above steps construct a single processing layer for the convolutional part of a convolutional neural network, such as... Figure 3 The circuit is a single-layer convolution circuit.

[0057] The third step involves extracting features to varying degrees from each encoded image region by stacking convolutional layers of different depths. During this process, the qubits remain unentangled. This is achieved by stacking N layers of circuitry. Figure 4 The unitary transform of an N-layer convolutional quantum circuit can be expressed as:

[0058]

[0059] S3 specifically involves designing the quantum circuitry of the quantum pooling layer to perform feature reduction and dimensionality extraction on the image data processed by convolution in step S2.

[0060] The first step involves pooling 4 qubits into one qubit across the 16 qubits, which is done by grouping 4 qubits into a pooling group. H-gates are applied to all qubits, and the qubits in the corresponding pooling groups are entangled using CNOT gates in a ring connection.

[0061] The second step involves applying four parametric rotation gates R to the four qubits in each pooling group. y If each pooling group uses the same set of parameters, then it contains 4 adjustable parameters;

[0062] The third step involves measuring the first three qubits sequentially, and then determining whether to apply a fixed parameter R to the next qubit based on the measurement results. z In the revolving door approach, the information from the last four qubits is extracted and stored in a single qubit, leaving only four qubits storing the image's feature information in the entire quantum circuit. The specific quantum circuit diagram of the quantum pooling layer is shown below. Figure 5 The quantum convolutional layer and pooling layer for an 8×8 image are as follows: Figure 6 (a) and Figure 6 As shown in (b).

[0063] S4 specifically involves designing a fully connected quantum neural network to classify the image after feature extraction. The 8×8 image processed in step S1 is encoded onto qubits, and then subjected to convolution and pooling operations of depth 2 in S2 and S3. The quantum circuit diagram is as follows: Figure 7 The remaining four qubits are then input into a fully connected quantum neural network layer for classification. The specific steps are as follows:

[0064] The first step is to output 4 qubits from the quantum pooling layer, and then apply a parametric Ry gate or R gate to these 4 qubits. Z R Y R Z The rotation operator then entangles the four qubits through a CNOT gate via a neighborhood connection; this is... Figure 7 The diagram shows a single fully connected neural network.

[0065] The second step involves stacking multiple layers of fully connected quantum neural networks to obtain different quantum circuit expressibility for image classification. After the data is processed by multiple layers of quantum neural networks, the Z-expectation value is measured for each qubit, as shown below:

[0066] <z> |ψ> =<ψ|Z|ψ> (3)

[0067] We obtain four expected values, which are then fed into a classic neural network. The number of output neurons is the same as the number of categories in the current classification task. Figure 8 The quantum circuitry designed for a binary classification task leads to the output circuitry of a classical neural network. The output of the classical layer uses the sofmax activation function, the loss function uses the cross-entropy function, and finally, the Adam optimizer is used to optimize the parameters in the model to minimize the loss function.

[0068] After the previous steps Figure 9 The quantum convolutional neural network model has been built. Simulation experiments were conducted on the Pennylane framework to perform a binary classification task on the UCI handwritten dataset, using the digits "3" and "6". Figure 10 The simulation experiment yielded accuracy and loss graphs. All quantum fully connected neural networks had a depth of 4 layers. The black, red, blue, and green lines in the graph represent the accuracy and loss results for quantum convolutional layer circuits with depths of 1, 2, 3, and 4, respectively. It can be seen that the circuits designed in this invention can achieve good performance and converge quickly with fewer parameters.

[0069] Figure 11 This is a diagram illustrating the overall system framework of the present invention. The entire system comprises a quantum part and a classical part. The classical part includes image preprocessing and classification output. The quantum part includes quantum convolutional layers and a quantum neural network. The image to be classified first undergoes preprocessing in the classical part, including standardization and image partitioning. Next, the regions segmented from the image are encoded into trained quantum circuits according to step S2 for quantum processing. First, image features are extracted from the segmented regions using quantum convolutional layers. Then, the extracted features are pooled to reduce dimensionality according to step S3. The remaining qubits form a quantum neural network to classify the image according to step S4. Finally, all qubits are measured, and the expected values ​​are input into a classical neural network layer to obtain the image classification result, i.e., the image label.

[0070] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.< / z>

Claims

1. A method for designing a quantum convolutional neural network based on a quantum circuit, characterized in that: The method comprises the following steps: S1: standardizing the image to be classified, and partitioning the image according to a classical convolution method; S2: designing a quantum image coding and quantum convolution layer quantum circuit to code and extract features of the image; specifically: S21, encode the four 3*3 image regions divided in S12 to four qubits, and process; the encoding and processing method is: encode the pixel data in each 3*3 image region by quantum rotation operator R Z R Y R Z Encoding to one qubit, the rotation operator includes three parameters, that is, three R Z R Y R Z Rotation operators; S22, applying a quantum rotation gate with parameters to the quantum bits coded in the foregoing S21, the parameters of the rotation gate being adjustable parameters, to process the coded image pixel data; S23, taking S21 and S22 as a processing layer, each quantum bit in the processing layer being provided with the same parameters, and extracting features of the image in the corresponding region by stacking multiple processing layers, that is, each processing layer comprises re-coding of the image, and finally the features extracted from each region are saved in the quantum bits; S3: designing a quantum pooling layer quantum circuit to reduce the dimensionality of the image features after quantum convolution; specifically: S31, after the processing of S23, the quantum state is processed by pooling, the quantum bits to be processed by pooling are grouped, the quantum bits of the corresponding pooling group are first acted on by an H gate and entangled by a CNOT gate, and then a parameterized rotation gate is acted on each quantum bit Ry gate, wherein the parameter is an adjustable parameter, and each group of quantum bits of the pooling group uses the same group of parameters; S32, after the processing of S31, sequentially measuring the quantum bits in each pooling group, and judging whether to perform a measurement operation on the next quantum bit according to the measurement result of the current quantum bit R z The rotation door operation is performed and the parameters are fixed; finally, one quantum bit is left to store the image feature information; S4: inputting the pooled quantum image information into a quantum fully connected neural network based on a parameterized quantum circuit to classify the image; specifically: S41, input the remaining qubits after S32 processing into a quantum full connection layer based on a parameterized quantum circuit for processing, first entangle the remaining qubits through a two-qubit gate CNOT gate, then apply a parameterized rotation gate on each qubit, select Ry and R Z R Y R Z evolve through a gate; S42, taking S41 as a quantum layer, obtaining different circuit expressiveness by stacking the quantum layers, measuring the Z expectation value of each quantum bit, and inputting the measured expectation value into a classical neural network with a corresponding number of neurons to perform classification processing; The open source quantum computing toolkit Pennylane and the package management and environment management functions provided by Anaconda are used to simulate and implement the experimental simulation of the quantum convolutional neural network by using Python language.

2. The method of claim 1, wherein: The S1 specifically comprises: S11, standardizing the image to be classified, wherein the standardization and partitioning method comprises standardizing all pixel values of the image to be classified to the range of [0, 1] so that the image information can be accurately expressed in a quantum state; S12, after the image to be classified is standardized, a 4*4 size image is partitioned into four 3*3 size regions according to the rules of a 3*3 size convolution kernel and a 1 step convolution stride.

3. A design system of a quantum circuit-based quantum convolutional neural network based on the method of claim 1 or 2, characterized by: The system comprises a quantum part and a classical part; The classical part comprises an image preprocessing and classification output part; The quantum part comprises a quantum convolution layer and a quantum neural network; The image to be classified is first preprocessed by the classical part, including standardization and partitioning of the image; secondly, each region of the image is coded according to the method of S2 into a trained quantum circuit for quantum processing, first, the features of each region of the image are extracted by the quantum convolution layer, then the extracted features are pooled according to the method of S3 to reduce the dimensionality; the remaining quantum bits form a quantum neural network to classify the image according to S4, finally, all quantum bits are measured and the measured expectation values are input into a classical neural network to obtain the classification result of the image, that is, the label of the image.