Image recognition method and system based on photon differentiable logic gate network model, terminal and storage medium
Optical logic gates are trained through a photonic differentiable logic gate network model, which solves the problem of lack of trainability of optical logic gates, achieves efficient image recognition and classification, reduces energy consumption and improves computing efficiency.
Patent Information
- Application Number
- CN202511137916.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-08-14
AI Technical Summary
Existing optical logic gates lack trainability, which makes it difficult for neural networks to efficiently recognize images and adapt to the dynamic parameter optimization requirements of deep learning.
A photon differentiable logic gate network model is adopted to obtain the grayscale matrix data of the input image, perform optical power signal conversion and optical calculation processing, and use multiple logic gate processing units of the photon differentiable logic gate network to represent and classify image features to achieve image recognition.
It realizes optical calculation and precise classification and recognition of image features, reduces energy consumption and improves computing efficiency, and adapts to the dynamic parameter optimization needs of deep learning.
Smart Images

Figure CN120635915A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image recognition method, system, terminal and computer-readable storage medium based on a photon differentiable logic gate network model. Background Art
[0002] In recent years, the rapid development of artificial intelligence and big data technologies has promoted the widespread application of neural network models in fields such as computer vision and natural language processing. The demand for efficient computing capabilities is becoming increasingly urgent. However, traditional electronic computing faces the problems of transistor size approaching the atomic level, the slowdown of Moore's Law, the difficulty in breaking through the energy efficiency and speed of electronic chips, and the defects of the von Neumann architecture. The separation of storage and computing leads to a "memory wall" and a "power consumption wall", and data transmission energy consumption accounts for more than 60% of the total system energy consumption.
[0003] However, existing optical logic gates are mostly based on fixed-function designs, lacking programmability and trainability, and are difficult to directly adapt to the dynamic parameter optimization requirements of deep learning. Although the introduction of Differentiable Logic Gate Networks provides a theoretical breakthrough for embedding discrete logic operations into the gradient descent framework, its electronic implementation is still limited by the physical limitations of traditional hardware. If neural networks directly use optical logic gates, existing neural networks will find it difficult to achieve high-speed, low-energy computational recognition of images, which has become a problem that needs to be solved urgently.
[0004] Therefore, the existing technology still needs to be improved and developed. Summary of the Invention
[0005] The main purpose of the present invention is to provide an image recognition method, system, terminal and computer-readable storage medium based on a photon differentiable logic gate network model, aiming to solve the problem in the prior art that when neural networks use optical logic gates, the existing optical logic gates lack trainability, resulting in the inability of neural networks to train the optical logic gates and thus the inability to efficiently recognize images.
[0006] To achieve the above object, the present invention provides an image recognition method based on a photon differentiable logic gate network model, the image recognition method based on the photon differentiable logic gate network model comprising the following steps: Obtaining grayscale matrix data of an input image, and converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; Inputting the optical power signal into a photon differentiable logic gate network model, performing optical calculation processing on the optical power signal through multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and converting the optical power signal matrix to obtain an image feature representation map; The image feature representation graph is classified to obtain a plurality of classification features, and all the classification features are identified according to a preset classification rule to obtain an image recognition result.
[0007] Optionally, in the image recognition method based on the photon differentiable logic gate network model, the preset optical power mapping rule includes a threshold power rule; The step of acquiring grayscale matrix data of an input image and converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal specifically includes: Obtaining a data set and grayscale values of an input image, encoding the data set according to the grayscale values to obtain grayscale matrix data; The grayscale matrix data is mapped according to the threshold power rule to obtain a plurality of optical power values, and all the optical power values are divided in sequence according to preset intervals to obtain an optical power signal.
[0008] Optionally, the image recognition method based on the photon differentiable logic gate network model, wherein the optical power signal is input into the photon differentiable logic gate network model, the optical power signal is optically calculated and processed by multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram, specifically including: Inputting the optical power signal into a photon differentiable logic gate network model, and performing a logic operation on the optical power signal through basic photon logic gates of a plurality of logic gate processing units of the photon differentiable logic gate network model based on a spatial cross-phase modulation method to obtain a plurality of diffraction information; All the diffraction information is optically calculated and processed by a plurality of logic gate processing units to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram.
[0009] Optionally, the image recognition method based on the photon differentiable logic gate network model, wherein the optical power signal is input into the photon differentiable logic gate network model, and based on the spatial cross-phase modulation method, the basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model perform a logical operation on the optical power signal to obtain multiple diffraction information, specifically includes: Inputting the optical power signal into the photonic differentiable logic gate network model, modulating the optical power signal based on a spatial cross-phase modulation method to obtain a target optical power signal; Performing logic operations on the target optical power signal through basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information; The logic operation includes any one of an AND gate operation, an OR gate operation, a NAND gate operation, a NOR gate operation, an XOR gate operation, an XNOR gate operation, and a NOT gate operation.
[0010] Optionally, the image recognition method based on the photon differentiable logic gate network model, wherein the optical calculation processing of all the diffraction information by multiple logic gate processing units to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram, specifically includes: Performing optical calculation processing on all the diffraction information by using a plurality of the logic gate processing units to obtain first optical power data; Training the first optical power data through a plurality of the logic gate processing units to obtain second optical power data; Eliminating target position data of the second optical power data to obtain a plurality of matrix data, arranging all the matrix data to obtain an optical power signal matrix, and transforming the optical power signal matrix to obtain an image feature representation diagram; The diffraction information includes diffraction spots and diffraction rings.
[0011] Optionally, the image recognition method based on the photon differentiable logic gate network model, wherein the image feature representation graph is classified to obtain multiple classification features, and all the classification features are identified according to preset classification rules to obtain an image recognition result, specifically includes: Classifying the image feature representation diagram according to the diffraction spots and the diffraction rings to obtain a plurality of classification features; The position information of all the classification features is determined according to the preset classification rules and the optical power signal matrix to obtain a recognition result.
[0012] Optionally, the image recognition method based on the photon differentiable logic gate network model, wherein the position information of all the classification features is determined according to the preset classification rules and the optical power signal matrix to obtain the recognition result, specifically includes: Performing position identification on the position information of all the classification features according to the preset classification rules and the optical power signal matrix to obtain target position information; Determining whether the label information of the target position information is the target label information of the optical power signal matrix; If the tag information is the target tag information, binary recognition is performed on the target tag information to obtain a recognition result.
[0013] In addition, to achieve the above-mentioned purpose, the present invention further provides an image recognition system based on a photon differentiable logic gate network model, wherein the image recognition system based on the photon differentiable logic gate network model: A signal conversion module is used to obtain grayscale matrix data of an input image and convert the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; an image feature representation graph generation module, configured to input the optical power signal into a photon differentiable logic gate network model, perform optical computation processing on the optical power signal through a plurality of logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and convert the optical power signal matrix to obtain an image feature representation graph; The image recognition module is used to classify the image feature representation diagram to obtain multiple classification features, and recognize all the classification features according to preset classification rules to obtain an image recognition result.
[0014] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores an image recognition program based on a photon differentiable logic gate network model, and when the image recognition program based on a photon differentiable logic gate network model is executed by a processor, the steps of the image recognition method based on a photon differentiable logic gate network model as described above are implemented.
[0015] In the present invention, grayscale matrix data of an input image is obtained and converted according to preset optical power mapping rules to obtain an optical power signal. The optical power signal is input into a photon differentiable logic gate network model, and optical calculation processing is performed on the optical power signal by multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix. The optical power signal matrix is then converted to obtain an image feature representation graph. The image feature representation graph is classified to obtain multiple classification features, and all of the classification features are identified according to preset classification rules to obtain an image recognition result. The present invention trains optical logic gates and recognizes graphics through a photon differentiable logic gate network model, achieving optical calculation and precise classification and recognition of image features. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1It is a flow chart of a preferred embodiment of the image recognition method based on the photon differentiable logic gate network model of the present invention; Figure 2 1 is a structural diagram of a preferred embodiment of the image recognition method based on a photon differentiable logic gate network model of the present invention; Figure 3 Schematic diagram of the SXPM optical path of a preferred embodiment of the image recognition method based on the photon differentiable logic gate network model of the present invention; Figure 4 1 is a structural diagram of a photonic device in a preferred embodiment of an image recognition method based on a photonic differentiable logic gate network model of the present invention; Figure 5 Schematic diagram of a logic gate processing framework of a preferred embodiment of an image recognition method based on a photon differentiable logic gate network model of the present invention; Figure 6 It is a flowchart of handwritten digit classification of a preferred embodiment of the image recognition method based on the photon differentiable logic gate network model of the present invention; Figure 7 This is a schematic diagram of the change of the light spot of the receiving screen in the SXPM of the preferred embodiment of the image recognition method based on the photon differentiable logic gate network model of the present invention; Figure 8 Schematic diagram of the Mnist confusion matrix of a preferred embodiment of the image recognition method based on the photon differentiable logic gate network model of the present invention; Figure 9 1 is a schematic diagram of a CIFAR-10 confusion matrix of a preferred embodiment of the image recognition method based on a photonic differentiable logic gate network model of the present invention; Figure 10 Schematic diagram of the accuracy of Mnist and CIFAR-10 tasks of a preferred embodiment of the image recognition method based on the photon differentiable logic gate network model of the present invention; Figure 11 1 is a structural diagram of a preferred embodiment of the image recognition system based on a photon differentiable logic gate network model of the present invention; Figure 12 It is a structural diagram of a preferred embodiment of the terminal of the device of the present invention. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solutions and advantages of the present invention more clear and distinct, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0018] Photonic neural networks, as an emerging computing paradigm, have garnered widespread attention in recent years. Compared to traditional electronic neural networks, they offer significant advantages such as low latency, low energy consumption, high bandwidth, and high parallelism, and are expected to play a significant role in future computing. Photonic differentiable logic gate neural networks, as a novel neural network architecture, replace neurons in traditional neural networks with optical logic gates. This not only retains the powerful learning capabilities of neural networks but also significantly reduces energy consumption. Furthermore, the use of photons instead of electrons enables even higher computational performance. However, existing optical logic gates are mostly fixed-function designs, lacking programmability and trainability, making them difficult to directly adapt to the dynamic parameter optimization requirements of deep learning. While the introduction of differentiable logic gate networks (DLGNs) provides a theoretical breakthrough for embedding discrete logic operations into a gradient descent framework, their electronic implementation is still limited by the physical limitations of traditional hardware. If neural networks directly employ optical logic gates, existing neural networks struggle to achieve high-speed, low-energy computational recognition of images. Therefore, an image recognition method based on a DLGN model is needed, whereby optical logic gates are trained via a neural network to efficiently recognize images.
[0019] The image recognition method based on the photon differentiable logic gate network model described in the preferred embodiment of the present invention is as follows: Figure 1 and Figure 2 As shown, the image recognition method based on the photon differentiable logic gate network model includes the following steps: Step S10: Obtain grayscale matrix data of an input image, and convert the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal.
[0020] The step S10 includes: Step S11, obtaining a data set and grayscale values of an input image, encoding the data set according to the grayscale values to obtain grayscale matrix data; Step S12: Mapping the grayscale matrix data according to the threshold power rule to obtain a plurality of optical power values, and dividing all the optical power values in sequence according to preset intervals to obtain an optical power signal.
[0021] Specifically, the data set and grayscale value of the input image are obtained, and the data set is encoded according to the grayscale value to obtain grayscale matrix data (the neural network converts the grayscale matrix data into grayscale matrix data when recognizing the number). Figure 2The digital "0" grayscale image of the 800*800 pixel points in the data set is encoded into a grayscale value matrix (grayscale matrix data) according to the grayscale value size. Each grayscale value of the grayscale matrix data corresponds to an optical power value. For example, among the grayscale values 0-255, 128 corresponds to the spatial cross-phase modulation (SXPM, Scanning X-ray Fluorescence Microscopy) threshold power, and 64 corresponds to half the threshold power). The grayscale matrix data is mapped according to the threshold power rule to obtain multiple optical power values. All the optical power values are divided in sequence according to preset intervals to obtain an optical power signal (the optical power corresponding to the grayscale value matrix is used as the input value of the 64,000 logic gates of the photon differentiable logic gate network in every 10 values, the logic gate processing unit (LPU, Logic Processing Unit), and further to the information acquisition device (CCD, Charge-Coupled Device) to collect the shape and intensity, the output generation unit output, obtain a process record (recording image information and output optical power information), and the process record is fed back to the program counter (PC, Program Counter).
[0022] In this embodiment, if Figure 2 As shown, process 1: convert the 10 values of the grayscale value matrix into optical power and use them as the input optical power of the first layer of laser. Process 2: input the CCD output results of the first layer (the number of diffraction rings and the optical power of the diffraction rings) into the computer, and then the second layer of laser uses the same optical power as the output diffraction ring of the first layer to output.
[0023] Step S20: input the optical power signal into a photon differentiable logic gate network model, perform optical calculation processing on the optical power signal through multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and convert the optical power signal matrix to obtain an image feature representation diagram.
[0024] The step S20 includes: Step S21: inputting the optical power signal into a photon differentiable logic gate network model, and performing a logical operation on the optical power signal through basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model based on a spatial cross-phase modulation method to obtain multiple diffraction information; Step S22: performing optical calculation processing on all the diffraction information through a plurality of the logic gate processing units to obtain an optical power signal matrix, and converting the optical power signal matrix to obtain an image feature representation diagram.
[0025] Specifically, if Figure 3As shown, the optical power signal is input into a photon differentiable logic gate network model. Based on the spatial cross-phase modulation method, the basic photon logic gates of the multiple logic gate processing units of the photon differentiable logic gate network model perform logical operations on the optical power signal to obtain multiple diffraction information (the threshold value of spatial cross-phase modulation (SXPM, Scanning X-ray Fluorescence Microscopy) is the laser power that makes the laser beam just become a diffraction spot. Below this power, the receiving screen is a diffraction spot; above this power, the receiving screen is a diffraction ring. The diffraction information includes a diffraction ring and a diffraction spot. The diffraction spot is a signal "0" and the diffraction ring is a signal "1"). All the diffraction information is optically calculated and processed by the multiple logic gate processing units to obtain an optical power signal matrix. The optical power signal matrix is then converted to obtain an image feature representation map (the processing and classification results of two handwritten digital images ("0" and "9") by the photon neural network, where each row corresponds to a handwritten digital. Recognition results: Each handwritten digit is processed into 800*800 grayscale values, or 640,000 grayscale values. There are 64,000 logic gate processing units, and each logic gate processing unit processes 10 grayscale values in sequence. After two optical calculations, each row ultimately outputs 10 diffraction ring images. The correctness of the image recognition for each row is determined based on the diffraction ring image output for each row. The output of all 64,000 rows is the accuracy rate of the digital image judgment. The two-layer image feature representation can intuitively observe how the photonic neural network gradually extracts and utilizes the image feature representation to achieve accurate classification.
[0026] In this embodiment, Figure 3 As shown, laser 1 is a 532nm laser, and laser 2 is a 671nm laser. The 671nm laser emitted by laser 2 passes through a 50:50 non-polarized beam splitter cube, and then is combined with the 532nm laser emitted by laser 1 through a beam splitter cube at a small angle. After passing through a focusing lens, it is incident on a photonic device located 5mm in front of the focus. The photonic device can move back and forth along the optical axis. A dichroic mirror is placed at the rear end to split the 532nm and 671nm beams. A receiving screen is placed at the light spots of the two beams respectively. Spatial cross-phase modulation (SXPM, Scanning X-ray Fluorescence Microscopy phenomenon: When beams of different wavelengths, 532nm and 672nm, are simultaneously irradiated at a small angle onto a material with SXPM characteristics at the same location, ensuring that the 532nm laser intensity does not exceed the SXPM threshold, and by increasing the intensity of the 671nm laser, it can be observed on the receiving screen that as the 671nm laser intensity increases, the diffraction spot of the 532nm laser on the receiving screen turns into diffraction rings, and the number of rings gradually increases. Figure 3The Z in the figure represents the longitudinal axis in the spatial coordinate system, which refers to the direction of light propagation or the thickness direction of the device.
[0027] The step S21 includes: Step S211: input the optical power signal into the photonic differentiable logic gate network model, and modulate the optical power signal based on a spatial cross-phase modulation method to obtain a target optical power signal; Step S212: Performing a logic operation on the target optical power signal through the basic photon logic gates of the multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information.
[0028] Specifically, the logical operation includes any one of an AND gate operation, an OR gate operation, a NAND gate operation, a NOR gate operation, an XOR gate operation, an XNOR gate operation, and a NOT gate operation. The optical power signal is input into the photon differentiable logic gate network model, and the optical power signal is modulated based on a spatial cross-phase modulation method to obtain a target optical power signal (based on the spatial cross-phase modulation method, a suitable light source and a spatial light modulator (SLM, Spatial Light Modulator) are selected to process the data into optical power information, i.e., a target optical power signal). The target optical power signal is subjected to a logical operation by the basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information (as input information to each logic gate processing unit, multiple logic gate processing units are used to implement the calculation process to obtain multiple diffraction information).
[0029] In this embodiment, Figure 3 and Figure 4As shown, (1) AND gate: Place the photonic device (the photonic device is composed of copper wire, indium tin oxide (ITO) glass, high entropy (HE-MXene) solution and acrylic double-sided tape) in the SXPM light path normally, set the 532nm input power to "1", the 671nm input power to "1", at this time the light intensity of the two beams is greater than the SXPM threshold light intensity, the 532nm SXPM diffraction ring and the 532nm laser diffraction ring can be observed on the rear observation screen, at this time the logical relationship "1+1=1" is realized, the photonic device is charged with a voltage of +0.4V for 10 minutes and then placed in the SXPM light path, set the 532nm input power to "1", the 671nm m input power "0", at this time, a 532nm laser diffraction spot is formed on the rear observation screen, and no 532nm laser diffraction ring is formed. At this time, the logical relationship "1+0=0" is realized. After charging the photonic device with a voltage of +0.4V for 10 minutes, place it in the SXPM optical path, set the 532nm input power to "0", and the 671nm input power to "1". At this time, no 532nm laser diffraction ring is formed on the rear observation screen. At this time, the logical relationship "0+1=0" is realized. Place the uncharged photonic device in the SXPM optical path and set the 532nm input power to "0"; (2 ) OR gate (OR): Place the photonic device normally in the SXPM optical path, set the 532nm input power to "1", the 671nm input power to "1", and the diffraction ring of the 532nm laser can be observed on the rear observation screen. At this time, the logical relationship "1+1=1" is realized. Set the 532nm input power to "1", the 671nm input power to "0", and the 532nm SXPM diffraction ring is formed on the rear observation screen. At this time, the logical relationship "1+0=1" is realized. Set the 532nm input power to "0", the 671nm input power to "1", and the rear observation screen A 532nm SXPM diffraction ring is formed on the screen, and the logical relationship "0+1=1" is achieved at this time. Set the 532nm input power to "0" and the 671nm input power to "0". At this time, the optical power of the two beams is less than the SXPM threshold power. No 532nm SXPM diffraction ring will be observed on the rear observation screen, and the output is 0. At this time, the logical relationship "0+0=0" is achieved; (3) NAND gate: Place the photonic device normally in the SXPM optical path, set the 532nm input power to "1" and the 671nm input power to "1", and apply a forward voltage of +0 to it.After 10 minutes of 4V charging, a bright spot at 532nm can be observed on the rear viewing screen. No SXPM diffraction ring is formed, indicating an output signal of "0." This is when the logical relationship "1+1=0" is achieved. An uncharged photonic device is placed in the SXPM optical path, and the 532nm input power is set to "1" and the 671nm input power is set to "0." An SXPM diffraction ring at 532nm can be formed on the rear viewing screen, achieving the logical relationship "1+0=1." When the 532nm input power is set to "0" and the 671nm input power is set to "1," an SXPM diffraction ring at 532nm can also be formed on the rear viewing screen, achieving the logical relationship "0+1=1." When both the 532nm and 671nm laser inputs are set to "0" and the photonic device is repositioned toward the focal point, as shown in the following example. Figure 3 As shown in the figure, a 532nm SXPM diffraction ring is formed on the rear viewing screen, and the output signal is "1". At this time, the logical relationship "0+0=1" is realized; (4) NOR gate: Place the photonic device normally in the SXPM optical path, set the 532nm input power to "1", the 671nm input power to "1", apply a forward voltage of +0.4V to it, and charge it for 10 minutes. After that, a bright spot at 532nm can be observed on the rear viewing screen. No SXPM diffraction ring is formed, which means the output signal is "0". At this time, the logical relationship "1+1=0" is realized; the charged The photonic device is placed in the SXPM optical path, and the 532nm input power is set to "1" and the 671nm input power is set to "0". At this time, the 532nm green light is a bright spot on the rear observation screen, and no SXPM diffraction ring is formed. At this time, the logical relationship "1+0=0" is realized; switch the setting of the 532nm input power to "0" and the 671nm input power to "1". At this time, no 532nm SXPM diffraction ring can be formed on the rear observation screen. At this time, the logical relationship "0+1=0" is realized; set the 532nm input power to "0" and the 671nm input power to "0". Figure 3As shown, the uncharged photonic device is translated toward the side of the plano-convex lens until a 532nm SXPM diffraction ring is formed on the rear viewing screen, and the output signal is "1". At this time, the logical relationship "0+0=1" is realized; (5) Exclusive OR gate (XOR): The photonic device is placed normally in the SXPM optical path, and the 532nm input power is set to "1", and the 671nm input power is set to "1". After applying a forward voltage of +0.4V and charging for 10 minutes, a bright spot at 532nm can be observed on the rear viewing screen. No SXPM diffraction ring is formed, which is the output signal "0". At this time, the logical relationship "1+1=0" is realized. The uncharged photonic device is placed in the SXPM optical path, and the 532nm input power is set to "1". , 671nm input power "0", at this time, a 532nm SXPM diffraction ring can be formed on the rear observation screen, and the logical relationship "1+0=1" is realized. Set the 532nm input power "0", 671nm input power "1", at this time, a 532nm SXPM diffraction ring can also be formed on the rear observation screen, and the logical relationship "0+1=1" is realized. When the 532nm input power "0" and 671nm input power "0" are set, it can be seen that a 532nm SXPM diffraction ring cannot be formed on the rear observation screen, and the output signal is "0", and the logical relationship "0+0=0" is realized; (6) XNOR gate: Place the photonic device normally in the SXPM optical path, set The input power of both beams is "1". The SXPM diffraction ring formed at 532nm can be observed on the rear observation screen, which is the output signal "1". At this time, the logical relationship "1+1=1" is realized. The charged photonic device is placed in the SXPM optical path, and the 532nm input power is set to "1" and the 671nm input power is set to "0". At this time, the 532nm green light is a bright spot on the rear observation screen, and no SXPM diffraction ring is formed. At this time, the logical relationship "1+0=0" is realized. Switch and set the 532nm input power to "0" and the 671nm input power to "1". At this time, the 532nm SXPM diffraction ring cannot be formed on the rear observation screen. At this time, the logical relationship "0+1=0" is realized. The input power of 0 nm is "0", the input power of 671 nm is "0", and the uncharged photonic device is repositioned to the side of the focus. A 532 nm SXPM diffraction ring is formed on the rear observation screen, and the output is a signal "1". At this time, the logical relationship "0+0=1" is realized; (7) NOT gate (NOT): the photonic device is charged with a voltage of +0.4 V for 10 minutes and then placed in the SXPM experimental light path. When the input power is "1" (the optical power is 20.1 mW), no SXPM diffraction ring will be formed at the rear end, and the output is a signal "0"; when the input power is "0" (the optical power is 10 mW), the uncharged photonic device is moved from the initial position A to the position B closer to the focus of the light beam, and a diffraction ring can be formed, and the output is a signal "1".
[0030] The step S22 includes: Step S221: performing optical calculation processing on all the diffraction information by using a plurality of the logic gate processing units to obtain first optical power data; Step S222: training the first optical power data through a plurality of the logic gate processing units to obtain second optical power data; Step S223: Eliminate the target position data of the second optical power data to obtain multiple matrix data, arrange all the matrix data to obtain an optical power signal matrix, and transform the optical power signal matrix to obtain an image feature representation diagram.
[0031] Specifically, if Figure 2 As shown, all the diffraction information is optically calculated and processed by multiple logic gate processing units to obtain first optical power data, and the first optical power data is trained by multiple logic gate processing units to obtain second optical power data (the feature map of (Layer 3, Network Layer 3) is particularly critical, which is directly related to the classification decision. The output of this layer is a 3x3 matrix, which reveals the ultimate basis for the network to identify and classify the input image). The target position data of the second optical power data is eliminated to obtain multiple matrix data, which are arranged according to all the matrix data to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation map (by integrating the photonic differentiable logic gate network model into each layer of the neural network, efficient feature extraction and classification of the input image can be achieved. The network structure of the photonic differentiable logic gate network model (PDLGN, Photonic Differentiable Logic Gate Network) includes an input layer, a logic gate processing framework composed of multiple logic gate processing units (LPU, Logic Processing Unit) to form a hidden layer and an output layer. The data calculation process of each layer is performed by a logic gate processing unit). Figure 5 As shown, Figure 5 The single-layer logic gate processing framework is composed of Figure 2 The system is composed of multiple logic gate processing units (LPUs) connected in parallel. The training process is as follows: a total of 10 digital images from 0 to 9 are input sequentially for optical calculation processing. For example, when input "1", the output result accuracy is maximized by switching between 7 logic gate processing units; when input "2", the output result accuracy is maximized by switching between 7 logic gate processing units. In this order, the "0-9" input training is repeated to achieve the highest recognition accuracy for all digital images of "0-9".
[0032] In this embodiment, each row corresponds to the recognition result of a handwritten digit: each handwritten digit is processed into 800*800, that is, 640,000 grayscale values, and there are 64,000 logic gate processing units ( Figure 2 The LPU in the image processing unit (LPU) processes 10 grayscale values assigned in sequence. After two optical calculation processes, each row finally outputs 10 diffraction ring images. The correctness of the image recognition in each row is judged based on the diffraction ring image finally output for each row. The output results of all 64,000 rows are the accuracy of the digital image judgment.
[0033] Step S30: classify the image feature representation graph to obtain multiple classification features, and identify all the classification features according to preset classification rules to obtain an image recognition result.
[0034] The step S30 includes: Step S31: classifying the image feature representation diagram according to the diffraction spots and the diffraction rings to obtain a plurality of classification features; Step S32: determining the position information of all the classification features according to the preset classification rules and the optical power signal matrix to obtain a recognition result.
[0035] Specifically, if Figure 6 and Figure 7 As shown, the image feature representation diagram is classified according to the diffraction spot and the diffraction ring to obtain multiple classification features (for the diffraction spot with label "0", all elements in the output matrix are 0, indicating that the network has not detected other classification features except "0". For the image with label "9", the element at the corresponding position in the output matrix is the diffraction ring with "1", and the other elements are 0, which means that the network has successfully identified and classified the image as "9"). According to the preset classification rules and the optical power signal matrix, the position information of all the classification features is determined to obtain the recognition result (such as Figure 4 As shown, in the output 3*3 matrix, if all the numbers are 0, it is classified as the recognized digital image "0", if the first number in the 3*3 matrix is 1, it is classified as the recognized digital image "1", if the second number in the 3*3 matrix is 1, it is classified as the recognized digital image "2", and so on. The output 3*3 matrix only accepts all 0s and only one 1).
[0036] The step S32 includes: Step S321: performing position identification on the position information of all the classification features according to a preset classification rule and the optical power signal matrix to obtain target position information; Step S322: Determine whether the label information of the target position information is the target label information of the optical power signal matrix; Step S323: If the tag information is the target tag information, binary recognition is performed on the target tag information to obtain a recognition result.
[0037] Specifically, according to the preset classification rules and the optical power signal matrix, the position information of all the classification features is positionally identified to obtain the target position information, and it is determined whether the label information of the target position information is the target label information of the optical power signal matrix (determine the diffraction spot of the label information "0" or the diffraction ring of "1" of the layer). If the label information is the target label information, binary recognition is performed on the target label information to obtain a recognition result (wherein each element corresponds to a possible classification label, and for each input image, at most only one element in the output matrix of the network is 1, and the rest are 0, which accurately indicates the classification result).
[0038] like Figure 8 and Figure 9 As shown, Figure 8 and Figure 9 The confusion matrix in Figure 2 shows that the image classification task on the Mnist and CIFAR-10 datasets was achieved, with classification (blind-testing model accuracy) reaching 97.7% and 50.7%, respectively. Figure 10 As shown in the figure, the correct prediction rate of this architecture for all categories of the Mnist dataset is over 96%, among which the accuracy of the numbers "0" and "1" is as high as 99%, indicating that the model has extremely strong feature extraction capabilities for simple structured images. For the CIFAR-10 dataset, the average classification accuracy is 50%, and the prediction accuracy of some categories is significantly higher than other categories. However, the recognition of complex textures and multi-target scenes still faces challenges. This result shows that although the accuracy of photonic neural networks decreases when facing more complex image classification tasks, it can still adapt to and process diverse image data well. By comparing the classification results on the two datasets, it can be seen that PDLGN performs very well on simple tasks (such as Mnist handwritten digit recognition), and when processing more complex image classification tasks (such as CIFAR-10), although the accuracy is reduced, it still shows good adaptability and robustness. These results verify the potential and application prospects of photonic neural networks in different types of image recognition tasks.
[0039] Furthermore, if Figure 11 As shown, based on the above-mentioned image recognition method based on the photon differentiable logic gate network model, the present invention also provides an image recognition system based on the photon differentiable logic gate network model, wherein the image recognition system based on the photon differentiable logic gate network model includes: The signal conversion module 51 is used to obtain grayscale matrix data of the input image and convert the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; an image feature representation graph generation module 52 for inputting the optical power signal into a photon differentiable logic gate network model, performing optical computation processing on the optical power signal through a plurality of logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and converting the optical power signal matrix to obtain an image feature representation graph; The image recognition module 53 is used to classify the image feature representation diagram to obtain multiple classification features, and recognize all the classification features according to preset classification rules to obtain an image recognition result.
[0040] Furthermore, if Figure 12 As shown, based on the above-mentioned image recognition method and system based on the photon differentiable logic gate network model, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 12 Only some of the components of the terminal are shown, but it should be understood that implementation of all of the shown components is not required, and more or fewer components may be implemented instead.
[0041] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal. Furthermore, the memory 20 may include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as program code of the installed terminal. The memory 20 may also be used to temporarily store data that has been output or is about to be output. In one embodiment, the memory 20 stores an image recognition program 40 based on a photonic differentiable logic gate network model. The image recognition program 40 based on a photonic differentiable logic gate network model can be executed by the processor 10, thereby implementing the image recognition method based on a photonic differentiable logic gate network model in the present application.
[0042] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, configured to execute program codes or process data stored in the memory 20, such as executing the image recognition method based on the photonic differentiable logic gate network model.
[0043] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The terminals communicate with each other via a system bus.
[0044] In one embodiment, when the processor 10 executes the image recognition program 40 based on the photon differentiable logic gate network model in the memory 20, the following steps are implemented: Obtaining grayscale matrix data of an input image, and converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; Inputting the optical power signal into a photon differentiable logic gate network model, performing optical calculation processing on the optical power signal through multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and converting the optical power signal matrix to obtain an image feature representation map; Classifying the image feature representation graph to obtain a plurality of classification features, and identifying all of the classification features according to a preset classification rule to obtain an image recognition result; Wherein, the preset optical power mapping rule includes a threshold power rule; The step of acquiring grayscale matrix data of an input image and converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal specifically includes: Obtaining a data set and grayscale values of an input image, encoding the data set according to the grayscale values to obtain grayscale matrix data; Mapping the grayscale matrix data according to the threshold power rule to obtain a plurality of optical power values, and dividing all the optical power values in sequence according to preset intervals to obtain an optical power signal; The optical power signal is input into a photon differentiable logic gate network model, the optical power signal is optically calculated and processed by multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram, specifically including: Inputting the optical power signal into a photon differentiable logic gate network model, and performing a logic operation on the optical power signal through basic photon logic gates of a plurality of logic gate processing units of the photon differentiable logic gate network model based on a spatial cross-phase modulation method to obtain a plurality of diffraction information; All the diffraction information is optically calculated and processed by a plurality of logic gate processing units to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram.
[0045] The optical power signal is input into a photon differentiable logic gate network model, and based on a spatial cross-phase modulation method, a logical operation is performed on the optical power signal through basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information, specifically including: Inputting the optical power signal into the photonic differentiable logic gate network model, modulating the optical power signal based on a spatial cross-phase modulation method to obtain a target optical power signal; Performing logic operations on the target optical power signal through basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information; The logic operation includes any one of an AND gate operation, an OR gate operation, a NAND gate operation, a NOR gate operation, an XOR gate operation, an XNOR gate operation, and a NOT gate operation.
[0046] The optical calculation processing of all the diffraction information by multiple logic gate processing units to obtain an optical power signal matrix, and the conversion of the optical power signal matrix to obtain an image feature representation diagram specifically includes: Performing optical calculation processing on all the diffraction information by using a plurality of the logic gate processing units to obtain first optical power data; Training the first optical power data through a plurality of the logic gate processing units to obtain second optical power data; Eliminating target position data of the second optical power data to obtain a plurality of matrix data, arranging all the matrix data to obtain an optical power signal matrix, and transforming the optical power signal matrix to obtain an image feature representation diagram; The diffraction information includes diffraction spots and diffraction rings.
[0047] The classifying process of the image feature representation diagram to obtain a plurality of classification features, and identifying all the classification features according to a preset classification rule to obtain an image recognition result specifically includes: Classifying the image feature representation diagram according to the diffraction spots and the diffraction rings to obtain a plurality of classification features; The position information of all the classification features is determined according to the preset classification rules and the optical power signal matrix to obtain a recognition result.
[0048] The determining of the position information of all the classification features according to the preset classification rules and the optical power signal matrix to obtain the recognition result specifically includes: Performing position identification on the position information of all the classification features according to the preset classification rules and the optical power signal matrix to obtain target position information; Determining whether the label information of the target position information is the target label information of the optical power signal matrix; If the tag information is the target tag information, binary recognition is performed on the target tag information to obtain a recognition result.
[0049] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores an image recognition program based on a photon differentiable logic gate network model, and when the image recognition program based on a photon differentiable logic gate network model is executed by a processor, the steps of the image recognition method based on a photon differentiable logic gate network model as described above are implemented.
[0050] In summary, the present invention provides an image recognition method, system, terminal, and storage medium based on a photon differentiable logic gate network model. The method comprises: obtaining grayscale matrix data of an input image, converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; inputting the optical power signal into a photon differentiable logic gate network model, performing optical calculation processing on the optical power signal through multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and converting the optical power signal matrix to obtain an image feature representation diagram; performing classification processing on the image feature representation diagram to obtain multiple classification features, and identifying all the classification features according to preset classification rules to obtain an image recognition result. The present invention trains optical logic gates and recognizes graphics through a photon differentiable logic gate network model, thereby achieving optical calculation and precise classification and recognition of image features.
[0051] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or terminal system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or terminal system comprising the element.
[0052] Of course, those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware (such as a processor, controller, etc.) through a computer program. The program can be stored in a computer-readable storage medium that can be read by a computer. When executed, the program can include the processes in the above-described method embodiments. The computer-readable storage medium can be a memory, a magnetic disk, an optical disk, etc.
[0053] It should be understood that the application of the present invention is not limited to the above examples. For those skilled in the art, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. An image recognition method based on a photon differentiable logic gate network model, characterized in that: The image recognition method based on the photon differentiable logic gate network model includes: Obtaining grayscale matrix data of an input image, and converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; Inputting the optical power signal into a photon differentiable logic gate network model, performing optical calculation processing on the optical power signal through multiple logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and converting the optical power signal matrix to obtain an image feature representation map; The image feature representation graph is classified to obtain a plurality of classification features, and all the classification features are identified according to a preset classification rule to obtain an image recognition result.
2. The image recognition method based on the photon differentiable logic gate network model according to claim 1, characterized in that: The preset optical power mapping rule includes a threshold power rule; The step of acquiring grayscale matrix data of an input image and converting the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal specifically includes: Obtaining a data set and grayscale values of an input image, encoding the data set according to the grayscale values to obtain grayscale matrix data; The grayscale matrix data is mapped according to the threshold power rule to obtain a plurality of optical power values, and all the optical power values are divided in sequence according to preset intervals to obtain an optical power signal.
3. The image recognition method based on the photon differentiable logic gate network model according to claim 1, characterized in that: The optical power signal is input into a photon differentiable logic gate network model, the optical power signal is optically calculated and processed by a plurality of logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram, specifically including: Inputting the optical power signal into a photon differentiable logic gate network model, and performing a logic operation on the optical power signal through basic photon logic gates of a plurality of logic gate processing units of the photon differentiable logic gate network model based on a spatial cross-phase modulation method to obtain a plurality of diffraction information; All the diffraction information is optically calculated and processed by a plurality of logic gate processing units to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram.
4. The image recognition method based on the photon differentiable logic gate network model according to claim 3, characterized in that: The optical power signal is input into a photon differentiable logic gate network model, and based on a spatial cross-phase modulation method, a logic operation is performed on the optical power signal by basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information, specifically including: Inputting the optical power signal into the photonic differentiable logic gate network model, modulating the optical power signal based on a spatial cross-phase modulation method to obtain a target optical power signal; Performing logic operations on the target optical power signal through basic photon logic gates of multiple logic gate processing units of the photon differentiable logic gate network model to obtain multiple diffraction information; The logic operation includes any one of an AND gate operation, an OR gate operation, a NAND gate operation, a NOR gate operation, an XOR gate operation, an XNOR gate operation, and a NOT gate operation.
5. The image recognition method based on the photon differentiable logic gate network model according to claim 3, characterized in that: The optical calculation processing of all the diffraction information by multiple logic gate processing units to obtain an optical power signal matrix, and the optical power signal matrix is converted to obtain an image feature representation diagram, specifically including: Performing optical calculation processing on all the diffraction information by using a plurality of the logic gate processing units to obtain first optical power data; Training the first optical power data through a plurality of the logic gate processing units to obtain second optical power data; Eliminating target position data of the second optical power data to obtain a plurality of matrix data, arranging all the matrix data to obtain an optical power signal matrix, and transforming the optical power signal matrix to obtain an image feature representation diagram; The diffraction information includes diffraction spots and diffraction rings.
6. The image recognition method based on the photon differentiable logic gate network model according to claim 5, characterized in that: The classifying process of the image feature representation diagram to obtain a plurality of classification features, and identifying all the classification features according to a preset classification rule to obtain an image recognition result specifically includes: Classifying the image feature representation diagram according to the diffraction spots and the diffraction rings to obtain a plurality of classification features; The position information of all the classification features is determined according to the preset classification rules and the optical power signal matrix to obtain a recognition result.
7. The image recognition method based on the photon differentiable logic gate network model according to claim 6, characterized in that: Determining the position information of all the classification features according to the preset classification rules and the optical power signal matrix to obtain the recognition result specifically includes: Performing position identification on the position information of all the classification features according to the preset classification rules and the optical power signal matrix to obtain target position information; Determining whether the label information of the target position information is the target label information of the optical power signal matrix; If the tag information is the target tag information, binary recognition is performed on the target tag information to obtain a recognition result.
8. An image recognition system based on a photon differentiable logic gate network model, characterized in that: The image recognition system based on the photon differentiable logic gate network model includes: A signal conversion module is used to obtain grayscale matrix data of an input image and convert the grayscale matrix data according to a preset optical power mapping rule to obtain an optical power signal; an image feature representation graph generation module, configured to input the optical power signal into a photon differentiable logic gate network model, perform optical computation processing on the optical power signal through a plurality of logic gate processing units of the photon differentiable logic gate network model to obtain an optical power signal matrix, and convert the optical power signal matrix to obtain an image feature representation graph; The image recognition module is used to classify the image feature representation diagram to obtain multiple classification features, and recognize all the classification features according to preset classification rules to obtain an image recognition result.
9. A terminal, characterized in that: The terminal includes: a memory, a processor, and an image recognition program based on a photon differentiable logic gate network model stored in the memory and runnable on the processor. When the image recognition program based on a photon differentiable logic gate network model is executed by the processor, the steps of the image recognition method based on a photon differentiable logic gate network model as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an image recognition program based on a photon differentiable logic gate network model. When the image recognition program based on a photon differentiable logic gate network model is executed by a processor, the steps of the image recognition method based on a photon differentiable logic gate network model as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Single-pixel imaging operation method, device and system and storage medium
CN114693822A
Image processing using photonic quantum computing
US20240202566A1