# An Efficient Neural Network for Shape from Focus with Weight Passing Method
## 5 Experiments
### Quantitative Analysis  
In order to evaluate the performance of the proposed system quantitatively, two quantitative metrics: Root-Mean-Square-Error (RMSE) and correlation (Corr). In the case of experiments for synthetic objects, it is possible to calculate RMSE and correlation as their true depth maps are available. Whereas it is impracticable to compute RMSE and correlation metrics for real objects as there true depth maps are not available. RMSE measures the distortion between the true depth map and the estimated depth map. It can be calculated as:  
\[\text{RMSE}=\sqrt{\frac{1}{I_{W}\cdot I_{H}}\sum_{ \begin{subarray}{c}1\leq x \leq I_{W}\\ 1\leq y\leq I_{H}\end{subarray} }(z_{t}(x,y)-z_{e}(x,y))^{2}} \tag{23}\]where \(z_{t}(x,y)\) and \(z_{e}(x,y)\) are the true depth map and the estimated depth map respectively, \(I_{W}\) and \(I_{H}\) are the width and the height of the true and the estimated depth maps. correlation measures the similarity between the true depth map and the estimated depth map. It can be calculated as follows:  
\[\text{Corr}=\frac{\sum_{ \begin{subarray}{c}1\leq x\leq I_{W}\\ 1\leq y\leq I_{H}\end{subarray} }(z_{t}(x,y)-\overline{z_{t}(x,y)})(z_{e}(x,y)- \overline{z_{e}(x,y)})}{\sum_{ \begin{subarray}{c}1\leq x\leq I_{W}\\ 1\leq y\leq I_{H}\end{subarray} }(z_{t}(x,y)-\overline{z_{t}(x,y)})^{2}(z_{e}(x,y)-\overline{z_{e}(x,y)})^{2}} \tag{24}\]  
where \(\overline{z_{t}(x,y)}\) and \(\overline{z_{e}(x,y)}\) are the mean of the true and the estimated depth map, respectively. The performance comparison between conventional and proposed methods in terms of RMSE and correlation is shown in Table 1. The quantitative measures are calculated by using estimated depth maps through SML, GLV, NN.FIS with RS, NN.Planar with RS, NN.FIS with WP, and NN.Planar with WP. From Table 1, two meaningful results are (1) The performance is similar to each other between NN.FIS and NN.Planar with same initial weight setting method (NN.FIS with RS vs. NN.Planar with RS or NN.FIS with WP vs. NN.Planar with WP); and (2) the proposed WP generates more accurate estimated depth map than RS initial weight setting method (NN.FIS with RS vs. NN.FIS with WP or NN.Planar with RS vs. NN.Planar with WP). In the same manner, Table 2 shows the experiment time for various SFF methods using various synthetic objects. There are also two notable results (1) NN.Planar model is faster than NN.FIS model with same initial weight setting method; and (2) WP is faster than RS method. Specifically, NN.Planar with WP is about 90 times faster than NN.FIS with  
Figure 6: (**a**) Sample frames from image sequences of synthetic objects: plane object (first row), sinusoidal object (second row), cone object (third row), and wave object (fourth row). In addition, each column shows frame number 20, frame number 40, and frame number 70. In a sample frame, the texture clearly distinguishes only at the well focused area; (**b**) Sample frames from image sequences of real objects: real cone (first row), engraved letter I (second row), coin (third row), and TFT-LCD color filter (fourth row). In a sample frame, the texture clearly distinguishes only at the well focused area. WP, and NN.Planar with WP is about 100 to 140 times faster than NN.FIS with RS. Note that RS method gains additional complexity because of setting initial weights for all pixels of an object. In addition, the additional complexity varies considerably with the reference depth of the object. As shown in Algorithm 1, if \(z_{r}\) at a point is considerably high near to 1, then it fails to find the proper initial weight for \(z_{(x,y)}^{(1)}<|z_{r}(x,y)-\sigma|\). For this reason, Sinusoidal and Plane objects, which include many pixels having the reference depth near to 1, provide higher additional complexity than others. Moreover, WP method gives more stable performance than RS as shown in Figure 7. It shows box plots of the normalized RMSE from 30 experiments for Planar model with WP and RS method using various objects.