# Numerical Simulation of an InP Photonic Integrated Cross-Connect for Deep Neural Networks on [PERSON] Shi
## 5 Image Classification via a Three-Layer Photonic Deep Neural Network  
To investigate the performance of a complete neural network based on the combination of the AWG and SOA technology, for a broadcast-and-weight architecture, we implement and simulate an image classification problem, namely the iris flower classification problem, which has been reported to be able to be solved by using a deep neural network (DNN). The iris database includes three classes (Setosa, Versicolor, and Virginia) of 50 instances each [34]. Per each instance, the iris flower category is identified by observing four of its attributes: length and width of its sepals and petals. For this demonstration, we have executed the training of this DNN via the simulation platform _Tensorflow_[35], where we have used 120 instances as a training database. In order to make use of 4 weighted addition circuitries already available on chip and per layer, a feed-forward network made of 2 hidden layers with 4 neurons each and an output layer with 3 neurons (see Figure 5b), is trained on a computer. The attributes are encoded into \(2^{6}\) optical power levels at the photonic MMU input. The trained weight matrix is mapped to the matrix multiplication on the photonic components. The simulated structure of one layer of neurons is shown in Figure 5a, which is used to replace the photonic matrix multiplication unit in Figure 2e. The same chip is indeed capable of eight channel inputs, but we used four inputs for this classification problem. A total of 16 weight-SOAs in this matrix multiplication unit are used to assign the trained weight matrix from the trained DNN model to the PDNN. The hyperbolic tangent activation function is implemented offline after the O/E conversion. The output from the first hidden layer serves as input to the second layer (via the arbitrary waveform generator) and the output from the second hidden layer serves as input to the third (output) layer. Finally, the output of the third layer, after the _SoftMax_ transfer function, \(P(y=j)=e^{y_{j}}/\sum\limits_{j=1}^{n}e^{y_{j}}\), provides the predicted probability of the output samples \(y\) of belonging to class \(j\). Figure 5c presents the output data at the output (i) of the 1 st neuron in the 1 st layer, (ii) of the 2 nd layer and (iii) of the 3 rd layer, with the blue line being  
Figure 4: (**a**) Two-channel weighted addition, (**b**) three-channel addition, and (**c**) four-channel addition when tuning weights in channel 1 and fixed weight on other channels; (**d**) Maximum error versus the number of channels in weighted addition. Optical crosstalk levels are \(-15\) dB (blue), \(-20\) dB (red), \(-25\) dB (yellow) and \(-30\) dB (violet). the simulation results and red line the expectations and resulting in errors of 0.123, 0.051 and 0.055 respectively. These errors represent the performance of layers of photonic neurons. Higher error at the first layer may be due to the high optical signal noise ratio (OSNR) required multilevel encoding of the input signal, while a better performance at the 2 nd and 3 rd layer is attributed to the filtering of the signal level into lower levels after the first hidden layer. Also, the output of the first layer appears to be the most important for this classification problem, and therefore the utilization of three layers is slightly overstated. The correlation matrix between the prediction and the labels of the samples is used to show the final accuracy obtained via the multilayer photonic neural network (see Figure 6). We consider three cases for the sake of understanding the influence of the photonic layer implementation. In Figure 6a we display the prediction accuracy as coming from the trained DNN on a PC. This is calculated to be 95% since 6 out of 120 iris flower instances are falsely predicted. We simulate the DNN after adding, time by time, the photonic deep neuron network layers. The prediction accuracy decreases as the number of layers of the photonic neural network increases.