A pattern recognition method and apparatus
By preparing quantum states and performing inverse quantum Fourier transform and wavenumber calculation using quantum computing methods, the problem of low efficiency in pattern recognition in classical computing is solved, and efficient pattern recognition is achieved.
Patent Information
- Application Number
- CN202310790853.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2043-06-29
AI Technical Summary
Existing pattern recognition technologies are limited by the computing power of classical computing, resulting in low recognition efficiency.
Quantum computing methods are employed to prepare quantum states based on reference and target sequences. Pattern recognition is then performed using quantum superposition and entanglement, including measuring specified qubits, performing inverse quantum Fourier transform and calculating the target wavenumber. The recognition result is then obtained by combining these with a preset threshold.
It improves the efficiency of pattern recognition, reduces the time required for recognition, and achieves rapid recognition by utilizing the computing power of quantum computing.
Smart Images

Figure CN119227826B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of quantum computing technology, and in particular to a pattern recognition method and device. Background Technology
[0002] There exist objects that can be observed in time and space. If the same or similar object categories can be distinguished, the distinguishable objects are called patterns. A pattern is not a specific object, but an abstract category, which is information obtained from objects. Therefore, patterns often exhibit information with temporal and spatial distribution. Pattern recognition, on the other hand, classifies the patterns to be recognized into their respective pattern classes based on a certain quantitative measure or observation.
[0003] Pattern recognition can be applied in various fields, such as automated cytology, chromosome characteristic research, and genetic research in biology; image analysis of astronomical telescopes and automated spectroscopy in astronomy; stock trading prediction and corporate behavior analysis in economics; electrocardiogram analysis, electroencephalogram analysis, and medical image analysis in medicine; product defect detection, feature recognition, speech recognition, automatic navigation systems, and pollution analysis in engineering; aerial camera analysis, radar and sonar signal detection and classification, and automatic target recognition in the military; and fingerprint recognition, facial recognition, surveillance and alarm systems in security, etc.
[0004] Pattern recognition technology is a fundamental technology of artificial intelligence. The 21st century is an era of intelligence, informatization, computation, and networking. In this century characterized by digital computing, pattern recognition technology, as a foundational discipline of artificial intelligence, will undoubtedly gain tremendous development potential. However, with the development of pattern recognition technology, the amount of data to be processed is increasing, and the limited computing power of classical computing results in relatively low efficiency for pattern recognition. Summary of the Invention
[0005] The purpose of this invention is to provide a pattern recognition method and apparatus, aiming to improve the efficiency of pattern recognition.
[0006] One embodiment of this application provides a pattern recognition method, the method comprising:
[0007] A first quantum state is prepared based on the index of the reference sequence and the index of the target sequence, wherein the reference sequence represents the object to be identified, the target sequence represents the target object, and the target object includes objects of the same type as the object to be identified;
[0008] Measure the first quantum state on a specified qubit to obtain a first measurement result;
[0009] In response to the first measurement result being the target value, an inverse quantum Fourier transform is performed on the first quantum state to obtain the second quantum state;
[0010] Based on the second measurement result, the target wavenumber is obtained, wherein the second measurement result is the measurement result obtained by measuring the second quantum state on all qubits except the specified qubit;
[0011] Using the target wavenumber and a preset threshold, the identification results of the object to be identified and the target object are obtained.
[0012] Optionally, the preparation of the first quantum state based on the index of the reference sequence and the index of the target sequence includes:
[0013] Prepare a superposition state of the reference sequence number and the target sequence number;
[0014] The superposition state is obtained by using the Oracle module to evolve the quantum state containing the comparison result of the first value and the second value, and obtains a quantum state containing the target result as the first quantum state. The target result is the result of whether the first value and the second value are equal. The first value is the value in the sequence corresponding to the index in the reference sequence, and the second value is the value in the sequence corresponding to the index in the target sequence.
[0015] Optionally, the first quantum state is:
[0016]
[0017] Where |ψ1> represents the first quantum state, n is determined by the index of the reference sequence, m is determined by the index of the target sequence, i is the index of the reference sequence, j is the index of the target sequence, f(i) is the first value, f(j) is the second value, and if f(i)=f(j), y is 1, otherwise it is 0.
[0018] Optionally, the second measurement result includes a first sub-measurement result and a second sub-measurement result;
[0019] The target wavenumber includes a first wavenumber and a second wavenumber;
[0020] The process of obtaining the target wavenumber based on the second measurement result includes:
[0021] The first sub-measurement result and the second sub-measurement result were obtained respectively;
[0022] From all the first sub-measurement results, determine one first sub-measurement result, convert it to a decimal number, and use this decimal number as the first wave number;
[0023] From all the second sub-measurements, determine one second sub-measurement, convert it to a decimal number, and use that decimal number as the second wave number.
[0024] Optionally, obtaining the identification result of the object to be identified and the target object using the target wavenumber includes:
[0025] The pattern width is calculated using the first and second wave numbers;
[0026] Based on the relationship between the pattern width and the preset threshold, the recognition results of the object to be identified and the target object are obtained.
[0027] Optionally, the calculation of the mode width using the first wave number and the second wave number includes:
[0028] Based on the first and second wave numbers, the pattern width is calculated using the following formula:
[0029]
[0030]
[0031] Where D is the pattern width, k is the first wave number, and k ′ This is the second wave number. The integer is θ, where θ is the deviation angle, and N = 2. n =2 m =NM, κ is a value predetermined using the principle of multi-slit diffraction, χ is a preset mode ratio, n is determined by the index of the reference sequence, and m is determined by the index of the target sequence.
[0032] Optionally, obtaining the recognition result of the object to be identified and the target object based on the relationship between the pattern width and the preset threshold includes:
[0033] In response to the pattern width being greater than a preset threshold, the pattern center position is obtained based on the deviation angle;
[0034] Using the center position of the pattern, a module that matches the object to be identified is determined from the target object.
[0035] Optionally, the module for determining the matching object from the target object using the pattern center location includes:
[0036] Using the center position of the pattern, a region containing a module that matches the object to be identified is determined from the target object, and this region is taken as the target region;
[0037] The target region is segmented, and each segment is treated as a new target object, generating a new target sequence. The process then returns to the step of preparing the first quantum state based on the index of the reference sequence and the index of the target sequence, until a module matching the object to be identified is determined from the target objects.
[0038] The method further includes, optionally, determining the region containing the module that matches the object to be identified and the module that matches the object to be identified.
[0039] When the mode width is not greater than a preset threshold, a new target sequence is selected, and the process returns to the step of preparing the first quantum state based on the index of the reference sequence and the index of the target sequence.
[0040] Another embodiment of this application provides a pattern recognition device, the device comprising:
[0041] A preparation module is used to prepare a first quantum state based on the index of a reference sequence and the index of a target sequence, wherein the reference sequence represents an object to be identified, the target sequence represents a target object, and the target object includes objects of the same type as the object to be identified;
[0042] The first acquisition module is used to measure the first quantum state on a specified qubit and obtain a first measurement result;
[0043] The second acquisition module is used to perform an inverse quantum Fourier transform on the first quantum state in response to the first measurement result being a target value, to obtain a second quantum state;
[0044] The third acquisition module is used to obtain the target wavenumber based on the second measurement result, wherein the second measurement result is the measurement result obtained by measuring the second quantum state on all qubits except the specified qubit;
[0045] The fourth acquisition module is used to obtain the recognition result of the object to be identified and the target object by using the target wavenumber and the preset threshold.
[0046] One embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to implement the method described in any of the above-described embodiments when running.
[0047] One embodiment of this application provides a computer device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to implement the method described in any of the above-described embodiments.
[0048] Compared with existing technologies, this invention first prepares a first quantum state based on the index of a reference sequence and the index of a target sequence; then, it measures the first quantum state on a specified qubit to obtain a first measurement result; then, in response to the first measurement result being a target value, it performs an inverse quantum Fourier transform on the first quantum state to obtain a second quantum state; then, based on the second measurement result, it obtains a target wavenumber; finally, it uses the target wavenumber and a preset threshold to obtain the identification result between the object to be identified and the target object. Due to the superposition and entanglement of qubits, quantum computing has intrinsic parallelism. The computing power of quantum computing can quickly obtain the target wavenumber, and then use the target wavenumber and the preset threshold to obtain the identification result. By utilizing the computing power of quantum computing, the time required for identification is reduced, thereby improving the efficiency of identification. Attached Figure Description
[0049] Figure 1 This is a network block diagram of a pattern recognition system provided in an embodiment of the present invention;
[0050] Figure 2 A schematic flowchart of a pattern recognition method provided in an embodiment of the present invention;
[0051] Figure 3 A schematic diagram of a quantum circuit for pattern recognition provided in an embodiment of the present invention;
[0052] Figure 4 A schematic diagram of a dot matrix pattern provided in an embodiment of the present invention;
[0053] Figure 5 This is a schematic diagram of the structure of a pattern recognition device provided in an embodiment of the present invention;
[0054] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0055] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0056] Figure 1 This is a network block diagram of a pattern recognition system provided in an embodiment of the present invention. The pattern recognition system may include a network 110, a server 120, a wireless device 130, a client 140, a storage unit 150, a classical processing system 160, a quantum processing system 170, and may also include additional memory, a classical processor, a quantum processor, and other devices not shown.
[0057] Network 110 is a medium used to provide communication links between various devices and computers connected together within a pattern recognition system, including but not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The connection method can be wired, wireless communication links, or fiber optic cables.
[0058] Server 120 and client 140 are conventional data processing systems that may contain data and applications or software tools that perform conventional computational processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.
[0059] The classical processing system 160 (quantum processing system 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 163 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application program 162 (application program 173). The application program 162 (application program 173) may be used to implement a quantum algorithm compiled by the pattern recognition method provided in the embodiments of the present invention.
[0060] Any data or information stored or generated in the classical processing system 160 (quantum processing system 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0061] It should be noted that a true quantum computer has a hybrid structure, which includes at least... Figure 1 The system consists of two main parts: the classical processing system 160, which is responsible for performing classical calculations and control; and the quantum processing system 170, which is responsible for running quantum programs and thus realizing quantum computing.
[0062] The aforementioned classical processing system 160 and quantum processing system 170 can be integrated into a single device or distributed across two different devices. For example, the first device, including the classical processing system 160, runs a classical computer operating system that provides quantum application development tools and services, as well as the storage and network services required for quantum applications. Users develop quantum applications using the quantum application development tools and services on the second device and send the quantum program to the second device, including the quantum processing system 170, via the network services. The second device runs a quantum computer operating system, which parses the code of the quantum program and compiles it into instructions that can be recognized and executed by the quantum computer control system. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on these instructions.
[0063] In the classic silicon-based processing system 160, the units of the classic processor 161 are CMOS transistors. These computing units are not limited by time or coherence; that is, they are available at any time without time constraints. Furthermore, the number of these computing units in a silicon chip is sufficient; currently, a classic processor contains tens of thousands of computing units. The sufficient number of computing units and the fixed selectable computing logic of the CMOS transistors, such as AND logic, allow for computational efficiency through a combination of numerous CMOS transistors and limited logic functions.
[0064] Unlike the logic units in the classical processing system 160, the basic computational unit of the quantum processor 171 in the quantum processing system 170 is the qubit. The input of a qubit is limited by coherence and coherence time; that is, a qubit is limited by its available usage time and is not always readily available. Making full use of qubits within their available usage time is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is one of the representative indicators of its performance. Each qubit performs computational functions through on-demand configured logic functions. Given the limited number of qubits and the diverse logic functions available in quantum computing, such as Hadamard gates (H gates), Pauli-X gates (X gates), Pauli-Y gates (Y gates), Pauli-Z gates (Z gates), X gates, RY gates, RZ gates, CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc., quantum computing requires combining a limited number of qubits with diverse combinations of logic functions to achieve computational effects.
[0065] Based on these differences, the design of logical functions applied to qubits (including the design of whether qubits are used and the design of the efficiency of each qubit's use) is crucial to improving the computational performance of quantum computers and requires specialized design. The aforementioned design considerations for qubits are technical problems that ordinary computing devices do not need to address. Therefore, this invention proposes a pattern recognition method and apparatus to improve the efficiency of pattern recognition in quantum computing.
[0066] See Figure 2 , Figure 2 A flowchart illustrating a pattern recognition method provided in an embodiment of the present invention may include the following steps:
[0067] S201: Based on the index of the reference sequence and the index of the target sequence, prepare a first quantum state, wherein the reference sequence represents the object to be identified, the target sequence represents the target object, and the target object includes objects of the same type as the object to be identified.
[0068] In pattern recognition, the object to be identified may differ across different fields. For example, in fingerprint recognition, the object to be identified could be a fingerprint; in vehicle recognition, it could be a vehicle; and in product defect detection, it could be a defect, and so on. The object to be identified can be presented in different forms in different application scenarios. Specifically, it can be presented as an image, as text, or in any other form that can represent the object.
[0069] The object to be identified is processed by converting it into string data, which serves as the reference sequence. Specifically, taking an image as the object to be identified as an example, the image is processed to a certain resolution through cropping, segmentation, and other methods. Then, using information such as color and brightness, each pixel is assigned a character, thus processing the image into a string format.
[0070] The target sequence can be obtained by processing the target object using the same methods as the object to be identified. The target sequence can be pre-processed and stored in a database or other location accessible to pattern recognition systems. The reference sequence number and the target sequence number are numbered in the same way; specifically, each bit of the sequence is numbered, and the numbering can be in binary form. For example, if the reference sequence is 1001, then the reference sequence numbers are 00, 01, 10, 11; if the target sequence is 11100100, then the target sequence numbers are 000, 001, 010, 011, 100, 101, 110, 111. Quantum state encoding is performed on the reference sequence numbers and the target sequence numbers. Further processing of the quantum states obtained from this quantum state encoding yields the first quantum state. The first quantum state represents the object to be identified and the target object, containing information about the sequence number of the reference sequence and the sequence number of the target sequence, as well as information about the values in the sequences corresponding to the sequence numbers of the reference sequence and the target sequence. In this embodiment of the invention, the first quantum state is prepared using a quantum device. The quantum device can be a quantum computer, a quantum virtual machine, or other devices capable of implementing or simulating quantum computing. After obtaining the reference sequence and the target sequence, the quantum device can determine the number of qubits required to prepare the first quantum state based on the sequence length. Then, a quantum circuit can be generated using qubits and quantum logic gates, and the first quantum state is prepared using the quantum circuit. The function of one quantum logic gate can be equivalent to the function of other quantum logic gates or combinations of quantum logic gates. There are many possible relationships between quantum logic gates and qubits. Therefore, in this embodiment of the invention, as long as the aforementioned first quantum state can be prepared, the specific preparation method is not limited.
[0071] In this embodiment of the invention, for two sequences of length N and M, only O(logX+logM) quantum space is required for storage, which is an exponential saving in storage space compared to classical computation.
[0072] S202: Measure the first quantum state on the specified qubit to obtain the first measurement result.
[0073] A designated qubit is one or more of the qubits required to prepare the first quantum state, and can be predetermined.
[0074] S203: In response to the first measurement result being the target value, perform an inverse quantum Fourier transform on the first quantum state to obtain a second quantum state.
[0075] The target value is a pre-set numerical value; for example, the target value can be 1. After obtaining the first measurement result, it is determined whether the first measurement result is the target value. If the first measurement result is the target value, then the first quantum state is the quantum state required for pattern recognition, and the next step of processing can proceed. Specifically, QFT is used. -1 (Inverse quantum Fourier transform) transforms the first quantum state into the second quantum state.
[0076] S204: Based on the second measurement result, obtain the target wavenumber, wherein the second measurement result is the measurement result obtained by measuring the second quantum state on all qubits except the specified qubit.
[0077] There can be multiple second measurement results; multiple measurements can yield multiple second measurement results. Processing these second measurement results can yield wavenumbers. Specifically, one approach is to select a measurement result from the second measurement results, perform a base conversion on that result, and obtain the wavenumber. The selection method can be set according to different needs. Alternatively, the second measurement results can be calculated. One method is to convert the second measurement result to a decimal number, perform a weighted average on the converted decimal numbers, and use the weighted average as the target wavenumber.
[0078] S205: Using the target wavenumber and the preset threshold, obtain the identification result of the object to be identified and the target object.
[0079] In this embodiment of the invention, the target wavenumber can be further processed. Specifically, the relationship between the wavenumber and a preset threshold can be used to determine the recognition result. Alternatively, based on the principle of multi-slit diffraction, the target wavenumber and the preset threshold can be used to determine whether there is a region in the target object that is similar to the object to be identified, thereby determining the recognition result. Of course, the target wavenumber can also be further calculated, and the relationship between the calculation result and the preset threshold can be used to obtain the recognition result. Recognition can be based on a mismatch between the object to be identified and the target object (i.e., the object to be identified is not the same as or is not similar to the target object), a match between the object to be identified and the target object, or the classification label of the object to be identified being the same as the classification label of the target object, content matching between the object to be identified and the target object, or the similarity between the object to be identified and the target object, etc.
[0080] In this embodiment of the invention, pattern recognition is performed using quantum superposition and quantum Fourier transform, with a time complexity of O(logN). Pattern recognition using classical computation has a time complexity of O(N+NlogN) or O(M+M logM). Therefore, by using this embodiment of the invention, the time complexity of pattern recognition can be reduced, thereby improving recognition efficiency.
[0081] As can be seen, this invention first prepares a first quantum state based on the index of the reference sequence and the index of the target sequence; then, it measures the first quantum state on a specified qubit to obtain a first measurement result; then, in response to the first measurement result being the target value, it performs an inverse quantum Fourier transform on the first quantum state to obtain a second quantum state; then, based on the second measurement result, it obtains the target wavenumber; finally, it uses the target wavenumber and a preset threshold to obtain the identification result between the object to be identified and the target object. Due to the superposition and entanglement of qubits, quantum computing has intrinsic parallelism. The computing power of quantum computing can quickly obtain the target wavenumber, and then use the target wavenumber and the preset threshold to obtain the identification result. By utilizing the computing power of quantum computing, the time required for identification is reduced, thereby improving the efficiency of identification.
[0082] In some possible embodiments of the present invention, the method may further include:
[0083] If the first measurement result is not the target value, the first quantum state is re-prepared.
[0084] If the first measurement result is not the target value, it means that the first quantum state is not the quantum state required to realize quantum pattern recognition. Therefore, the first quantum state needs to be re-prepared until the first measurement result is the target value.
[0085] In some possible embodiments of the present invention, the preparation of the first quantum state based on the index of the reference sequence and the index of the target sequence includes:
[0086] Prepare a superposition state of the reference sequence number and the target sequence number;
[0087] Using the Oracle module, the superposition state is evolved to obtain a quantum state containing the target result, which is taken as the first quantum state. The target result is the result of whether the first value and the second value are equal. The first value is the value in the sequence corresponding to the index in the reference sequence, and the second value is the value in the sequence corresponding to the index in the target sequence.
[0088] In embodiments of the present invention, the quantum circuit for pattern recognition can be as follows: Figure 3 As shown, q v To specify a qubit, k = n + m, the index of the reference sequence is encoded into the first n qubits of the k qubits, and the index of the target sequence is encoded into the last m qubits of the k qubits; alternatively, the index of the target sequence is encoded into the first m qubits of the k qubits, and the index of the reference sequence is encoded into the last n qubits of the k qubits, thus obtaining a superposition state. Specifically, the superposition state can be implemented using an H-gate, and the superposition state can be represented as |ψ>|0>=H n+m |0> n+m+1The Oracle module is primarily used to obtain the first and second values, compare them, and evolve the superposition state so that the first quantum state contains the quantum state corresponding to the comparison of whether the first and second values are equal. Continuing the example above, the target result can be shown in the table below. Rows represent the reference sequence numbers, columns represent the target sequence numbers (rows and columns can be interchanged), and the values in parentheses correspond to the sequence numbers. If the first value equals the second value, the target result is 1; otherwise, it is 0.
[0089] 000(1) 001(1) 010(1) 011(0) 100(0) 101(1) 110(0) 111(0) 00(1) 1 1 1 0 0 1 0 0 01(0) 0 0 0 1 1 0 1 1 10(0) 0 0 0 1 1 0 1 1 11(1) 1 1 1 0 0 1 0 0
[0090] In pattern recognition, it is necessary to identify similar modules between two sequences. This can be determined using the following principles:
[0091] With 2 n The value is on the horizontal axis, 2 m The value is on the vertical axis, or in terms of 2 m The value is on the horizontal axis, 2 n The vertical axis represents the value of a specified bit. If the measurement result of the specified bit is 1, the corresponding point is black; if it is 0, the corresponding point is white, thus forming a plot like this. Figure 4 The diagram shown can be called a raster diagram. If two sequences have similar modules, the corresponding positions will form a diagonal shape. This diagonal shape has obvious periodicity, so its frequency can be obtained through Fourier transform. Then, QFT is used... -1 The frequency is converted, the converted result is measured, and the measured result is processed to obtain the wavenumber. Based on the wavenumber, the identification result of the two sequences is finally obtained.
[0092] In some possible embodiments of the present invention, the first quantum state can be:
[0093]
[0094] Wherein, |ψ1> is the first quantum state, n is determined by the index of the reference sequence, m is determined by the index of the target sequence, i is the index of the reference sequence, j is the index of the target sequence, f(i) is the first value, f(j) is the second value, if f(i) = f(j), y is 1, otherwise it is 0.
[0095] When the first measurement result is the target value, the first quantum state on all qubits except the specified qubit can be represented as |ψ2>=∑ i,j,f(i,j)=1 |i>|>, continuing the example above, |ψ2>=|00,000>+|11,000>+|00,001>+….
[0096] In some possible embodiments of the present invention, the second measurement result includes a first sub-measurement result and a second sub-measurement result;
[0097] The target wavenumber includes a first wavenumber and a second wavenumber;
[0098] The process of obtaining the target wavenumber based on the second measurement result includes:
[0099] The first sub-measurement result and the second sub-measurement result were obtained respectively;
[0100] From all the first sub-measurement results, determine one first sub-measurement result, convert it to a decimal number, and use this decimal number as the first wave number;
[0101] From all the second sub-measurements, determine one second sub-measurement, convert it to a decimal number, and use that decimal number as the second wave number.
[0102] The number of measurements can be predetermined, or measurement can stop when a measurement result with a probability greater than a preset value is obtained, or when the probability of several consecutive measurement results is within a preset range. Of course, other conditions can also be set to determine whether to stop measurement, which will not be listed here. The above criteria can be used to determine whether to stop measurement based on the first and second sub-measurement results. Both the first and second sub-measurement results can be... Figure 3 In the quantum circuit shown, q0- k-1 The measurements obtained are as follows: the first sub-measurement result measures the index of the first n qubits encoding the reference sequence and the index of the last m qubits encoding the target sequence; the second sub-measurement result measures the index of the first m qubits encoding the target sequence and the index of the last n qubits encoding the reference sequence.
[0103] After the first sub-measurement result is stopped, the measurement result with the highest probability or a sufficiently high probability is selected from the obtained first sub-measurement results. The selected measurement result is converted into a decimal number, which is the first wave number. The probability of being sufficiently high is determined according to a preset rule; for example, a probability greater than a preset probability value is considered sufficiently high. The second sub-measurement result is processed in the same way to obtain the second wave number.
[0104] In some possible embodiments of the present invention, obtaining the identification result of the object to be identified and the target object using the target wavenumber and a preset threshold includes:
[0105] The pattern width is calculated using the first and second wave numbers;
[0106] Based on the relationship between the pattern width and the preset threshold, the recognition results of the object to be identified and the target object are obtained.
[0107] After obtaining the first and second wave numbers, the pattern width can be calculated using the relationship between the wave number and the pattern width. The pattern width and a preset threshold are then compared, and the recognition result is determined based on this comparison.
[0108] In some possible embodiments of the present invention, calculating the mode width using the target wavenumber and a preset threshold may include:
[0109] Based on the first and second wave numbers, the pattern width is calculated using the following formula:
[0110]
[0111]
[0112] Where D is the pattern width, k is the first wave number, and k′ is the second wave number. The integer is θ, where θ is the deviation angle, and N = 2. n M = 2 m S = NM κ is a value predetermined using the principle of multi-slit diffraction, χ is a preset mode ratio, n is determined by the index of the reference sequence, and m is determined by the index of the target sequence.
[0113] L is the Laue function, whose parameters are all derived from X-ray crystal diffraction experiments. Since X-ray crystal diffraction is essentially a Fourier transform, it can be directly calculated using the principles of X-ray diffraction. κ is a pre-determined value using the principle of multi-slit diffraction; κ is similar to the "number of slits" in multi-slit diffraction, and θ is similar to the phase difference in multi-slit diffraction. In quantum computing, k can be a scale-related physical quantity, and θ can be a phase-related physical quantity. However, κ does not directly represent the number of qubits, and θ does not directly represent the quantum phase difference.
[0114] The unknowns in the two equations above are D and θ. Since the equations are derived using the principle of multi-slit diffraction, and the waveforms obtained by multi-slit diffraction are similar, different... The calculated D and θ are not significantly different. In this embodiment of the invention, one of them can be used. The calculated D and θ are used as the results.
[0115] In some possible embodiments of the present invention, obtaining the recognition result of the object to be identified and the target object based on the relationship between the pattern width and the preset threshold includes:
[0116] In response to the pattern width being greater than a preset threshold, the pattern center position is obtained;
[0117] Using the center position of the pattern, a module that matches the object to be identified is determined from the target object.
[0118] When the width of a pattern exceeds a preset threshold, it indicates that the position corresponding to that point is a periodic diagonal line on the dot matrix, meaning that the target object contains a module similar to the object to be identified. Utilizing... Determine the center position z of the pattern, where z0 is the set starting position. Based on this center position, determine whether there is a module in the target object that matches the object to be identified.
[0119] In some possible embodiments of the present invention, the module for determining the object to be identified from the target object using the pattern center position includes:
[0120] Using the center position of the pattern, a region containing a module that matches the object to be identified is determined from the target object, and this region is taken as the target region;
[0121] The target region is segmented, and each segment is treated as a new target object, generating a new target sequence. The process then returns to the step of preparing the first quantum state based on the index of the reference sequence and the index of the target sequence, until a module matching the object to be identified is determined from the target objects.
[0122] By utilizing the pattern center location, a region containing a module matching the object to be identified is determined from the current target object. This region is then segmented into blocks, and each block is used as a new target object. These target objects are processed to obtain a target sequence, which is then used for pattern recognition until a module matching the object to be identified is found. Specifically, the formula for calculating the pattern center location is... Different values result in a series of diagonal lines appearing in the target object. The area occupied by these diagonal lines contains modules that match the object to be identified, and this is the target region. For example, the area occupied by the diagonal lines is the lower right corner of the target object; therefore, the lower right corner of the target object is the target region. The target region is segmented, and the segmented content is processed using the same method as the object to be identified to obtain a new target sequence. Then, pattern recognition is performed until a module that matches the object to be identified is determined. For example, if a vehicle violates traffic rules by obscuring its license plate, and a penalty is imposed, the license plate information needs to be obtained. In this case, the violating vehicle is taken as the object to be identified, and the images of vehicles captured by the road traffic system monitoring system are taken as the target object. Now, it is necessary to find positions in the target sequence that have highly similar features to the reference sequence (i.e., modules that match the object to be identified), thereby finding vehicles identical to the identified vehicle in the database, and thus obtaining the license plate number of the violating vehicle.
[0123] In some possible embodiments of the present invention, the method may further include:
[0124] When the mode width is not greater than a preset threshold, a new target sequence is selected, and the process returns to the step of preparing the first quantum state based on the index of the reference sequence and the index of the target sequence.
[0125] In the actual recognition process, there may be many target sequences. When the pattern width is not greater than the preset threshold, it means that there is no module in the target object that matches the object to be identified. At this time, a target sequence that has not participated in the pattern recognition of the object to be identified is selected from the database as a new target sequence, and then a new round of pattern recognition is performed.
[0126] See Figure 5 , Figure 5 This is a schematic diagram of the structure of a pattern recognition device provided in an embodiment of the present invention. Figure 2 Corresponding to the process shown, the apparatus includes:
[0127] Preparation module 501 is used to prepare a first quantum state based on the index of a reference sequence and the index of a target sequence, wherein the reference sequence represents an object to be identified, the target sequence represents a target object, and the target object includes objects of the same type as the object to be identified;
[0128] The first acquisition module 502 is used to measure the first quantum state on a specified qubit and obtain a first measurement result;
[0129] The second obtaining module 503 is used to perform an inverse quantum Fourier transform on the first quantum state in response to the first measurement result being a target value, to obtain a second quantum state;
[0130] The third obtaining module 504 is used to obtain the target wavenumber based on the second measurement result, wherein the second measurement result is the measurement result obtained by measuring the second quantum state on all qubits except the specified qubit;
[0131] The fourth acquisition module 505 is used to obtain the recognition result of the object to be identified and the target object by using the target wavenumber and the preset threshold.
[0132] In some possible embodiments of the present invention, the preparation module 501 may also be used for:
[0133] If the first measurement result is not the target value, the first quantum state is re-prepared.
[0134] In some possible embodiments of the present invention, the preparation module 501 may be specifically used for:
[0135] Prepare a superposition state of the reference sequence number and the target sequence number;
[0136] Using the Oracle module, the superposition state is evolved to obtain a quantum state containing the target result, which is taken as the first quantum state. The target result is the result of whether the first value and the second value are equal. The first value is the value in the sequence corresponding to the index in the reference sequence, and the second value is the value in the sequence corresponding to the index in the target sequence.
[0137] In some possible embodiments of the present invention, the first quantum state can be:
[0138]
[0139] Wherein, |ψ1> is the first quantum state, n is determined by the index of the reference sequence, m is determined by the index of the target sequence, i is the index of the reference sequence, j is the index of the target sequence, f(i) is the first value, f(j) is the second value, if f(i) = f(j), y is 1, otherwise it is 0.
[0140] In some possible embodiments of the present invention, the second measurement result may include a first sub-measurement result and a second sub-measurement result;
[0141] The target wavenumber may include a first wavenumber and a second wavenumber;
[0142] The third obtaining module 504 can be specifically used for:
[0143] The first sub-measurement result and the second sub-measurement result were obtained respectively;
[0144] From all the first sub-measurement results, determine one first sub-measurement result, convert it to a decimal number, and use this decimal number as the first wave number;
[0145] From all the second sub-measurements, determine one second sub-measurement, convert it to a decimal number, and use that decimal number as the second wave number.
[0146] In some possible embodiments of the present invention, the fourth obtaining module 505 may include:
[0147] The calculation unit is used to calculate the mode width using the first wave number and the second wave number;
[0148] The obtaining unit is used to obtain the recognition result of the object to be identified and the target object based on the relationship between the pattern width and the preset threshold.
[0149] In some possible embodiments of the present invention, the computing unit may be specifically used for:
[0150] Based on the first and second wave numbers, the pattern width is calculated using the following formula:
[0151]
[0152]
[0153] Where D is the pattern width, k is the first wave number, and k ′ This is the second wave number. The integer is θ, where θ is the deviation angle, and N = 2. n =2 m =NM, κ is a value predetermined using the principle of multi-slit diffraction, χ is a preset mode ratio, n is determined by the index of the reference sequence, and m is determined by the index of the target sequence.
[0154] In some possible embodiments of the present invention, the obtaining unit may be specifically used for:
[0155] In response to the pattern width being greater than a preset threshold, the pattern center position is obtained based on the deviation angle;
[0156] Using the center position of the pattern, a module that matches the object to be identified is determined from the target object.
[0157] In some possible embodiments of the present invention, the obtaining unit may also be specifically used for:
[0158] Using the center position of the pattern, a region containing a module that matches the object to be identified is determined from the target object, and this region is taken as the target region;
[0159] The target region is segmented, and each segment is used as a new target object to generate a new target sequence. The process is then repeated until a module matching the target object is determined from the target objects.
[0160] In some possible embodiments of the present invention, the apparatus may further include:
[0161] The selection module is used to select a new target sequence when the pattern width is not greater than a preset threshold, and then return to the preparation module 501.
[0162] As can be seen, this invention first prepares a first quantum state based on the index of the reference sequence and the index of the target sequence; then, it measures the first quantum state on a specified qubit to obtain a first measurement result; then, in response to the first measurement result being the target value, it performs an inverse quantum Fourier transform on the first quantum state to obtain a second quantum state; then, based on the second measurement result, it obtains the target wavenumber; finally, it uses the target wavenumber and a preset threshold to obtain the identification result between the object to be identified and the target object. Due to the superposition and entanglement of qubits, quantum computing has intrinsic parallelism. The computing power of quantum computing can quickly obtain the target wavenumber, and then use the target wavenumber and the preset threshold to obtain the identification result. By utilizing the computing power of quantum computing, the time required for identification is reduced, thereby improving the efficiency of identification.
[0163] Please see Figure 6 This application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the pattern recognition method described in any of the above embodiments. See also... Figure 6 The computer device can be a classical computer or a quantum computer.
[0164] This application also provides a storage medium storing a computer program, wherein the computer program is configured to implement the pattern recognition method described in any of the above embodiments when running.
[0165] This application also provides a computer program product containing instructions that, when executed by a computer, cause the computer to implement the pattern recognition method described in any of the above embodiments.
[0166] It is understood that the various implementation methods described in this application can be implemented individually or in combination, and the implementation methods in this application are not limited in this respect.
[0167] Unless otherwise stated, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this application includes any and all combinations of one or more of the associated listed items. The singular forms "a," "the," and "the" as used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0168] It is understood that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0169] It is understood that the memory in the embodiments of this application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Specifically, non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM). It should be noted that the memory in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0170] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0171] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the aforementioned method implementations, and will not be repeated here.
[0172] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0173] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
Claims
1. A pattern recognition method, characterized in that, The method includes: Prepare a superposition state of the reference sequence number and the target sequence number, wherein the reference sequence represents the object to be identified, the target sequence represents the target object, and the target object includes objects of the same type as the object to be identified; Using the Oracle module, the superposition state is evolved to obtain a quantum state containing a target result, a first value, and a second value, which is taken as the first quantum state. The first value is the value in the sequence corresponding to the index in the reference sequence, and the second value is the value in the sequence corresponding to the index in the target sequence. The target result is the result of whether the first value and the second value are equal. Measure the first quantum state on a specified qubit to obtain a first measurement result; In response to the first measurement result being the target value, an inverse quantum Fourier transform is performed on the first quantum state to obtain the second quantum state; Based on the second measurement result, the target wavenumber is obtained, wherein the second measurement result is the measurement result obtained by measuring the second quantum state on all qubits except the specified qubit; Using the target wavenumber and a preset threshold, the identification results of the object to be identified and the target object are obtained.
2. The method according to claim 1, characterized in that, The first quantum state is: in, This is the first quantum state. Determined by the index of the reference sequence, Determined by the sequence number of the target sequence. The reference sequence number is [number]. The sequence number is the index of the target sequence. For the first value, If the second value is taken, , It is 1 if it is true, otherwise it is 0.
3. The method according to claim 1 or 2, characterized in that, The second measurement result includes the first sub-measurement result and the second sub-measurement result; The target wavenumber includes a first wavenumber and a second wavenumber; The process of obtaining the target wavenumber based on the second measurement result includes: The first sub-measurement result and the second sub-measurement result were obtained respectively; From all the first sub-measurement results, determine one first sub-measurement result, convert it to a decimal number, and use this decimal number as the first wave number; From all the second sub-measurements, determine one second sub-measurement, convert it to a decimal number, and use that decimal number as the second wave number.
4. The method according to claim 3, characterized in that, The step of obtaining the identification result of the object to be identified and the target object by using the target wavenumber and a preset threshold includes: The pattern width is calculated using the first and second wave numbers; Based on the relationship between the pattern width and the preset threshold, the recognition results of the object to be identified and the target object are obtained.
5. The method according to claim 4, characterized in that, The calculation of the mode width using the first wave number and the second wave number includes: Based on the first and second wave numbers, the pattern width is calculated using the following formula: in, For pattern width, For the first wave number, This is the second wave number. It is an integer. For the deviation angle, , To determine the value in advance using the principle of multi-slit diffraction, The percentage of the preset pattern. Determined by the index of the reference sequence, It is determined by the sequence number of the target sequence.
6. The method according to claim 5, characterized in that, The process of obtaining the recognition result of the object to be identified and the target object based on the relationship between the pattern width and the preset threshold includes: In response to the pattern width being greater than a preset threshold, the pattern center position is obtained based on the deviation angle; Using the center position of the pattern, a module that matches the object to be identified is determined from the target object.
7. The method according to claim 6, characterized in that, The module that uses the center position of the pattern to determine the object matching the target object from the target object includes: Using the center position of the pattern, a region containing a module that matches the object to be identified is determined from the target object, and this region is taken as the target region; The target region is segmented, and each segment is treated as a new target object, generating a new target sequence. The process then returns to the step of preparing the first quantum state based on the index of the reference sequence and the index of the target sequence, until a module matching the object to be identified is determined from the target objects.
8. The method according to claim 4, characterized in that, The method further includes: When the mode width is not greater than a preset threshold, a new target sequence is selected, and the process returns to the step of preparing the first quantum state based on the index of the reference sequence and the index of the target sequence.
9. A pattern recognition device, characterized in that, The device includes: The preparation module is used to prepare a superposition state of the indices of the reference sequence and the target sequence. Using the Oracle module, the superposition state is evolved to obtain a quantum state containing the target result, a first value, and a second value, which serves as the first quantum state. The reference sequence represents the object to be identified, and the target sequence represents the target object. The target object includes objects of the same type as the object to be identified. The first value is the value in the sequence corresponding to the indices of the reference sequence, and the second value is the value in the sequence corresponding to the indices of the target sequence. The target result is the result of whether the first value and the second value are equal. The first acquisition module is used to measure the first quantum state on a specified qubit and obtain a first measurement result; The second acquisition module is used to perform an inverse quantum Fourier transform on the first quantum state in response to the first measurement result being a target value, to obtain a second quantum state; The third acquisition module is used to obtain the target wavenumber based on the second measurement result, wherein the second measurement result is the measurement result obtained by measuring the second quantum state on all qubits except the specified qubit; The fourth acquisition module is used to obtain the recognition result of the object to be identified and the target object by using the target wavenumber and the preset threshold.
10. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to implement the method described in any one of claims 1 to 8 when it is run.
11. A computer device, comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to implement the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Identification method, system and device based on quantum network and storage medium
CN114169469A
Soft quantum neural network system and pattern recognition method
CN114519430A