Disclosure of Invention
In order to improve the calculation performance of the system, the invention provides a hybrid neural network based on a photoelectric calculation unit and an operation method of the hybrid neural network.
The neural network adopts the following technical scheme:
the hybrid neural network based on the photoelectric computing units comprises a neural computing core structure, wherein the neural computing core structure comprises a synaptic network, an axon, a data receiver, a selector, a dendrite and a neuron, an array formed by periodically arranging a plurality of photoelectric computing units is used as the synaptic network, each photoelectric computing unit comprises a light emitting unit and a computing unit, and light emitted by the light emitting unit is incident into the computing unit; each computing unit comprises a carrier control region, a coupling region, a photogenerated carrier collection region and a readout region; the carrier control areas of the computing units in each row in the array are sequentially connected to serve as axons, the carrier control area of each row is connected with a first selector, and all the first selectors are connected with the data receiver; the carrier readout regions of each column of computing units in the array are sequentially connected to serve as dendrites, and each column of carrier readout region is connected with a neuron; the single neuron comprises an analog-to-digital converter, an adder, a second selector, an activation function and a threshold comparator; the input end of the analog-to-digital converter is connected with the output end of the carrier reading area of the computing unit, and the output end of the analog-to-digital converter is connected with the input end of the adder; the output end of the adder is respectively connected with the input ends of the activation function and the threshold comparator; the output end of the activation function and the threshold comparator is connected with the second selector to output the result by classification of the second selector.
Further, the neural network further comprises a third selector, the input end of the third selector is connected with the activation function and the threshold comparator respectively, and the output end of the third selector is connected with the adder.
The invention relates to an operation method of a hybrid neural network based on a photoelectric calculation unit, which comprises the following specific steps: the light-emitting unit inputs the weight value of the nerve computation core structure into the synaptic network and stores the weight value under the drive of the driver; the data receiver receives and caches multi-bit value accurate information or binary pulse sequences from the outside, after receiving a synchronous control signal of current information, transmits the cached current information to a first selector of each row through an axon to carry out data type screening, and feeds the screened current information into a carrier control area of a corresponding calculation unit; multiplying the current information received by the carrier control area with the weight value stored in the synaptic network, and connecting the calculation result of each calculation unit through dendrite, so as to converge the current at the output end of the reading area of each row of calculation units and output the current to the neuron; the neuron carries out analog-digital conversion on the converged current signals to form digital signals, continuously accumulates the digital signal results after the conversion of the calculated current generated by the input pulse excitation, and then carries out additive bias and activation on the accumulated results, or brings the accumulated results into a model function of the threshold comparator to judge whether output pulse signals are generated.
The invention fully utilizes the integral storage and calculation characteristic of the photoelectric calculation unit, inputs the weight parameters in the mixed neural network into the array through light to be stored so as to simulate the connection weight in the human brain, completes multiplication operation by utilizing the characteristic of a single device and controls to execute an explicit algorithm or simulate the cerebral cortex by using a multiplexer, thereby forming a neural network with a mixture of computer science and neuroscience. Because the photoelectric memory and calculation integrated device integrates memory and calculation, the neural network does not need to repeatedly access the off-chip memory in actual operation, can greatly reduce power consumption, improves calculation efficiency, and has great advantages compared with the existing deep neural network.
Detailed Description
The photoelectric computing unit comprises a light emitting unit and a computing unit, wherein light emitted by the light emitting unit is incident into the computing unit. Each computing unit is a multifunctional area structure comprising three large functional areas, as shown in fig. 1, wherein the three large functional areas are: a carrier control region, a coupling region, a photogenerated carrier collection region, and a readout region. The carrier control region is used for controlling and modulating carriers in the photogenerated carrier collecting region and the readout region; the collecting areas in the photo-generated carrier collecting area and the reading area are used for absorbing photons emitted by the light emitting unit and collecting generated photo-generated carriers; the carrier control region or the photo-generated carrier collection region and the readout region are connected with the electric signal, and the readout region is used for outputting carriers acted by the photo-generated carriers and the electric signal; the coupling region connects the collection region and the readout region. The specific structure of the calculation unit may use the structures of examples 1 to 3 in patent application CN 201910415827.1.
Example 1
In the embodiment, a plurality of light emitting units and a computing unit structure are used for forming an n x n photoelectric computing array, a nerve computing nuclear structure is formed, a hybrid neural network is formed, and algorithms capable of processing multi-bit value accurate information such as a convolutional neural network and a cyclic neural network and algorithms capable of processing binary pulse sequences such as a pulse neural network are compatible.
As shown in FIG. 2, block W in the figure ij The photoelectric computing unit is represented by the specific numerical value, the specific numerical value represents the weight value stored in the photoelectric computing unit, the photoelectric computing array simulates a nerve synaptic network in the human brain, the weight information transmitted by the optical signals is received and stored, and the corresponding operation is completed when the data signals are received after the storage is completed. An array formed by periodically arranging a plurality of photoelectric calculation units is used as a synaptic network; the carrier control regions of each row of computing units in the array are connected in sequence as axons and are connectedAnd the control area of the data storage device is connected with a selector, all the selectors are connected with a data receiver, and the data receiver receives external current information. The carrier reading areas of each column of computing units in the array are sequentially connected to serve as dendrites, and the connected carrier reading areas are connected with a neuron; the input end of the analog-to-digital converter in the single neuron is connected with the output end of the carrier readout area of the computing unit, and the output end of the analog-to-digital converter in the single neuron is connected with one input end of the adder; the output end of the adder is respectively connected with the input ends of the activation function and the threshold comparator; the output end of the activation function or the threshold comparator is connected with the selector of the result output part; and after the neurons discriminate the corresponding algorithms, the neurons output the results through the selector classification of the result output part. A multiplexer is also used in the calculation process, the selector input end between the adder and the activation function as well as between the selector and the threshold comparator is connected with the activation function bias information and the threshold comparator, the output end of the selector is connected with the adder, and the neuron can select corresponding data to carry out accumulation operation according to the type of the current network algorithm.
The axon receives the data excitation signal in the neural network through a data receiver in the neural computing core. The buffered current information is passed through the axons to the selector for each row for data type screening. Dendrites pass the focused current to neurons. The neuron carries out analog-digital conversion on the converged current signals to form digital signals, and continuously accumulates the digital signal results after the conversion of the calculated current generated by the input pulse excitation, if the digital signals are the multi-bit value accurate information of a convolutional neural network, a cyclic neural network and the like, the accumulated results are subjected to operations such as adding bias and activation functions, and if the digital signals are the binary pulse sequences of the pulse neural network and the like, the accumulated results are brought into a threshold comparator model function composed of digital logic, and whether output pulse signals are generated or not is judged.
If the buffer current information screened by the selector is the multi-bit value accurate information of a convolutional neural network, a cyclic neural network and the like, the model of the neuron can be described by the following formula:
wherein I is i (t) represents the multi-value information received by the data receiver in the network at some point, and the current signal is transmitted to all the protruding points (i.e., the photoelectric calculation units) of each row in fig. 2 through the axons. W (W) ij Representing the weight stored by each photo-electric calculation unit in the n x n array. If the point has a weight value and is not 0, the point is indicated to have a connection relation in the network, and after the point receives the pulse, the point generates current according to the corresponding weight value and transmits the current through the dendrite. The summation between i=1 to n in the formula corresponds to the dendrites in fig. 2, and the currents of all the synapse points of each column are superimposed by dendrite convergence. b j Representing the applied bias, in relation to the network model. X is x j For intermediate results before the activation function ReLU model is given, it is stored by digital logic in neurons. In the activation function ReLU model f (x), if the multiplied multi-bit value accurate data is positive, the information is reserved and output; and if the multiplied and added multi-bit value accurate data is negative, resetting.
If the buffer current information screened by the selector is a binary pulse sequence of a pulse neural network, etc., the model of the neuron can be as follows:
wherein I is i (t) represents the binary pulse received by the pulse receiver in the network at some time, if a pulse stimulus is received, I i And (t) is 1, and the pulse signal is transmitted to all the protruding contacts (namely the photoelectric calculation units) of each row in fig. 2 through the axon. W (W) ij Representing the weight stored by each photo-electric calculation unit in the n x n array. If the point has a weight value other than 0, the point is connected in the network, and the point will root after receiving the pulseAnd generating current to be transmitted through the dendrite according to the corresponding weight. The summation between i=1 to n in the formula corresponds to the dendrites in fig. 2, and the currents of all the synapse points of each column are superimposed by dendrite convergence. V (V) j (t-1) is an intermediate result stored at a previous time, stored by a digital logic part in the neuron, and added to the calculation result at the current time. Lambda (lambda) j The threshold value representing each neuron is associated with a network model. Comparing the calculation result of the current moment in the neuron with a threshold value, if the calculation result exceeds the threshold value, sending out a pulse signal and resetting the current value; if the calculated result does not exceed the threshold value, the method continues to hold, and the calculated intermediate result at the next moment is received.
Example 2
The embodiment provides an application system and a flow based on the hybrid neural network.
As shown in fig. 3, the application system comprises six parts, namely an algorithm selection module, an algorithm mapping module, a parameter writing module, an excitation generation module, a network calculation module and a result conversion module. The algorithm selection module selects one or more of CNN type algorithms and SNN type algorithms to be used according to the actual demands of users; the algorithm mapping module decomposes the corresponding algorithm according to the user requirement, so that the calculation process of the algorithm can be mapped to the corresponding hybrid neural network; the parameter writing module writes the parameter information such as weight, bias and the like required by the corresponding algorithm into the photoelectric calculation array or the register according to the mapping relation according to the split algorithm of the algorithm mapping module; the excitation generation module generates corresponding data excitation according to excitation data in actual operation of an algorithm; the network computing module is used for processing the operation process of parameters and excitation in the hybrid neural network; the result conversion module is used for collecting the calculation result transmitted by the hybrid neural network, processing the calculation result according to the corresponding algorithm model and converting the calculation result into an explicit result of the corresponding algorithm.
As shown in fig. 4, the application flow of the hybrid neural network based on the photoelectric computing unit is as follows:
1. and determining an application scene and carrying out algorithm selection. The mixed neural network based on the photoelectric computing unit is suitable for a plurality of application scenes, such as face detection, image classification, voice recognition, denoising coding and the like; after determining the application category and the use scenario, the user selects a proper algorithm and training test data set according to the own requirements. For example, CNN algorithm can be selected for face recognition, image classification and other applications; for applications such as speech recognition, denoising coding, etc., SNN algorithms can be selected;
2. and performing network training. The user builds a network structure according to the selected algorithm type, and trains a network model according to the training test set so as to achieve the expected effect;
3. and performing algorithm mapping and simulation. Mapping the trained algorithm into a mixed neural network based on a photoelectric computing array through an algorithm mapping module, converting the operation flow of the algorithm into an information form supported by the mixed neural network based on the photoelectric computing array, and performing simulation on the mapped network to ensure that the mapped network can normally complete work;
4. and the whole hardware architecture is realized. According to the mapping relation of the algorithm, the main control part recompiles the hybrid neural network, the light emitting unit inputs the weight value of the neural calculation core structure into the synaptic network and stores the weight value under the drive of the driver, and meanwhile, the register stores parameter information such as bias and the like according to the requirement of the corresponding algorithm; after the writing of parameters such as weight, bias and the like is completed, the neural network receives excitation data transmitted from the outside, and converts the external excitation signal into an information form which can be processed by the hybrid neural network through the excitation generation module; then, the neural network completes the calculation process of parameters such as weight, bias and the like and excitation in a network calculation module and gives the calculation result to a result conversion module; and the result conversion module integrates the calculation result of the neural network according to the corresponding algorithm model, converts the calculation result into an explicit calculation result and displays the explicit calculation result in the application system.