CN117237715A - Image multi-classification method based on multi-branch mixed quantum classical neural network - Google Patents
Image multi-classification method based on multi-branch mixed quantum classical neural network Download PDFInfo
- Publication number
- CN117237715A CN117237715A CN202311188219.4A CN202311188219A CN117237715A CN 117237715 A CN117237715 A CN 117237715A CN 202311188219 A CN202311188219 A CN 202311188219A CN 117237715 A CN117237715 A CN 117237715A
- Authority
- CN
- China
- Prior art keywords
- quantum
- classical
- image
- convolution
- convolution layer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 34
- 238000013528 artificial neural network Methods 0.000 title claims abstract description 24
- 239000002096 quantum dot Substances 0.000 claims description 10
- 238000005259 measurement Methods 0.000 claims description 6
- 230000004913 activation Effects 0.000 claims description 3
- 238000012549 training Methods 0.000 abstract description 6
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 abstract description 3
- 230000004927 fusion Effects 0.000 abstract description 2
- 238000010801 machine learning Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 5
- 239000011159 matrix material Substances 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000013527 convolutional neural network Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000011160 research Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000008034 disappearance Effects 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 230000005283 ground state Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000000691 measurement method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000001537 neural effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 238000000513 principal component analysis Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Abstract
The invention is suitable for the technical field of image classification, and provides an image multi-classification method based on a multi-branch mixed quantum classical neural network, which comprises the following steps: step S1: extracting local features of the image by using a multi-channel quantum convolution layer constructed by a random quantum circuit; step S2: extracting local features of the image by using a classical convolution layer; step S3: fusing the outputs of the quantum convolution layer and the classical convolution layer; step S4: using a full connection layer to obtain a multi-classification result of the image, and visualizing the classified data type result; and constructing a random quantum circuit by utilizing different quantum gate operations, forming a multi-channel quantum convolution layer to extract image local features, simultaneously extracting image local features by using classical convolution layers containing convolution kernels of different sizes, finally carrying out feature fusion on the outputs of the quantum convolution layers and the classical convolution layers, inputting the outputs into a full-connection layer, adding a cross entropy loss function and an Adam optimizer, and training the classifier to carry out multi-classification on different types of images.
Description
Technical Field
The invention belongs to the field of image classification in quantum machine learning, and particularly relates to an image multi-classification method based on a multi-branch mixed quantum classical neural network.
Background
The computational power required by machine learning algorithms increases with increasing data volume, while current data volumes are growing at overwhelming rates, increasingly limiting for classical machine learning. While quantum machine learning has become a potential solution to address challenges in dealing with ever-increasing amounts of data as quantum computers have become more promising than any foreseeable classical computer in terms of solving certain computational tasks, quantum machine learning has received extensive attention in recent years, including quantum heuristic optimization algorithms, quantum principal component analysis, quantum support vector machines, quantum deep learning, quantum automatic encoders, quantum boltzmann machines, quantum generation countermeasure learning, quantum kernel methods, and the like.
Work in which quantum machine learning is used to solve the classification problem is also continuously being proposed. The Edward Grant et al constructs a layered quantum circuit, and concludes in the study that the quantum circuit with higher expressive force has better classification accuracy. Furthermore, the hybrid quantum classical neural network framework has also been used in classification tasks inspired by the learning capabilities of classical convolutional neural networks and the potential capabilities of quantum machine learning. Liu et al propose a hybrid quantum classical convolutional neural network that is very friendly to read current NISQ computers in terms of qubit number and circuit depth, adapts to quantum computation to enhance the process of feature mapping, while preserving the non-linear and extensible features of classical convolutional neural networks. Wei et al propose a quantum convolutional neural network, compared with classical, greatly reduce computational complexity, use it in image processing, carry on the numerical simulation to space filtering, smoothing, sharpening and edge detection, and has verified to have certain robustness in the image recognition.
Most of the existing research work is focused on the tasks of pattern recognition and digital image two-classification, and the problem of multi-classification is still continuously explored by a quantum neural network, so that the research of recognition and multi-classification of traditional natural images is absent.
Disclosure of Invention
The invention provides an image multi-classification method based on a multi-branch mixed quantum classical neural network, which aims to solve the problem that local characteristics of an image cannot be captured well based on a mixed quantum classical neural network structure, and utilizes the multi-branch mixed structure to improve the training speed of the neural network, extract more characteristic information and process multi-classification tasks of natural images.
The invention is realized in such a way that an image multi-classification method based on a multi-branch mixed quantum classical neural network comprises the following steps:
step S1: extracting local features of the image by using a multi-channel quantum convolution layer constructed by a random quantum circuit;
step S2: extracting local features of the image by using a classical convolution layer;
step S3: fusing the outputs of the quantum convolution layer and the classical convolution layer;
step S4: and using the full connection layer to obtain a multi-classification result of the image and visualizing the classified data type result.
Preferably, the mixed quantum classical neural network is composed of a plurality of channels, and the main body part of the mixed quantum classical neural network is 2 quantum convolution layer channels and 1 classical convolution layer channel.
Preferably, 2 quantum convolution layer channels respectively use 2 quantum convolution kernels with different sizes, the sizes are respectively 4×4 and 2×2, and convolution step sizes are respectively set to 2.
Preferably, the quantum convolution kernel is comprised of a random quantum circuit constructed by quantum gate operation, the gate comprising H, RY, CRZ, RX.
Preferably, the random quantum circuit adopts a full quantum bit measurement strategy, and all quantum bits are measured by using PauliZ quantum gates to obtain expected values.
Preferably, the classical convolution layer is formed by stacking two convolution kernels with different sizes, the sizes of the convolution kernels are respectively 1×1 and 4×4, and the convolution steps are respectively 1 and 2.
Preferably, the output channels of the quantum convolution layer and the classical convolution layer are fused through a splicing operation, so that the output channels serve as input of a full-connection layer, and the full-connection layer uses a leakyReLU as an activation function.
Compared with the prior art, the invention has the beneficial effects that: according to the image multi-classification method based on the multi-branch mixed quantum classical neural network, a random quantum circuit is constructed by utilizing different quantum gates, different granularity characteristics are extracted through a multi-channel quantum convolution layer, meanwhile, local characteristics are extracted through a classical convolution neural network containing convolution kernels of different sizes, finally, the output of the quantum convolution and the output of the classical convolution layer are subjected to characteristic fusion, the output of the quantum convolution and the output of the classical convolution layer are input into a full-connection layer, a cross entropy loss function and an Adam optimizer are added, and the classifier is trained to conduct multi-classification on different types of images.
Drawings
FIG. 1 is a schematic diagram of the method steps of the present invention;
FIG. 2 is a schematic diagram of the structure of the present invention;
FIG. 3 is a schematic diagram of a random quantum circuit according to the present invention;
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1-3, the present invention provides a technical solution: an image multi-classification method based on a multi-branch mixed quantum classical neural network comprises the following steps:
step S1: extracting local features of the image by using a multi-channel quantum convolution layer constructed by a random quantum circuit;
as shown in fig. 2, the method comprises a multi-channel quantum convolution layer, by respectively constructing 2 quantum convolution kernels with different sizes, wherein the sizes are respectively 4×4 and 2×2, convolution steps are respectively set to be 2, the construction of the quantum convolution kernels introduces the concept of quantum gates, a random quantum circuit with 4 quantum bits is constructed through different quantum gate operations, the random quantum circuit structure of the random quantum circuit is shown in fig. 3 and comprises a H, RY, CRZ, RX part, wherein H is a Hadamard quantum gate for creating an overlapped state for a ground state, RY and RX are original quantum rotation gates and represent controlled rotation quantum gates which are improved after being inspired by controlled non-gates, and RY and RX are respectively rotated by an angle theta around Y, X coordinate axes, so that probability amplitude change can be brought;
in the process of solving the problem of classical images by a quantum algorithm, quantum encoding is a very important step, namely, a classical data form is converted into quantum state data, in the method, an angle encoding strategy is adopted, a basic quantum gate H gate is firstly utilized to create a quantum superposition state, then a quantum revolving gate is utilized to encode classical information x,wherein->The tensor product of the matrix is represented, R represents a quantum rotation gate, and RY gate is adopted as R in the method;
after quantum coding operation, a CRZ quantum gate of two quantum bits is adopted, and the operation of a Z rotation gate is controlled, the method executes a CRZ quantum gate on every two adjacent quantum bits, and the operation significance is that if the control quantum bit isRZ rotation of the target controlled qubit, which otherwise remains unchanged, enables capturing of correlation of a specific scale on the same layer of the network, and then operating on each qubit with an RX quantum rotation gate, willThe effective information is embedded into the quantum system;
the final measurement stage, also called decoding stage, converts the quantum data into classical form, the process adopts Pauli matrix measurement as measurement method, adopts full-quantum bit measurement strategy, and utilizes matrix PauliZ with two unique characteristic values to make multiple measurements on each quantum bit so as to obtain the desired value, and the matrix is defined asI.e. the qubit state is +.>The state of the qubit corresponding to the +1 characteristic state of the Z operator is +.>The 1 characteristic state corresponding to Z is used for converting quantum state data into classical data, and further obtaining hidden information from a quantum system, wherein an operation matrix is shown in the following formula:
step S2: extracting local features of the image by using a classical convolution layer;
in this embodiment, as shown in fig. 2, the classical convolution layer channel is formed by stacking 2 convolution kernels with different sizes, the sizes are respectively 1×1 and 4×4, the convolution steps are respectively set to 1 and 2, the first convolution kernel traverses the whole input image, the extracted feature is used as the input of the next convolution kernel, and two convolution kernels with different sizes are stacked, so that the model performance is improved, more feature information is extracted, and the feature information is mapped to the next layer as complex feature.
Step S3: fusing the outputs of the quantum convolution layer and the classical convolution layer;
in the implementation method, output features from the quantum convolution layer and the classical convolution layer are fused through a splicing operation and serve as input of the next full-connection layer.
Step S4: and using the full connection layer to obtain a multi-classification result of the image and visualizing the classified data type result.
In this embodiment, to solve the problem of gradient disappearance and neuronal "death", the full-link layer uses the leakyReLU as an activation function, as follows:
the gradient can be calculated by inputting a part smaller than zero, a cross entropy loss function and an Adam optimizer are added in the training process, and the training classifier carries out multi-classification on different types of images. For multiple classifications, the cross entropy loss is as follows:
wherein M represents the number of categories; y is ic Taking 1 if the true category of the sample i is equal to c, or taking 0 if the true category is the sign function 0 or 1; p is p ic The prediction probability of the observation sample class c is represented.
And finally, visualizing the classification result of the data after model training, extracting the characteristics output by the last full-connection layer before the classifier, reducing the dimension to 2 dimensions, and visualizing the data after dimension reduction by adopting a tsne technology to obtain the visualization result of the data after model training.
It should be noted that, in fig. 2, input images+labels are Input labeled Images; resize+ Grayscale transformation is to adjust the image size and gray scale transformation; convolutional layers is a convolutional layer; quantum convolutional layer is a quantum convolution layer; classical convolutional layer is a classical convolution layer; fully connected layers is a fully connected layer; output is the Output.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, and alternatives falling within the spirit and principles of the invention.
Claims (7)
1. An image multi-classification method based on a multi-branch mixed quantum classical neural network is characterized by comprising the following steps of: the method comprises the following steps:
step S1: extracting local features of the image by using a multi-channel quantum convolution layer constructed by a random quantum circuit;
step S2: extracting local features of the image by using a classical convolution layer;
step S3: fusing the outputs of the quantum convolution layer and the classical convolution layer;
step S4: and using the full connection layer to obtain a multi-classification result of the image and visualizing the classified data type result.
2. The image multi-classification method based on the multi-branch mixed quantum classical neural network as claimed in claim 1, wherein the method is characterized by comprising the following steps: the mixed quantum classical neural network consists of a plurality of channels, and the main body part of the mixed quantum classical neural network is 2 quantum convolution layer channels and 1 classical convolution layer channel.
3. The image multi-classification method based on the multi-branch mixed quantum classical neural network of claim 3, wherein the method comprises the following steps: the 2 quantum convolution layer channels respectively use 2 quantum convolution kernels with different sizes, the sizes are respectively 4×4 and 2×2, and the convolution step sizes are all set to 2.
4. The image multi-classification method based on the multi-branch mixed quantum classical neural network of claim 3, wherein the method comprises the following steps: the quantum convolution kernel consists of a random quantum circuit constructed by quantum gate operations, the gates comprising H, RY, CRZ, RX.
5. The image multi-classification method based on the multi-branch mixed quantum classical neural network of claim 5, wherein the method comprises the following steps: the random quantum circuit adopts a full quantum bit measurement strategy, and uses PauliZ quantum gates to measure all quantum bits to obtain an expected value.
6. The image multi-classification method based on the multi-branch mixed quantum classical neural network as claimed in claim 1, wherein the method is characterized by comprising the following steps: the classical convolution layer is formed by stacking two convolution kernels with different sizes, the sizes of the classical convolution layers are respectively 1 multiplied by 1 and 4 multiplied by 4, and the convolution step sizes are respectively 1 and 2.
7. The image multi-classification method based on the multi-branch mixed quantum classical neural network as claimed in claim 1, wherein the method is characterized by comprising the following steps: the output channels of the quantum convolution layer and the classical convolution layer are fused through splicing operation, so that the quantum convolution layer and the classical convolution layer are used as input of a full-connection layer, the full-connection layer uses a leakyReLU as an activation function, and finally the classified data type result is visualized through tsne.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311188219.4A CN117237715A (en) | 2023-09-15 | 2023-09-15 | Image multi-classification method based on multi-branch mixed quantum classical neural network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311188219.4A CN117237715A (en) | 2023-09-15 | 2023-09-15 | Image multi-classification method based on multi-branch mixed quantum classical neural network |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117237715A true CN117237715A (en) | 2023-12-15 |
Family
ID=89087326
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311188219.4A Pending CN117237715A (en) | 2023-09-15 | 2023-09-15 | Image multi-classification method based on multi-branch mixed quantum classical neural network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117237715A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117437494A (en) * | 2023-12-20 | 2024-01-23 | 量子科技长三角产业创新中心 | Image classification method, system, electronic equipment and storage medium |
-
2023
- 2023-09-15 CN CN202311188219.4A patent/CN117237715A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117437494A (en) * | 2023-12-20 | 2024-01-23 | 量子科技长三角产业创新中心 | Image classification method, system, electronic equipment and storage medium |
CN117437494B (en) * | 2023-12-20 | 2024-04-16 | 量子科技长三角产业创新中心 | Image classification method, system, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Gao et al. | SAR image change detection based on multiscale capsule network | |
KR101916347B1 (en) | Deep learning based image comparison device, method and computer program stored in computer readable medium | |
Bhatti et al. | Geometric algebra applications in geospatial artificial intelligence and remote sensing image processing | |
CN110175248B (en) | Face image retrieval method and device based on deep learning and Hash coding | |
Zhao et al. | A malware detection method of code texture visualization based on an improved faster RCNN combining transfer learning | |
CN117237715A (en) | Image multi-classification method based on multi-branch mixed quantum classical neural network | |
Klemmer et al. | Spate-gan: Improved generative modeling of dynamic spatio-temporal patterns with an autoregressive embedding loss | |
Xu et al. | Feature data processing: Making medical data fit deep neural networks | |
Liu et al. | Quantum image edge detection based on eight-direction Sobel operator for NEQR | |
CN110111365B (en) | Training method and device based on deep learning and target tracking method and device | |
Daihong et al. | Facial expression recognition based on attention mechanism | |
CN110033034B (en) | Picture processing method and device for non-uniform texture and computer equipment | |
Song et al. | Occluded offline handwritten Chinese character inpainting via generative adversarial network and self-attention mechanism | |
CN116150747A (en) | Intrusion detection method and device based on CNN and SLTM | |
Wang et al. | CWC-transformer: a visual transformer approach for compressed whole slide image classification | |
CN114299305A (en) | Salient object detection algorithm for aggregating dense and attention multi-scale features | |
CN116579616B (en) | Risk identification method based on deep learning | |
Zeng et al. | Deep superpixel convolutional network for image recognition | |
CN113222002A (en) | Zero sample classification method based on generative discriminative contrast optimization | |
CN111860361A (en) | Green channel cargo scanning image entrainment automatic identifier and identification method | |
Bi et al. | Critical direction projection networks for few-shot learning | |
CN116341666A (en) | Quantum convolution neural network design method and system based on quantum circuit | |
CN114049567B (en) | Adaptive soft label generation method and application in hyperspectral image classification | |
Huynh et al. | An efficient model for copy-move image forgery detection | |
Li et al. | Point cloud classification network based on self-attention mechanism |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |