# Measurement of Fish Morphological Features through Image Processing and Deep Learning Techniques
## 3 Experimental Results--Discussion
The latencies of the deep learning and image processing approaches examined in this paper are listed in Table 7. The measurements were performed on an Intel Core i5-9500 CPU @3.00 GHz 6-core processor with 16 GB of RAM. The latencies of the BMA and SCIA deep learning approaches are displayed in the second and the third columns. The second column lists the initialization latency that concerns the time needed to load the pretrained model. However, this was required only once and did not have to be repeated for every frame that was processed. The latency for processing one frame ranged from 2.716 to 5.112 s. A doubled delay is required by the Contour1 image processing technique. While the average latency of the deep learning approach was 3.58 s, the one for the Contour1 image processing technique was 7.83 s.  
The latency of the Contour2 image processing described by Algorithm 2 depended mainly on four factors: the number of pattern templates compared (\(T\)), the maximum scaling of the template (\(S_{max}\)), the stride in the pattern scaling (\(S_{tnd}\)) and the number of pattern rotation angles (\(N_{\varphi}\)). The number of template matchings (\(N_{lm}\)) that have to be examined is expressed as  
\[N_{lm}=T_{mpl}S_{max}N_{\varphi}N_{pos} \tag{20}\]  
where \(N_{pos}\) is the number of positions the template has to visit for a specific scaling. The larger the scaling, the larger the \(N_{pos}\) value and the smaller the template dimensions will be. For example, if the current scaling is \(s_{c}\), then the pattern is resized to \((H-s_{c},W-2s_{c})\). The width is reduced by \(2s_{c}\), since the default image width is twice its height (the resolution is \(80\times 160\)). The sliding area of Figure 6 is \((s_{c},2s_{c})\). If we assume that the pattern template is moving in the sliding area with stride = 1 vertically and stride = 2 horizontally, then \(N_{pos}=s_{c}^{2}\). The average pattern template dimension (i.e., its number of pixels \(N_{pxl}\)) can be estimated as  
\[N_{pxl}=\frac{\sum_{s_{c}=0}^{S_{max}/S_{tnd}}(H-S_{tnd}s_{c})(W-2S_{tnd}s_{c} )s_{c}^{2}}{\sum_{s_{c}=0}^{S_{max}/S_{tnd}}s_{c}^{2}} \tag{21}\]  
As can be seen from Table 7, the number of pattern templates is \(T\) = 12 (3 templates for each species), and in all cases, the maximum scaling is \(S_{max}\) = 40. This means that the smallest pattern template has a resolution of \((H-S_{max},W-2S_{max})=40\times 80\) pixels. In three of the four cases listed in Table 7, five pattern rotation angles were tested (\(N_{\varphi}\) = 5), ranging between \(-10^{\circ}\) and \(+10^{\circ}\) with an angle stride of \(5^{\circ}\). In one case, 9 rotation angles were tested (\(N_{\varphi}\) = 5), ranging between \(-20^{\circ}\) and \(+20^{\circ}\) with an angle stride of \(5^{\circ}\). The scaling stride \(S_{tnd}\) ranged from one to four. As can be seen from Table 7, the Contour2 flow was the slowest method, and its actual latency depended on the selected configuration. The features of the methods employed in this work are summarized in Table 8. As was already described, the Contour1 path can lead to very accurate morphological feature \begin{table}
\begin{tabular}{l c c c c c} \hline \hline  & \multicolumn{2}{c}{**Deep Learing**} & \multicolumn{2}{c}{**Contour1**} & \multicolumn{2}{c}{**Contour2 (\(S_{max}\) = 40, \(T_{mpl}\) = 12)**} \\ \hline  & Initialization & Frame Processing & & 534 & (\(S_{tnd}\) = 1, \(N_{\varphi}\) = 5) \\ Min & 1.325 & 2.716 & 5.835 & 128 & (\(S_{tnd}\) = 2, \(N_{\varphi}\) = 5) \\ Max & 1.552 & 5.112 & 10.41 & 53 & (\(S_{tnd}\) = 4, \(N_{\varphi}\) = 9) \\ Average & 1.364625 & 3.5835 & 7.831875 & 29 & (\(S_{tnd}\) = 4, \(N_{\varphi}\) = 5) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Latency of the fish morphological feature measurement approaches (in seconds). measurement at a reasonable speed, provided that the image has a simple background. Fish rotation and slant corrections can be performed using the affine transformation, which leads to the higher fish dimensions.