# Deep Instance Segmentation of Laboratory Animals in Thermal Images
## 4 Discussion  
The objective of the study was to compare two different instance segmentation approaches and two different learning methods for the purpose of experimental animals segmentation on thermal images. Various methods for re-scaling thermal data to a standard image were also compared. In paper [38] authors showed that the model trained from random initialization, if it only has proper training parameters, can get results similar to the pre-trained models, however, it needs more iterations to converge. In our experiments training Mask R-CNN from scratch needed about 16 times the number of epochs (16,000 or 24,000) (Tables 4 and 5) than for the pre-trained model (1000 or 2000) to achieve similar results (Tables 2 and 3). Increasing the number of epochs to 100,000 improved the results only for the orig and ch1 images, but not significantly. TensorMask architecture required a much larger number of epochs for the random initialization training (100,000), and still did not achieve results comparable to the pre-trained model (see Tables 4 and 5). Mask R-CNN training from scratch neither is time nor data expensive. Only a slightly larger number of images and epochs allow it to achieve all-layers training results comparable to the pre-trained models. \begin{table}
\begin{tabular}{l c c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Mask**} & \multicolumn{2}{c}{**Mask**} & \multicolumn{2}{c}{**TensorMask**} & \multicolumn{2}{c}{**TensorMask**} \\  & **Pre-Trained** & \multicolumn{2}{c}{**From Scratch**} & \multicolumn{2}{c}{**Pre-Trained**} & \multicolumn{2}{c}{**From Scratch**} \\ \hline
**mAP** & bbox & segm & bbox & segm & bbox & segm & bbox & segm \\ \hline
**orig** & & & & & & & & \\ \hline
1. fold & 88.8 & 89.1 & 83.6 & 85.9 & 90.9 & 90.2 & 78.2 & 79.6 \\
2. fold & **92.0** & 89.5 & 84.7 & 87.6 & 91.9 & **90.5** & 73.9 & 70.6 \\
3. fold & 89.7 & 89.2 & 87.7 & 88.0 & 90.5 & 90.2 & 70.6 & 76.6 \\ \hline
**average** & 90.2 & 89.3 & _85.3_ & _87.2_ & **91.1** & **90.3** & 74.2 & 75.6 \\ \hline
**ch1** & & & & & & & & \\ \hline
1. fold & 90.2 & 89.7 & 84.6 & 87.2 & 90.3 & 90.2 & 78.9 & 77.7 \\
2. fold & 88.4 & 89.1 & 88.3 & 88.9 & **91.3** & **90.4** & 78.7 & 77.8 \\
3. fold & 89.6 & 89.4 & 88.3 & 89.0 & 90.2 & 89.8 & 75 & 74.4 \\ \hline
**average** & 89.4 & 89.4 & _87.1_ & _88.4_ & **90.6** & **90.1** & 77.5 & 76.6 \\ \hline
**ch2** & & & & & & & & \\ \hline
1. fold & 87.9 & 88.9 & 82.6 & 82.4 & 87.9 & **89.3** & 64.4 & 62.3 \\
2. fold & 84.7 & 86.4 & 86.6 & 88.2 & 89.1 & 89.0 & 66 & 57.2 \\
3. fold & **89.5** & 88.1 & 85.0 & 87.7 & 88.3 & 88.9 & 65.7 & 54.3 \\ \hline
**average** & 87.4 & 87.8 & _84.7_ & _86.1_ & **88.4** & **89.1** & 65.4 & 57.9 \\ \hline
**ch3** & & & & & & & & \\ \hline
1. fold & 73.9 & **65.7** & 66.4 & 56.1 & _75.0_ & 64.8 & 44.6 & 13.1 \\
2. fold & 63.0 & 51.9 & 65.6 & 57 & 70.9 & 61.9 & 40.2 & 11.2 \\
3. fold & 72.6 & 62.9 & 66.6 & 62.4 & 71.3 & 62.5 & 36.6 & 11.2 \\ \hline
**average** & 69.8 & 60.2 & _66.2_ & _58.5_ & **72.4** & _63.1_ & 40.5 & 11.8 \\ \hline
**16-bit** & & & & & & & & \\ \hline
1. fold & 90.5 & 89.4 & 84.9 & 85.9 & 91.6 & 90.2 & 78.1 & 80.2 \\
2. fold & 89.2 & 89.4 & 85.8 & 88.5 & **92.5** & **90.8** & 76.8 & 77.6 \\
3. fold & 90.0 & 89.1 & 86.6 & 87.8 & 90.6 & 89.9 & 71.5 & 73.9 \\ \hline
**average** & 89.9 & 89.3 & _85.8_ & _87.4_ & **91.6** & **90.3** & 75.5 & 77.2 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: 3-fold cross-validation mean Average Precision (mAP) results for pre-trained (four batch, 2000 epochs) and trained from scratch (two batch, 100,000 epochs) models of Mask R-CNN and TensorMask. The values in Tables 2 and 4 indicate that the best segmentation results for the pre-trained models can be obtained for the 16-bit and ch1 image followed by the orig for Mask R-CNN and also 16-bit with orig this time followed by ch1 using TensorMask. Ch2 images achieved only slightly lower results than the top ones. The bbox and segmentation mAP values for both architectures were close to 90 percent, with a slight TensorMask advantage.