# Content-Adaptive Light Field Contrast Enhancement Using Focal Stack and Hierarchical Network
## 3 Proposed Method
### Hierarchical Network
#### 3.3.3 The Input and Output Layers  
The input is the above 19 groups of feature data representing image brightness, and the adaptive values are the output. The output value \(y\) is given by  
\[y=a_{k}=g(h_{k})=g\left(\sum_{i=0}^{M}w_{jk}x_{jk}\right) \tag{11}\]  
where \(g(\,)\) is the activation function; this paper chooses the widely used rectified Linear Activation Unit (ReLU).  
\[ReLU(x)=\begin{cases}x&if\;\;x>0\\ 0&if\;\;x\leq 0\end{cases} \tag{12}\]  
As shown in Figure 5d, ReLU is the most commonly used activation function for training convolutional layers and deep learning models. It offers the advantages of simplicity of computation and ease of optimization, particularly when the behavior of neural networks is linear or near-linear. Therefore, it is well suited for performing supervised tasks on large-scale labeled datasets. Here, \(x\) denotes the input, \(w\) is the weight, \(h_{k}\) signifies the total of the output weight of \(k\) neurons in the output layer, and \(w_{jk}\) represents the current number of neurons and the weight of neurons in the next layer. As illustrated in Figure 5b, the value of \(q\) is 3 in our study. The loss function \(E\) adopts the sum-of-squares error function  
\[E=\frac{1}{N}\sum_{k=0}^{N-1}(y_{k}-t)^{2} \tag{13}\]  
We define the following metrics:  
True positive (TP): A positive example of being correctly predicted. That is, the true value of the data is a positive example, and the predicted value is also a positive example. True negative (TN): Counterexamples that were correctly predicted. That is, the true value of the data is a counter example, and the predicted value is also a counter example. False Positive (FP): Positive example of misprediction. That is, the real value of the data is a negative example, but it is wrongly predicted as a positive example.  
Figure 5: Architecture of multilayer perceptron network and feature extraction. (**a**) Database; (**b**) Fully-connected layers; (**c**) Feature extraction; (**d**) Activate function and cost function; (**e**) Test error.  
False negative (FN): A counterexample of being incorrectly predicted. That is, the true value of the data is a positive example, but it is incorrectly predicted to be a negative example.  
\[Accuracy=\frac{TP+TN}{TP+FP+TN+FN} \tag{14}\]  
According to the above metrics, the accuracy is 0.91. It can be seen that the prediction result of the machine learning network model is more reliable. Due to the balance of hardware overhead and effects, the current accuracy is sufficient to meet current needs, and we will consider further improving accuracy in the future.  
Finally, utilizing 19 sets of data, using the characteristic data of the image as the input and _gain1_ and _gain2_ as the output, the LF images are trained via the aforementioned MLP network to establish the relationship between the input and output. According to Figure 5e, the test error of the parameters acquired by the multilayer perceptron-trained network is less than 0.2, which shows that reliable values can be obtained using this method. The experiment is performed on our LF dataset, integrated with the classical LF dataset, which comprises 300 images of four scenes, including diverse conditions, such as sunny, cloudy, and indoor. Each image in the dataset undergoes augmentation as described above. Subsequently, 90% of the results are allocated for training, and the remaining 10% are used for testing. A substantial amount of training results are processed to derive the exact adaptive parameters.