# Deep Learning for Visual Leading of Ships: AI for Human Factor Accident Prevention
## 3 Results and Discussion  
### Network Training Accuracy and Hyperparameters: Transfer Learning  
As previously explained, a convolutional neural network was initially trained using a transfer learning approach. For this task, we selected SqueezeNet, a pre-trained CNN, due to its exposure to a large-scale dataset of over one million images across 1000 categories, providing a rich feature base for visual recognition tasks. Other architectures, such as GoogleNet, were not chosen because of their comparatively lower accuracy in similar applications [13].  
During training, we configured the model with three output classes (OK, NOT OK, and DOUBT). The Adam optimizer was used with a constant weight learning rate factor of 10, and training was carried out over 40 epochs, based on the observed convergence of the algorithm after approximately ten iterations. The initial stopping criterion was set to the minimum loss, but after several tests an alternative criterion based on a plateau in the loss value over multiple epochs was adopted. The main results are presented in Figures 8 and 9 as confusion matrices. In these confusion matrices, we can compare the obtained result (Predicted class) with respect to the initial manual classification done previously by humans (True Class) to test the artificial intelligence.  
To interpret these figures, it is important to note that a high loss and low accuracy indicate poor performance, reflecting widespread misclassification. Conversely, a low loss combined with high accuracy indicates strong predictive performance with only minor errors. A scenario with both low loss and low accuracy suggests a limited error magnitude across many data points, but lack of effective generalization.  
Figure 8 illustrates a poor prediction outcome, with the model classifying all test images as OK (correct leading). As we can see in Figure 8, all the images are in the OK column of the predicted images, but really some of them are NOT OK or in the DOUBT row of the true classes previously defined by humans to start the test. Although the training and validation phases reported an accuracy of approximately 60%, this level was deemed insufficient.  
Figure 8: Confusion matrix for the CNN model trained with Adam optimizer and a constant learning rate of 0.001, using three output classes.  
To improve the model's performance, several training experiments were conducted, including reducing the weight learning rate factor, testing both constant and variable learning rate schedules, and evaluating alternative optimization algorithms, such as replacing Adam with SGDM (Stochastic Gradient Descent with Momentum) [14; 15]. Additionally, L2 regularization was introduced to minimize overfitting. As shown in Figure 10, some variation was observed in the accuracy curve, yet the overall classification performance and confusion matrix remained suboptimal.  
Figure 10: Accuracy and loss evolution during training with L2 regularization applied, showing a similar performance to the baseline configuration.  
Figure 9: Training accuracy and loss curves over 40 epochs for the initial CNN configuration.  
In response, a new convolutional neural network was developed, specifically designed for the visual conditions of night navigation. Because of the high validation frequency, the validation curve appears with linear segments. Nevertheless, it is evident that the loss decreased compared to the previous model, due to reducing the weight learning rate factor to 1. This suggests that, although the overall loss improved, significant errors persisted in specific subsets of the data, as reflected in the confusion matrix.