Image recognition method and device based on all-hardware neural network of memristor
By using a fully hardware neural network based on memristors and employing voltage signal writing and reading to achieve in-memory operations, the problem of limited weight learning in memristor neural networks is solved, and an efficient image recognition method and device are realized.
Patent Information
- Application Number
- CN202110960665.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-20
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2041-08-20
AI Technical Summary
The weight learning process of existing memristor neural networks is limited by the von Neumann memory wall, making it difficult to achieve efficient in-memory operations.
Using memristors as weights, combined with an inverting amplifier circuit and an analog 8-to-1 selector, a fully hardware neural network image recognition method is implemented, and in-memory operations are achieved through writing and reading voltage signals.
It breaks free from the limitations of the von Neumann memory wall, achieving efficient image recognition without host learning, and is convenient to read and write and easy to operate.
Smart Images

Figure CN113971749B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip applications, specifically to a method and apparatus for image recognition based on a fully hardware neural network using memristors. Background Technology
[0002] A memristor, short for memory resistor, is a circuit device that represents the relationship between magnetic flux and electric charge. While a memristor has the dimension of resistance, unlike a regular resistor, its resistance is determined by the charge flowing through it. Therefore, by measuring the resistance of a memristor, the amount of charge flowing through it can be determined, thus enabling it to store charge. Furthermore, memristor-based random access memory (RAM) offers superior integration density, power consumption, and read / write speeds compared to traditional RAM.
[0003] Most existing memristor neural networks train neural network weights through an external host, and the weight learning process has not escaped the limitation of the von Neumann memory wall. Therefore, this paper proposes a method and device for image recognition based on a memristor-based all-hardware neural network. The method uses memristors as weights to achieve in-memory computation, thus overcoming the limitation of the von Neumann memory wall. Summary of the Invention
[0004] To address the shortcomings mentioned in the background section, the present invention aims to provide a method and apparatus for image recognition based on a fully hardware neural network using memristors.
[0005] The objective of this invention can be achieved through the following technical solutions:
[0006] A method for image recognition based on a memristor-based all-hardware neural network, characterized in that the method includes the following steps:
[0007] Step 1: When writing, apply the voltage equivalent to the normalized pixels on the image to the input port of the neural network, and set the target value to 10;
[0008] Step 2: After the network adaptively adjusts according to the input, that is, when the output signal reaches the target value of 10V, the training is complete;
[0009] Step 3: During reading, apply the normalized voltage of the pixels in the image from Step 1 to the input port of the neural network and observe the voltage at the output port. The output port closest to 10V is the corresponding group and image number during training.
[0010] Furthermore, step 1 includes the following steps:
[0011] Step 1-1: Normalize the image pixels, that is, normalize the gray pixels 0-255 to (0.1, 1), and apply the voltage of the corresponding values to the input port of the neural network in sequence;
[0012] Step 1-2: Select an image and write it into the first column as a weight. Do not set target values for the other columns. Similarly, select images and write them into the other columns in turn.
[0013] Furthermore, step 2 includes the following steps:
[0014] Step 2-1: Set the write signal input to 1, i.e., Write = 1. When the output signal is greater than the target value, i.e., e1 = 1 and e2 = 0, the memristor resistance increases under the influence of -10x, and the output signal decreases until the output signal equals the target value, i.e., e1 = 0 and e2 = 0. The memristor resistance remains unchanged, and the writing is complete. When the output signal is less than the target value, i.e., e1 = 0 and e2 = 1, the memristor resistance decreases under the influence of 10x, and the output signal increases until the output signal equals the target value, i.e., e1 = 0 and e2 = 0. The memristor resistance remains unchanged, and the writing is complete.
[0015] Step 2-2: After writing is complete, set the write signal input to 0, i.e., Write = 0, and wait to write other column weights or wait to read.
[0016] Furthermore, step 3 includes the following steps:
[0017] Step 3-1: During reading, randomly select one image from Step 1, normalize its pixels, apply the equivalent voltage to the input port of the neural network, and observe the voltage at the output port.
[0018] Step 3-2: Compare the output signals of each column. The column whose output voltage is closest to 10V is the column number that determines the input image number. If writing, use the image with the number 1 to write the weight of the first column. When reading, the first column output is closest to 10V to determine that the input number is 1.
[0019] An image recognition device based on a memristor-based all-hardware neural network is disclosed. The device includes an input module one, an input module two, and a weight module. The input weight module includes a memristor and two inverting amplifier circuits, and the memristor and the two inverting amplifier circuits are electrically connected in sequence. The output terminal of the input module two is connected to a subtractor.
[0020] Furthermore, the device has an input terminal x, an output terminal r, and control signals e1, e2, and w.
[0021] Furthermore, the weighting module includes two operational amplifiers LM324.
[0022] Furthermore, both input module one and input module two include ADG408 chips, and control signals e1, e2 and w are respectively connected to the three ports A0, A1 and A2 of the two ADG408 chips.
[0023] Furthermore, the input terminal x is connected to ADG408 via 10x, -10x, and constant.
[0024] The beneficial effects of this invention are:
[0025] 1. This invention uses memristors as weights to achieve in-memory operations, thus overcoming the memory wall limitation imposed by von Neumann.
[0026] 2. This invention combines a memristor with two analog 8-to-1 selectors to achieve hostless learning and is convenient for reading and writing. Attached Figure Description
[0027] The invention will now be further described with reference to the accompanying drawings.
[0028] Figure 1 This is a schematic diagram of the overall design of the invention;
[0029] Figure 2 This is a circuit diagram of the input module of the present invention;
[0030] Figure 3 This is a schematic diagram of the weight module circuit of the present invention;
[0031] Figure 4 This is a circuit diagram of input module two of the present invention;
[0032] Figure 5 This is a schematic diagram of the overall circuit of the present invention;
[0033] Figure 6 These are schematic diagrams illustrating examples of the present invention;
[0034] Figure 7 This is a schematic diagram of the circuit test of the present invention;
[0035] Figure 8 This is a schematic diagram of the input signal of the present invention;
[0036] Figure 9 This is a schematic diagram of the test results of the present invention; Detailed Implementation
[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0038] In the description of this invention, it should be understood that the terms "opening", "upper", "lower", "thickness", "top", "middle", "length", "inner", "around", etc., which indicate orientation or positional relationship, are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as limiting this invention.
[0039] like Figures 1-5 As shown, an image recognition device based on a memristor-based all-hardware neural network is disclosed. The device includes an input module one, an input module two, and a weight module. The input weight module includes a memristor and two inverting amplifier circuits, and the memristor and the two inverting amplifier circuits are electrically connected in sequence. The output terminal of the input module two is connected to a subtractor.
[0040] The device has x as its input terminal, r as its output terminal, and e1, e2, and w as its control signals.
[0041] The weighting module includes two operational amplifiers LM324.
[0042] Both input module one and input module two include ADG408 chips, and control signals e1, e2 and w are connected to the A0, A1 and A2 ports of the two ADG408 chips respectively.
[0043] The input terminal x is connected to ADG408 via 10x, -10x and constant respectively.
[0044] The memristor model is as follows:
[0045]
[0046]
[0047] Where W(t) is the state variable, io, ioff, ion are constants, uv is the average ion mobility, VT+ and VT- are the positive threshold voltage and negative threshold voltage, respectively, VT+ = 1V, VT- = -1V, and p is a positive integer.
[0048] A method for image recognition based on a memristor-based all-hardware neural network, characterized in that the method includes the following steps:
[0049] Step 1: When writing, apply the voltage equivalent to the normalized pixels on the image to the input port of the neural network, and set the target value to 10;
[0050] Step 2: After the network adaptively adjusts according to the input, that is, when the output signal reaches the target value of 10V, the training is complete;
[0051] Step 3: During reading, apply the normalized voltage of the pixels in the image from Step 1 to the input port of the neural network and observe the voltage at the output port. The output port closest to 10V is the corresponding group and image number during training.
[0052] Step 1 includes the following steps:
[0053] Step 1-1: Normalize the image pixels, that is, normalize the gray pixels 0-255 to (0.1, 1), and apply the voltage of the corresponding values to the input port of the neural network in sequence;
[0054] Step 1-2: Select an image and write it into the first column as a weight. Do not set target values for the other columns. Similarly, select images and write them into the other columns in turn.
[0055] Step 2 includes the following steps:
[0056] Step 2-1: Set the write signal input to 1, i.e., Write = 1. When the output signal is greater than the target value, i.e., e1 = 1 and e2 = 0, the memristor resistance increases under the influence of -10x, and the output signal decreases until the output signal equals the target value, i.e., e1 = 0 and e2 = 0. The memristor resistance remains unchanged, and the writing is complete. When the output signal is less than the target value, i.e., e1 = 0 and e2 = 1, the memristor resistance decreases under the influence of 10x, and the output signal increases until the output signal equals the target value, i.e., e1 = 0 and e2 = 0. The memristor resistance remains unchanged, and the writing is complete.
[0057] Step 2-2: After writing is complete, set the write signal input to 0, i.e., Write = 0, and wait to write other column weights or wait to read.
[0058] Step 3 includes the following steps:
[0059] Step 3-1: During reading, randomly select one image from Step 1, normalize its pixels, apply the equivalent voltage to the input port of the neural network, and observe the voltage at the output port.
[0060] Step 3-2: Compare the output signals of each column. The column whose output voltage is closest to 10V is the column number that determines the input image number. If writing, use the image with the number 1 to write the weight of the first column. When reading, the first column output is closest to 10V to determine that the input number is 1.
[0061] Example:
[0062] like Figure 6 As shown, to identify these three images, each image requires 15 inputs, which corresponds to 15 memristors. A total of 45 memristors are used in 3 groups.
[0063] Train sequentially according to the time interval. Set the target value for each training group to 10.
[0064] Suppose that the first group of training images is 1, the second group of training images is 2, and the third group of training images is 3. Because the inputs are different, the weights of the memristors in each group are also different.
[0065] When testing images, outputting the group closest to 10V will determine the specific value.
[0066] If the first group's output is closest to 10V during the test, then the input image can be determined to be 1; the same applies to the other groups.
[0067] Circuit testing:
[0068] like Figures 7-9 As shown, the above represents the input signal for each pixel. The design sets the voltage for white pixels to 0.1V and the voltage for black pixels to 0.9V. This allows for processing of images with different grayscale levels.
[0069] The data is processed in two phases: the first 50 seconds are for training (writing), and the next 100-120 seconds are for testing (reading).
[0070] E3 is the output of the first group, E20 is the output of the second group, and E68 is the output of the third group.
[0071] Using the test results from Image 1, the first set of outputs is closest to 10V. Based on this result, we can determine that the input image is Image 1. Similarly, we can determine the input based on the results.
[0072] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0073] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.
Claims
1. A method for image recognition based on a memristor-based full hardware neural network implementation, characterized in that, The method based on the memristor model with threshold voltage VT+=1V and VT-=-1V comprises the following steps: Step 1: when writing, the normalized voltage equivalent to the pixel points on the picture is added to the input port of the neural network, and the target value is set to 10v; Step 2: after the network is adaptively adjusted according to the input, the output signal reaches the target value 10v, that is, the training is completed; Step 3: when reading, the normalized voltage equivalent to the pixel points on the picture in step 1 is added to the input port of the neural network, and the output port voltage is observed; the output port closest to 10v is the output port of the picture in the training. The step 1 comprises the following steps: Step 1-1: normalize the picture pixel points, that is, normalize the gray pixel points 0-255 to (0.1, 1), and add the voltage corresponding to the value to the input port of the neural network in order; Step 1-2: select an image to write the first column weight, and do not set the target value for the other columns; similarly, select an image to write the other columns in turn; The step 2 comprises the following steps: Step 2-1: input the write signal as 1, that is, Write=1; when the output signal is greater than the target value, that is, e1=1, e2=0, at this time, the resistance of the memristor rises under the action of-10x, the output signal decreases, and until the output signal is equal to the target value, that is, e1=0, e2=0, the resistance of the memristor does not change, and the writing is completed; when the output signal is less than the target value, that is, e1=0, e2=1, at this time, the resistance of the memristor decreases under the action of 10x, the output signal increases, and until the output signal is equal to the target value, that is, e1=0, e2=0, the resistance of the memristor does not change, and the writing is completed; Step 2-2: after the writing is completed, input the write signal as 0, that is, Write=0, and wait for writing the weight of the other columns or reading; The step 3 comprises the following steps: Step 3-1: when reading, randomly select a picture in step 1, add the voltage equivalent to the normalized pixel points of the picture to the input port of the neural network, and observe the output port voltage; Step 3-2: compare the output signals of the columns, and the column with the output voltage closest to 10v is the column, so that the input picture is judged to be the picture; if a picture with a number 1 is used to write the first column weight when writing, the first column output closest to 10v when reading can judge that the input number is 1.
2. An image recognition device based on a memristor-based all-hardware neural network implementation, configured to implement the image recognition method based on the memristor-based all-hardware neural network of claim 1, characterized in that, The device comprises an input module one, an input module two and a weight module, the input weight module comprises a memristor and two reverse amplification circuits, and the memristor and the two reverse amplification circuits are sequentially electrically connected, and the output end of the input module two is connected with a subtractor.
3. The memristor-based all-hardware neural network implementation image recognition apparatus according to claim 2, wherein, The input end of the device is x, the output end is r, and the control signals are e1, e2 and w.
4. The memristor-based all-hardware neural network implementation image recognition apparatus according to claim 2, wherein, The weight module comprises two operational amplifiers LM324.
5. The memristor-based all-hardware neural network implementation image recognition device of claim 2, wherein, The input module one and the input module two both comprise ADG408 chips, and the control signals e1, e2 and w are respectively connected with A0, A1 and A2 three ports of the two ADG408 chips.
6. The memristor-based all-hardware neural network implementation image recognition device of claim 2, wherein, The input end x is respectively communicated with 10x, -10x and unchanged ADG408.
7. The memristor-based all-hardware neural network implementation image recognition device of claim 2, wherein, The memristor model is as follows: where w(t) is a state variable, i O , off , on is a constant, μ v is the average ion mobility, V T+ and V T- are the positive and negative threshold voltages, respectively, V T+ = 1 v, V T- = -1 v, and p is a positive integer.
Citation Information
Patent Citations
Memristor based image identification system and method
CN103810497A
Neural network face recognition system based on memristor
CN110443168A