Ship Detection from SAR Images Using YOLOv7

Team: Detector; Member: 黃柏瑞



Ship detection is an important issue in the field of remote sensing. Not only to identify the illegal vessels but also to be a preprocess of oil leak detection. To carry out the ship detection, we exploit SAR image which plays a vital role because it is less affected from cloud cover. On the other hand, we use the most famous AI model, You Only Look Once (YOLO) ver. 7, for training and testing.



The work flow of ship detection is shown in figure 1. To conduct the ship detection, we firstly preprocess our dataset so that the dataset format can fit the YOLO model process. Since the YOLO model requires the dataset with training, validation and testing, we separate the whole dataset into 90% of training, 5% of validation and 5% of testing set. Secondly, we train the YOLO model using the training set and validation set. After the training process is done, the testing set is applied to evaluate the result of ship detection model.

Figure 1. Flow chart of ship detection.


You Only Look Once (YOLO):

YOLO model is an incredible AI object detection model developed by Joseph Redmon et al. It merges the traditional steps (e.g., object localization, feature extraction and image classification) of object detection into a single neural network. The YOLO is an end-to-end network so that we can train it by providing whole image without cropping as well as annotation data. Through the whole image, the YOLO predicts the location of bounding box and provides the probability of class in bounding box.



In this project, we use SAR-Ship-Dataset which was created using 102 Chinese Gaofen-3 images and 108 Sentinel-1 images. It consists of 39729 ship chips with size of 256 by 256 pixels and their annotation files.



In this project, we use testing set to evaluate the trained model. The figure 2 shows the results of detected ships from SAR images. It presents the detected ship objects and its’ prediction confidence.

Figure 2. Detected result of test set.



This project calculates true positive (TP), false positive (FP) and false negative (FN) to evaluate the number of correctly detected ship, number of wrong detected ship and number of missing detected ship. To further analysis, we calculate mean square error of predicted bounding box (x0, y0, x1 and y1). Testing set including 1987 images with 256 by 256 pixels are used form evaluation. All of evaluation results are shown in table 1.

TP (ship)

FP (ship)

FN (ship)

X0 (pix)

Y0 (pix)

X1 (pix)

Y1 (pix)










For further application, we crop an additional image from Sentinel-1 image (e.g., S1A_IW_GRDH_1SDV_20220726T215227_20220726T215256_044277_0548E4_068F) to test the ship detection system. The result is shown in figure 5.



Figure 5. Detection result. (a) Input image. (b) Detected image



The YOLOv7 is the state-of-the-art object detection model. We apply this model for ship detection from SAR images. The well-trained model can correctly detect 1917 ships and only detect 66 of wrong ships as well as missing detection of 86 ships. On the other hand, the position of detected bounding box achieve good performance and it's MSE is approximately 0.02 pixel.




In this project, we also use real Sentinel-1 images for ship detection. The result can be seen in appendix. However, there are still some obvious ships cannot be detected. In addition, we firstly exclude the land part since the model may incorrectly detect certain object on the land as ships. In the future, to obtain more precise ship detection model, the training dataset is needed to be optimize by including more ship images and land images.



  1. Wang, Y., Wang, C., Zhang, H., Dong, Y., & Wei, S. (2019). A SAR dataset of ship detection for deep learning under complex backgrounds. remote sensing11(7), 765.
  2. Wang, C. Y., Bochkovskiy, A., & Liao, H. Y. M. (2022). YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. arXiv preprint arXiv:2207.02696.



競賽相關事宜 連絡信箱