An image classification method based on quantum random walk algorithm
Through the color gamut compression method of the quantum random walking algorithm, the image RGB value is converged to the specified color, solving the problem of large amount of image compression calculation and achieving efficient image classification and reasoning.
Patent Information
- Application Number
- CN202310343586.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-03
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2043-04-03
AI Technical Summary
The prior art has a large amount of calculation in the process of image compression, making it difficult to retain effective information of the image while reducing the calculation amount, resulting in a long response time for business reasoning decisions.
The color gamut compression method based on the quantum random walking algorithm is adopted to converge the RGB value of the image to the specified five colors, and the data set is preprocessed using the quantum random walking algorithm, deep learning classification model is trained, and image classification is performed.
It greatly reduces the amount of calculation, improves the inference efficiency of image classification, and shortens the response time of business inference decisions.
Smart Images

Figure CN116403036B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image recognition, and in particular relates to an image classification method based on a quantum random walk algorithm. Background Art
[0002] One of the key algorithms in quantum computing is the quantum walk, which is the quantum mechanical equivalent of a classical random walk. Due to the inherent superposition properties of quantum states, a quantum walk does not choose a single path from among all possible paths, but rather a superposition of all these paths. This characteristic has led to quantum walks being theoretically predicted to have significant quantum acceleration effects in many optimization algorithms, such as spatial search problems, element identification, determining graph isomorphisms, and "fast hitting" algorithms. The "fast hitting" algorithm utilizes Feynman PAQS software to theoretically design the experimental evolution length, which was then experimentally demonstrated for the first time in an optical quantum chip, demonstrating quadratic acceleration relative to classical particles, and an optimal arrival efficiency that is an order of magnitude higher than that of classical particles.
[0003] Quantum random walks are another quantum computing algorithm. They are a hybrid of quantum and classical random walks and are an important tool for analyzing open quantum systems. They can be used to simulate energy transfer in condensed matter or biological systems, as well as web page sorting algorithms. Quantum random walks have been used to simulate the associative memory function of Hopfield neural networks in a three-dimensional photonic integrated chip.
[0004] Today, the vast amount of information generated daily requires compression encoding before transmission to conserve channel bandwidth. For any compressible signal, it is possible to find a corresponding sparse basis matrix. By taking only the largest K weight coefficients after transform encoding, a good approximation of the original signal can be achieved. Quantum random walk algorithms, with their parallel computing capabilities, offer significant acceleration compared to traditional algorithms. Using the above approach, the image is converged pixel by pixel in a three-dimensional RGB color space, ultimately converging all colors in the image to five specified colors, achieving color gamut compression while preserving a minimum amount of effective image information. This color gamut compressed dataset is used to train deep learning models and implement image classification. Summary of the Invention
[0005] (1) Technical issues to be resolved
[0006] The technical problem to be solved by the present invention is how to provide an image classification method based on the quantum random walk algorithm to significantly reduce the amount of image compression calculations while retaining the effective information in the image to a minimum, so as to be used for training deep learning models and performing image classification, thereby shortening the response time of business reasoning decisions.
[0007] (2) Technical solution
[0008] In order to solve the above technical problems, the present invention proposes an image classification method based on a quantum random walk algorithm, which includes the following steps:
[0009] First, based on the specified sink value and H matrix parameters, the data set is batched using the color gamut compression method based on quantum random walk;
[0010] Secondly, the deep learning classification model is trained using the color gamut compressed dataset; the classification model is, for example, EfficientNet.
[0011] Finally, the trained network parameters are loaded and the test set after color gamut compression by the quantum random walk algorithm is inferred, that is, the target object category in the output image is obtained.
[0012] (3) Beneficial effects
[0013] This paper proposes an image classification method based on a quantum random walk algorithm. The color gamut compression method employed in this paper leverages the advantages of highly parallel computing, significantly reducing the amount of computation required. This color gamut compression method is used to process training, validation, and test sets for deep learning classification models. It can reduce computational effort while preserving essential information, improving inference efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 To construct a color cube space with RGB three primary colors as three orthogonal coordinate axes;
[0015] Figure 2 The present invention realizes the training process and reasoning process of grayscale color gamut compressed image classification. DETAILED DESCRIPTION
[0016] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below with reference to the accompanying drawings and examples.
[0017] The purpose of this invention is to provide a semi-supervised color gamut compression method based on the quantum associative memory algorithm, which preprocesses the data set and compresses all images to five specified colors, greatly reducing the amount of data calculation while retaining the effective information in the image to a minimum. It is used for training deep learning models and performing image classification, thereby shortening the response time of business reasoning decisions.
[0018] The present invention provides the following method: using a quantum random walk algorithm to compress the color gamut of an image, so that the RGB values of the image converge to five specified colors, while retaining the most basic information, which is used as a dataset for training image classification and semantic segmentation models, and ultimately used in the engine to complete reasoning.
[0019] The principle of the present invention is introduced:
[0020] The quantum random walk algorithm converges the color values in an image to several specified color sinks. The user can specify the number of sinks and the corresponding RGB values. According to the four-color theorem, when the number of converged color values is greater than or equal to four, the image has been effectively partitioned into adjacent color gamuts.
[0021] The quantum random walk process can be simulated and described by the Lindblad equation:
[0022]
[0023] The Lindblad equation consists of two parts: quantum random walk and classical random walk, where ρ reflects the probability distribution of all nodes, and ω controls the ratio of quantum and classical random walks in the mixed random walk. The first term i on the right side of the equation represents the imaginary part of the complex plane, H is the Hamiltonian matrix (symmetric matrix), representing the quantum walk, and [H,ρ] represents the operator H acting on ρ. The remaining terms on the right side of the equation represent pure classical random walks, which can cause photons to "jump" directly to the energy valley sink, where L ij Corresponding to the connection from node i to node j, Indicates L ij The conjugate of does not need to be symmetrical with each other, that is, it can be used to simulate the one-way edge through the Lindblad incoherence term. After a certain evolution time, quantum random walk can obtain a stable probability distribution result, which can be used as a good basis for ranking the importance of nodes.
[0024] In the Hamilton matrix H, the main diagonal parameter value is B h is the propagation constant in the waveguide; among the other parameters, C is the coupling coefficient between different waveguides, C sink Represents the classic walking L ij The detailed explanation of the matrix H is as follows.
[0025] H ii =B h , 0≤i<16 3 , 0≤j<16 3 ①
[0026] H ij =C, i≠j, b1+16×(g1+16×r1)=i, b2+16×(g2+16×r2)=j, r1=r2±1||g1=g2±1||b1=b2±1, 0≤i<16 3 , 0≤j<16 3 ②,
[0027] Hij =Csink, (i=sink&j=16 3 )||(4096≤i<4596&j=i+1) ③,
[0028]
[0029] The RGB value convergence mapping principle ultimately achieved by quantum random walk is similar to the "associative memory" idea of the Hopfield neural network.
[0030] The Hopfield network is a single-layer network with N neuron nodes. The output of each neuron is connected to the input of other neurons. Each node can be in a possible state x i (1 or 0). Use w ij represents the connection strength between neurons i and j. The stimulation received by neuron j from neuron i can be expressed as w ij x i That is, when the total stimulation received by the neuron exceeds a certain threshold, the neuron is in one state (for example, 0), otherwise the neuron is always in another state (for example, 1):
[0031]
[0032] where θ i is the threshold set for each neuron. The Hopfield network also satisfies the requirement that the connection between each two nodes is symmetrical and that each node has no self-feedback:
[0033] w ij =w ji
[0034] w ii =0
[0035] The state of the unit is updated randomly and asynchronously, with only one unit changing its state at a time. The binary neural network is composed of n binary units, and the output of each unit can only be two values 0 or 1.
[0036] The requirement for weight symmetry is an important feature because it ensures that the energy equation (the process of convergence to a certain point in the function is called the conversion of potential energy into energy) is monotonically decreasing when the neuron is activated. Hopfield's energy equation can be expressed as follows:
[0037]
[0038] When the energy equation reaches its minimum value, this energy valley is a state in which the Hopfield network reaches a steady state. The initial discharge pattern will often pass through w after dynamic evolution. ijThe regulatory changes reach the most recent energy low steady state, which is Hopfield's important "associative memory" function.
[0039] Quantum random walks can also be used to realize the "associative memory" function and apply it to image recognition. The specific semantic mapping includes the following steps.
[0040] First, the distance between different nodes in the quantum random walk evolution space is similar to the Hamming distance between different discharge patterns in a Hopfield network, corresponding to the difference in RGB values of pixels in an image. According to the "associative memory" function of Hopfield neural networks, the discharge pattern will always choose the energy valley with the closest Hamming distance to reach a steady state.
[0041] Secondly, construct the color cube space. The three primary colors RGB can correspond to the three mutually orthogonal axes xyz of the cubic space, then the three vertices (255,0,0), (0,255,0), (0,0,255) represent red, green and blue respectively. Based on the xyz axis, the following is generated: Figure 1 The color cube space is shown, and energy sinks are set up at the eight vertices.
[0042] Third, multiple groups of tightly coupled nodes encourage photons to transmit to auxiliary nodes representing energy troughs. Tightly coupled nodes can promote photons to "jump" directly to multiple sinks specified in the image, which is similar to the principle of energy troughs in the Hopfield network that enable the discharge pattern to reach a steady-state distribution.
[0043] Fourthly, the probability distribution of photons in the auxiliary nodes of different sinks is similar to the "associative memory" result of the Hopfield network discharge mode. When all pixels in the image are confirmed by "associative memory" to have their original colors converged to the corresponding RGB values of the sink, color gamut compression is successfully achieved.
[0044] Based on the above analysis, the present invention provides a color gamut compression method based on quantum random walk, the steps are as follows:
[0045] S1. Establish a color cube space based on the three dimensions of R, G, and B. In order to reduce the amount of calculation, the R, G, and B values are compressed by 16:1 in each dimension, that is, the R, G, and B values are divided by 16 and rounded up. 3 Colors compressed to 16 3 Colors
[0046] S2, map the three-dimensional color cube space to the two-dimensional H matrix, that is, encode the RGB value of each color according to the formula B+16×(G+16×R), and encode the 16-dimensional color cube space into a two-dimensional H matrix. 3 The 3D cube is mapped to (163 ) 2 The H matrix, the mapping method is:
[0047] S21. For each point on the main diagonal of the matrix, its coordinates (x, y) are RGB. The matrix and the corresponding point coordinates in the three-dimensional cube have the following relationship: B + 16 × (G + 16 × R) = x, x = y.
[0048] S22, the coordinate value of a point on the off-diagonal line represents the coupling coefficient between the color values corresponding to the x and y coordinates of the point;
[0049] S23. Assume that the user specifies n sinks. On this basis, add n×100 auxiliary nodes to the x and y direction lengths of the H matrix respectively, and associate each sink value to a set of 100 consecutive auxiliary nodes. The association method is to use the L in the classic walk. ij Implement a jump from the sink node to the first of 100 consecutive auxiliary nodes with a coupling coefficient of C sink ;
[0050] S3, the number of sink values that the user input image converges to and the RGB values corresponding to each sink value;
[0051] S4. The user specifies the parameter B in the H matrix according to the specified sink value. h , C and the parameter C in the classical random walk sink , generally:
[0052] 1) Specify B h =1;
[0053] 2) For spatially adjacent waveguides, specify C = 1, and for non-adjacent waveguides, specify C = 0;
[0054] 3) C sink Represents the connection strength of the “jump” to the sink energy valley during the classic walking process. In this experiment, C sink =5, C sink is the coupling coefficient between the sink node and the first node among the corresponding 100 auxiliary nodes, as well as the coupling coefficient between any two adjacent nodes among the 100 auxiliary nodes;
[0055] S5, process the image pixel by pixel, encode the RGB value of each pixel, assuming that the number of sink values is n, and the generated length is 16 3 +n×100, the one-hot vector OH where the position corresponding to the original RGB encoding value of the pixel is 1 and the rest are 0;
[0056] S6. Set the following parameters:
[0057] S601. Specify the initial t = 0, walk_time = 10, k1 = 2, require_acc = 1e -7 , mb = min(n, 30), k1 = 2,;
[0058] S602. Since the amount of computation is too large, convert the H matrix into a sparse matrix and multiply it by -1j to obtain the complex matrix csc;
[0059] S603. anorm is the dot product of the modulus of csc and a vector with the same shape as OH and all values equal to 1;
[0060] S604. Anorm is the maximum value of the modulus of the vector anorm;
[0061] S605. beta = ||OH||
[0062] S606. m is the dimension of the Krylov subspace;
[0063] S607. xm = 1.0 / m;
[0064] S608. t_new = (1 / Anorm) × ((fact × require_acc) / (4 × beta × Anorm)) xm , where beta is the norm of the one - hot vector;
[0065] S609.
[0066] S610. mxrej = 10
[0067] S611. delta = 1.2
[0068] S612. ngamma = 0.9
[0069] S613.
[0070] S7. Execute the quantum walk iterative algorithm AL:
[0071] When t < walk_time, use the Krylov subspace method to simplify the algorithm. The specific method is as follows:
[0072] S701. Define t_step = minimum(walk_time - t, t_new);
[0073] S702. Initialize vs as a complex matrix of all zeros with size (m + 1) * n, and h as a complex matrix of all zeros with size (m + 2) * (m + 2);
[0074] S703. vs[0] = OH / beta;
[0075] S704. Enter inner loop 1: Initialize j = 0, and sequentially execute the following calculation process:
[0076] S7041. Introduce an intermediate variable p = csc * vs[j];
[0077] S7042. For i ∈ [0, j - 1], calculate ⊙p, p = p - h[i, j] * vs[i], where ⊙ is the dot product of vectors;
[0078] S7043. Calculate s = ||p||;
[0079] S7044. Judge whether s is less than require_acc. If so, sequentially execute: k1 = 0, mb = j, t_step = walk_time - t, and jump out of inner loop 1. If not, execute S7045;
[0080] S7045. Let h[j + 1, j] = s, vs[j + 1] = (1 / s) * p;
[0081] S7046. j = j + 1. If j < m, loop S7041 - S7045; otherwise, jump out of inner loop 1.
[0082] S705. Judge whether k1 is 0: If not, let h[m + 1, m] = 1, avnorm = ||csc * vs[m]||;
[0083] S706. ireject = 0;
[0084] S707. Enter inner loop 2: Sequentially execute the following process:
[0085] S7071. mx = mb + k1;
[0086] S7072. Let the matrix F = t_step * h[0:mx, 0:mx], and calculate its matrix exponential f = exp(F);
[0087] S7073. Judge whether k1 is 0. If so, let err_loc = require_acc and jump out of inner loop 2; if not, proceed to step S7074;
[0088] S7074. Let phi1 = |beta*f[m,0]| and phi2 = |beta*(f[m+1,0])*avnorm|. Check if phi1 > 10*phi2. If so, then err_loc = phi2 and xm = 1 / m. Otherwise, check if phi1 > phi2. If so, then err_loc = (phi1*phi2) / (phi1-phi2) and xm = 1 / m. Otherwise, execute err_loc = phi1 and xm = 1 / (m-1).
[0089] S7075. Check if err_loc <= delta*t_step*require_acc. If so, exit inner loop 2. Otherwise, execute step S7076.
[0090] S7076. Let mtmp=(t_step*require_acc / err_loc) xm ,t_step=ngamma*t_step*mtmp,
[0091] S7077. Check if ireject = mxrej. If so, exit the main program and report an error message: 'The Requested Accuracy is Too High!' Otherwise, proceed to S7078.
[0092] S7078, ireject = ireject + 1, if ireject <= mxrej, then continue to execute inner loop 2 steps S7071-S7077; otherwise, jump out of inner loop 2;
[0093] S708. Let mx=mb+maximum(0,k1-1), update OH=vs[0:mx]⊙(beta*f[0:mx,0]), beta=||OH||, t=t+t_step, t_new=ngamma*t_step*(t_step*require_acc / err_loc) xm , err_loc=maximum(err_loc,1e -8 );
[0094] S709: Determine whether t≥walk_time is satisfied. If so, end the program; otherwise, loop through steps S701-S709.
[0095] S8. After completing the quantum walk iterative algorithm AL, the sum of the probability value distributions within the intervals corresponding to different sink values is counted to obtain the sink value with the highest probability value corresponding to the initial input pixel value;
[0096] S9, obtain the convergence result i of each pixel in the image, and according to the mapping formula R=i / / (N 2 ), G=(i / / N)%N, B=i%N to obtain the RGB value corresponding to each pixel value after convergence, that is, to obtain the image after color gamut compression; where N is the compression ratio, which is 16.
[0097] The present invention also provides an image classification method based on a quantum random walk algorithm, the method comprising the following steps:
[0098] First, based on the specified sink value and H matrix parameters, the data set is batched using the color gamut compression method based on quantum random walk;
[0099] Secondly, the deep learning classification model is trained using the color gamut compressed dataset; the classification model is, for example, EfficientNet.
[0100] Finally, the trained network parameters are loaded and the test set after color gamut compression by the quantum random walk algorithm is inferred, that is, the target object category in the output image is obtained.
[0101] Example 1:
[0102] Image classification training module:
[0103] like Figure 2 As shown in the figure, Efficientnet is used as the classification model, and the dataset is a custom Mo9 dataset, which includes nine target objects: soldiers, military vehicles, tanks, submarines, warships, rifles, missiles, artillery, and fighter jets. During the model training phase, all categories of images in Mo9 that have undergone color gamut compression and grayscale processing are mixed together and divided into training set and validation set at a ratio of 10:1. The training set is used as the model input, cross_entropy is used as the loss function, and adaptive moment estimation (Adam) is used as the optimizer. The training classification accuracy reaches 99.8%.
[0104] Image classification reasoning module:
[0105] The image for inference is loaded into the software interface, and the socket server is used to convert the image into a byte stream and transmit it to the server. The server listens to and receives data, re-decodes and restores the original image, uses EfficientNet to infer the test set, outputs the predicted category of the target object in the image, transmits the classification result back to the client and displays it, and performs real-time statistics on the classification accuracy and the comparison between the predicted category and the actual category. The classification accuracy rate reaches 95%.
[0106] The advantages of the present invention compared with the prior art are:
[0107] The color gamut compression method used in the present invention is based on a quantum random walk algorithm, which has the advantage of highly parallel computing and greatly reduces the amount of calculation.
[0108] The color gamut compression method used in the present invention is used to process the training set, validation set and test set of the deep learning classification model. It can reduce the amount of calculation while retaining basic information and improve reasoning efficiency.
[0109] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An image classification method based on quantum random walk algorithm, characterized in that: The method comprises the following steps: First, based on the specified sink value and H matrix parameters, the data set is batched using the color gamut compression method based on quantum random walk; Secondly, the deep learning classification model is trained using the color gamut compressed dataset; Finally, the trained network parameters are loaded and reasoning is performed on the test set after color gamut compression by the quantum random walk algorithm, that is, the target object category in the output image is obtained. in, The color gamut compression method based on quantum random walk specifically includes the following steps: S1. Establish a color cube space based on the three dimensions of R, G, and B. In each dimension, the R, G, and B values are compressed to 16:1, that is, the R, G, and B values are divided by 16 and rounded up. 3 Colors compressed to 16 3 Colors S2, map the three-dimensional color cube space to the two-dimensional H matrix, that is, encode the RGB value of each color according to the formula B+16×(G+16×R), and encode the 16-dimensional color cube space into a two-dimensional H matrix. 3 The 3D cube is mapped to (16 3 ) 2 H matrix; S3, the number of sink values that the user input image converges to and the RGB values corresponding to each sink value; S4. The user specifies the parameter B in the H matrix according to the specified sink value. h , C and the parameter C in the classical random walk sink ; In the H matrix, the main diagonal parameter value B h is the propagation constant in the waveguide, C is the coupling coefficient between different waveguides, and C sink Represents the classic walking L ij The value of the item; S5, process the image pixel by pixel, encode the RGB value of each pixel, assuming that the number of sink values is n, and the generated length is 16 3 +n×100, the one-hot vector OH where the position corresponding to the original RGB encoding value of the pixel is 1 and the rest are 0; S6. Set algorithm parameters; S7, executing the quantum walk iterative algorithm AL; S8. After completing the quantum walk iterative algorithm AL, the sum of the probability value distributions within the intervals corresponding to different sink values is counted to obtain the sink value with the highest probability value corresponding to the initial input pixel value; S9, obtain the convergence result i of each pixel in the image, and according to the mapping formula R=i / / (N 2 ), G = (i / / N)%N, B = i%N to obtain the RGB value corresponding to each pixel value after convergence, that is, to obtain the image after color gamut compression; The quantum random walk process is simulated and described by the Lindblad equation: The Lindblad equation consists of two parts: quantum random walk and classical random walk, where ρ reflects the probability distribution of all nodes, and ω controls the ratio of quantum and classical random walks in the mixed random walk. The first term i on the right side of the equation represents the imaginary part of the complex plane, H is the Hamiltonian matrix, representing the quantum walk, and [H, ρ] represents the operator H acting on ρ. The remaining terms on the right side of the equation represent pure classical random walks, which can cause photons to "jump" directly to the energy valley sink, where L ij Corresponding to the connection from node i to node j, Indicates L ij The conjugate of does not need to be symmetrical with each other, that is, the Lindblad incoherence term is used to simulate the one-way edge. After a certain evolution time, quantum random walk obtains a stable probability distribution result.
2. The image classification method based on the quantum random walk algorithm according to claim 1, characterized in that: In the Hamilton matrix H, H ii =B h ,0≤i<16 3 ,0≤j<16 3 ① H ij =C,i≠j,b1+16×(g1+16×r1)==i,b2+16×(g2+16×r2)==j,r1==r2±1||g1==g2±1||b1==b2±1,0≤i<16 3 ,0≤j<16 3 ②, H ij =Csink,(i==sink&&j==16 3 )||(4096≤i<4596&&j==i+1)③, 3. The image classification method based on the quantum random walk algorithm according to claim 1 or 2, characterized in that: The step S2 specifically includes: S21. For each point on the main diagonal of the matrix, its coordinates (x, y) are RGB. The matrix and the corresponding point coordinates in the three-dimensional cube have the following relationship: B + 16 × (G + 16 × R) = x, x = y. S22, the coordinate value of a point on the off-diagonal line represents the coupling coefficient between the color values corresponding to the x and y coordinates of the point; S23. Assume that the user specifies n sinks. On this basis, add n×100 auxiliary nodes to the x and y direction lengths of the H matrix respectively, and associate each sink value to a set of 100 consecutive auxiliary nodes. The association method is to use the L in the classic walk. ij Implement a jump from the sink node to the first of 100 consecutive auxiliary nodes with a coupling coefficient of C sink .
4. The image classification method based on the quantum random walk algorithm according to claim 3, characterized in that: In step S4, specify B h =1; for spatially adjacent waveguides, specify C=1, and for non-adjacent waveguides, specify C=0; C sink Represents the connection strength of the "jump" to the sink energy valley during the classic walk, specified by C sink =5, C sink is the coupling coefficient between the sink node and the first node among the corresponding 100 auxiliary nodes, as well as the coupling coefficient between any two adjacent nodes among the 100 auxiliary nodes.
5. The image classification method based on quantum random walk algorithm according to claim 3, characterized in that: The step S6 specifically includes: S601. Specify initial t=0, walk_time=10, k1=2, require_acc=1e -7 , k1=2,mb= min(n,30); S602. Since the amount of computation is too large, the H matrix is converted into a sparse matrix and multiplied by -1j to obtain a complex matrix csc. S603, anorm is the vector with the same shape as the modular dot product of csc and OH and all values are 1; S604, Anorm is the maximum value of the modulus of the vector anorm; S605, beta=||OH|| S606, m=min(n,30); m is the dimension of the Krylov subspace; S607, xm=1.0 / m; S608, t_new=(1 / Anorm)×((fact×require_acc) / (4×beta×Anorm)) xm , beta is the norm of the one-hot vector; S609、 S610, mxrej = 10; S611, delta=1.2; S612, ngamma = 0.9; S613、 6. The image classification method based on the quantum random walk algorithm according to claim 5, characterized in that: The step S7 specifically includes: S701. Define t_step=minimum(walk_time-t, t_new); S702, initialize vs to an all-zero complex matrix (m+1)*n), and h to an all-zero complex matrix (m+2)*(m+2); S703, vs[0]=OH / beta; S704, enter inner loop 1: initialize j=0, and execute the following calculation process in sequence: S7041. Introduce an intermediate variable p=csc*vs[j]; S7042. For i∈[0,j-1], calculate p = ph[i,j]*vs[i], where ⊙ is the dot product of the vectors; S7043. Calculate s = ||p||; S7044. Determine whether s is less than require_acc. If so, execute the following steps in sequence: k1 = 0, mb = j, t_step = walk_time - t, and exit inner loop 1. If not, execute S7045. S7045. Let h[j+1,j]=s, vs[j+1]=(1 / s)*p; S7046. j = j + 1. If j < m, loop through S7041 - S7045; otherwise, break out of inner loop 1. S705. Determine if k1 is 0: If not, set h[m + 1, m] = 1, avnorm = ||csc * vs[m]||. S706. ireject = 0. S707. Enter inner loop 2: Execute the following steps in sequence: S7071. mx = mb + k1. S7072. Set matrix F = t_step * h[0:mx, 0:mx], and calculate its matrix exponential f = exp(F). S7073. Determine if k1 is 0. If so, set err_loc = require_acc and break out of inner loop 2; if not, proceed to step S7074. S7074. Set phi1 = |beta * f[m, 0]|, phi2 = |beta * (f[m + 1, 0]) * avnorm|. Determine if phi1 > 10 * phi2? If true, then err_loc = phi2, xm = 1 / m; otherwise, determine if phi1 > phi2? If true, then err_loc = (phi1 * phi2) / (phi1 - phi2), xm = 1 / m; otherwise, execute err_loc = phi1, xm = 1 / (m - 1). S7075. Determine if err_loc <= delta * t_step * require_acc? If true, break out of inner loop 2; otherwise, execute step S7076. Let mtmp = (t_step * require_acc / err_loc) xm , t_step = ngamma*t_step*mtmp, S7077. Determine if ireject = mxrej? If true, break out of the main program and prompt an error 'The Requested Accuracy is Too High!'; otherwise, enter S7078. S7078. ireject = ireject + 1. If ireject <= mxrej, continue to execute steps S7071 - S7077 of inner loop 2; otherwise, break out of inner loop 2. Let mx = mb + maximum(0, k1 - 1), update OH = vs[0:mx] ⊙ (beta * f[0:mx, 0]), beta = ||OH||, t = t + t_step, t_new = ngamma * t_step * (t_step * require_acc / err_loc) xm , err_loc = maximum(err_loc, 1e -8 ); S709. Determine if t ≥ walk_time is satisfied. If so, end the program; otherwise, loop through steps S701 - S709.
7. The image classification method based on the quantum random walk algorithm according to claim 6, characterized in that: In step S9 above, N is the compression ratio, with a value of 16.
8. The image classification method based on quantum random walk algorithm according to claim 1, characterized in that: The classification model is Efficientnet.
Citation Information
Patent Citations
Image classification method based on an observation matrix transformation dimension
CN109657707A
Quantum random walk error correction method based on multiple particles
CN115660096A