# Deep Learning for Visual Leading of Ships: AI for Human Factor Accident Prevention
## 3 Results and Discussion
### Accuracy Analysis in Visual Detection  
Based on the previous results, a new test was conducted using navigation scenarios at varying distances between the vessel and the two reference lights, in order to evaluate the accuracy of leading light detection by artificial intelligence. At greater distances, the two lights often appear as a single point to the human eye, due to their visual overlap. Moreover, even a slight misalignment of the reference lights can result in significant navigational errors, leading to economic costs and increased accident risk. Figure 19: Accuracy of the CNN (Adam, Weight Learning factor 0.2 and two classes and 200 epochs, Accuracy = 0.8362). Figure 18: Confusion matrix (Adam, Weight Learning factor 0.2 and two classes 200 epochs). As a result, and following the earlier findings, a new classification scheme was introduced to better capture the degree of deviation from correct alignment. Specifically, six categories were defined based on the quality of visual leading:  
1. Light and OK: At long distances, the two leading lights appear as a single point, which should ideally be positioned at the bow. 2. Lights and OK: The vessel is close to the leading lights, which are clearly visible and often overlapping. This represents proper navigational alignment. 1. NOT OK-Port Deviation: The ship is misaligned to port, deviating from the intended leading line. 2. NOT OK-Starboard Deviation: The ship is misaligned to starboard, also indicating incorrect leading. 3. NOT OK-Low Bow Deviation: Both lights appear near the bow but are not vertically aligned, indicating a subtle deviation. 4. DOUBT: Visual ambiguity due to interference from lights on the horizon, making it difficult to assess the alignment. A new training process was carried out using this six-class classification scheme and obtaining Figures 20 and 21. Although the number of images in some categories was reduced, this approach provided an interesting case study on improving the network's ability to predict incorrect leading with greater precision. This last confusion matrix was an attempt to identify the possibility of getting an autonomous pilot based on this system. For instance, when both lights appear vertically aligned, correct leading is assured. However, a small horizontal shift in the front light (e.g., starboard of the rear light) implies a portside deviation, which can be operationally significant even if visually subtle. These classifications allow the AI system to support not only binary navigation assessments (OK/NOT OK) but also to advise on corrective steering actions. It is of interest to highlight that when the deviation is elevated, the lights change their color; a simple black and white neural network will work perfectly for this application. In general terms, the average accuracy obtained during the validation process was 0.68, representing a decrease compared to the accuracy achieved using only three classes. This reduction is primarily due to lower precision when identifying NOT OK conditions, as accuracy dropped from 83% (for the two-light case) to 68%. This effect requires more detailed analysis. As shown in the confusion matrix, the neural network clearly recognizes the underlying reason why certain \"doubtful\" images appear ambiguous to human observers--typically due to background lighting such as coastal lights or other visual noise. When examining class-specific performance, the lowest accuracy occurred in the NOT OK-Low Bow Deviation category, which was frequently misclassified as OK with one or two lights. This is understandable, as the lights are indeed positioned near the bow--suggesting correct alignment--but fail to meet the vertical alignment criteria of true leading lights. Additionally, partial misclassification was observed in the NOT OK-Medium Port Deviation category, where the two lights should appear clearly shifted to one side of the bow. Despite this, only four misclassifications out of 150 images were recorded, resulting in a low error rate of just 2.6%.