The high salinity, humidity, and oxygen-rich environments of coastal marine areas pose serious corrosion risks to metal structures, particularly in equipment such as ships, offshore platforms, and port facilities. With the development of artificial intelligence technologies, image recognition-based intelligent detection methods have provided effective support for corrosion monitoring in marine engineering structures. This study aims to explore the performance improvements of different modified YOLOv5 models in small-object corrosion detection tasks, focusing on five IoU-based improved loss functions and their optimization effects on the YOLOv5 model. First, the study utilizes corrosion testing data from the Zhoushan seawater station of the China National Materials Corrosion and Protection Science Data Center to construct a corrosion image dataset containing 1266 labeled images. Then, based on the improved IoU loss functions, five YOLOv5 models were constructed: YOLOv5-NWD, YOLOv5-Shape-IoU, YOLOv5-WIoU, YOLOv5-Focal-EIoU, and YOLOv5-SIoU. These models, along with the traditional YOLOv5 model, were trained using the dataset, and their performance was evaluated using metrics such as precision, recall, F1 score, and FPS. The results showed that YOLOv5-NWD performed the best across all metrics, with a 7.2% increase in precision and a 2.2% increase in F1 score. The YOLOv5-Shape-IoU model followed, with improvements of 4.5% in precision and 2.6% in F1 score. In contrast, the performance improvements of YOLOv5-Focal-EIoU, YOLOv5-SIoU, and YOLOv5-WIoU were more limited. Further analysis revealed that different IoU ratios significantly affected the performance of the YOLOv5-NWD model. Experiments showed that the 4:6 ratio yielded the highest precision, while the 6:4 ratio performed the best in terms of recall, F1 score, and confusion matrix results. In addition, this study conducted an assessment using four datasets of different sizes: 300, 600, 900, and 1266 images. The results indicate that increasing the size of the training dataset enables the model to find a better balance between precision and recall, that is, a higher F1 score, while also effectively improving the model’s processing speed. Therefore, the choice of an appropriate IoU ratio should be based on specific application needs to optimize model performance. This study provides theoretical support for small-object corrosion detection tasks, advances the development of loss function design, and enhances the detection accuracy and reliability of YOLOv5 in practical applications.