--- license: agpl-3.0 library_name: ultralytics tags: - satellite imagery - marine traffic - sentinel-2 - yolov8 model-index: - name: mayrajeo/marine-vessel-detection-yolov8 results: - task: type: object-detection metrics: - type: precision value: 0.880 name: mAP@0.5(box) - type: precision value: 0.858 name: Precision@0.5 - type: recall value: 0.875 name: Recall@0.5 - type: precision value: 0.453 name: mAP(box) --- # Model Card for YOLOv8 models for detecting marine vessels from RGB Sentinel-2 images ## Model Details ### Model Description These model weights are meant for detecting marine vessels from RGB Sentinel-2 imagery. The models are trained and validated on human-annotated marine vessel data. These annotations, information of which Sentinel-2 product they correspond to, and instructions on how to convert them into COCO or YOLO format datasets will be made available as GeoPackage files on Zenodo portal in the near future. - **Developed by:** Janne Mäyrä - **Model type:** Object Detection - **Finetuned from model:** YOLOv8 pretrained models ### Model Sources - **Paper:** [http://dx.doi.org/10.2139/ssrn.4827287](http://dx.doi.org/10.2139/ssrn.4827287) - **Demo:** [https://huggingface.co/spaces/mayrajeo/marine-vessel-detection](https://huggingface.co/spaces/mayrajeo/marine-vessel-detection) ## Uses ### Direct Use Models are trained to process 320x320 pixel patches of Sentinel-2 RGB images with 10m resolution and detect marine vessels which are upsampled into 640x640 pixels during training and inference. The models will detect targets from outside of the water areas, but those detections can be eliminated by using external datasets such as land masks. ### Out-of-Scope Use These models are not suitable for other purposes than for detecting potential marine vessels from satellite imagery. ### Recommendations The models are most accurate on more closed water areas such as denser archipelagos and close to the coast instead of open sea. Especially during windy conditions the models incorrectly detect a large number of wakes and glint as marine vessels. ## How to Get Started with the Model [https://github.com/mayrajeo/ship-detection] provides examples on how to use the models. ## Training Details ### Training Data The model is trained using the following Sentinel-2 mosaics and manually annotated marine vessel data. Archipelago sea 2 and Kvarken were used as test data. Other three locations were sliced into 320x320 pixel patches. These patches were then spatially split into five equal sized folds so that each fold contained data from all timesteps and locations, and all patch locations that contained an annotated vessel in any timestep were included in the folds. In total, this dataset contained 3264 320x320 pixel image patches, of which 1974 contained annotated vessels and 1290 were background patches. The annotations are available as GeoPackages on Zenodo portal: [https://zenodo.org/doi/10.5281/zenodo.10046341](https://zenodo.org/doi/10.5281/zenodo.10046341) Training and validation data: |Location|Date|Number of annotations|Annotated patches|Background patches| |-----|----|-------|------|------| |Archipelago sea|2022-06-19|519|271|269| |Archipelago sea|2022-07-21|1518|387|153| |Archipelago sea|2022-08-13|1368|402|138| |Gulf of Finland|2022-06-06|278|138|241| |Gulf of Finland|2022-06-26|1206|269|110| |Gulf of Finland|2022-07-21|971|260|119| |Bothnian Bay|2022-06-27|122|81|88| |Bothnian Bay|2022-07-12|162|98|71| |Bothnian Bay|2022-08-28|98|68|101| #### Training Hyperparameters Training configs can be found from each model directory, in the file `args.yaml`. ## Evaluation ### Testing Data, Factors & Metrics #### Testing Data Test data consists of six Sentinel-2 mosaics: |Location|Date|Number of annotations| |--------|----|---------------------| |Bothnian sea|2021-07-14|450| |Bothnian sea|2022-06-24|424| |Bothnian sea|2022-08-13|399| |Kvarken|2022-06-17|83| |Kvarken|2022-07-12|183| |Kvarken|2022-08-26|88| #### Factors Before evaluating, the predictions for the test set are cleaned using the following steps: 1. All prediction whose centroid points are not located on water are discarded. The water mask used contains layers `jarvi` (Lakes), `meri` (Sea) and `virtavesialue` (Rivers as polygon geometry) from the Topographical database by the National Land Survey of Finland. Unfortunately this also discards all points not within the Finnish borders. 2. All predictions whose centroid points are located on water rock areas are discarded. The mask is the layer `vesikivikko` (Water rock areas) from the Topographical database. 3. All predictions that contain an above water rock within the bounding box are discarded. The mask contains classes `38511`, `38512`, `38513` from the layer `vesikivi` in the Topographical database. 4. All predictions that contain a lighthouse or a sector light within the bounding box are discarded. Lighthouses and sector lights come from Väylävirasto data, `ty_njr` class ids are 1, 2, 3, 4, 5, 8 5. All predictions that are wind turbines, found in Topographical database layer `tuulivoimalat` 6. All predictions that are obviously too large are discarded. The prediction is defined to be "too large" if either of its edges is longer than 750 meters. #### Metrics Precision and Recall with IoU-threshold of 0.5, mAP50 and mAP. ### Results 5-fold cross-validation results: | Model | ('Precision', 'max') | ('Precision', 'mean') | ('Precision', 'min') | ('Recall', 'max') | ('Recall', 'mean') | ('Recall', 'min') | ('mAP', 'max') | ('mAP', 'mean') | ('mAP', 'min') | ('mAP50', 'max') | ('mAP50', 'mean') | ('mAP50', 'min') | |:--------|-----------------------:|------------------------:|-----------------------:|--------------------:|---------------------:|--------------------:|-----------------:|------------------:|-----------------:|-------------------:|--------------------:|-------------------:| | yolov8n | 0.84688 | 0.82316 | 0.81273 | 0.79587 | 0.783928 | 0.76895 | 0.38816 | 0.380828 | 0.37637 | 0.84323 | 0.827192 | 0.81776 | | yolov8s | 0.86363 | 0.834556 | 0.80835 | 0.83639 | 0.825554 | 0.81469 | 0.41098 | 0.406258 | 0.40374 | 0.86933 | 0.858632 | 0.84776 | | yolov8m | 0.83592 | 0.827938 | 0.81134 | 0.84939 | 0.83238 | 0.80153 | 0.41739 | 0.410742 | 0.40496 | 0.87071 | 0.860378 | 0.84545 | | yolov8l | 0.8545 | 0.846998 | 0.83973 | 0.84975 | 0.83072 | 0.82398 | 0.41694 | 0.411712 | 0.40505 | 0.87459 | 0.863334 | 0.85743 | | yolov8x | 0.84028 | 0.834728 | 0.83019 | 0.84891 | 0.828462 | 0.80858 | 0.42065 | 0.411532 | 0.40231 | 0.86203 | 0.858136 | 0.85131 | Models with best performance for test set for each model architecture: | Model | Fold | Precision | Recall | mAP50 | mAP | |:------|------|-----------|--------|-------|-----| |yolov8n| 1| 0.820806|0.838452| 0.842|0.403| |yolov8s| 4| 0.844485|0.860565| 0.865|0.422| |yolov8m| 4| 0.858866|0.874693| 0.880|0.453| |yolov8l| 1| 0.840909|0.863636| 0.862|0.443| |yolov8x| 1| 0.855746|0.859951| 0.876|0.450| ### Compute Infrastructure #### Hardware NVIDIA V100 GPU with 32GB of memory, hosted on computing nodes of Puhti supercomputer by CSC - IT Center for Science, Finland. #### Software Models were trained as Slurm batch jobs in Puhti. ## Citation [optional] **BibTeX:** ``` @misc{mayraMappingRecreationalMarine2024, type = {{{SSRN Scholarly Paper}}}, title = {Mapping Recreational Marine Traffic from Sentinel-2 Imagery with Yolov8}, author = {M{\"a}yr{\"a}, Janne and Virtanen, Elina and Jokinen, Ari-Pekka and Koskikala, Joni and V{\"a}kev{\"a}, Sakari and Attila, Jenni}, year = {2024}, doi = {10.2139/ssrn.4827287}, } ``` **APA:** Mäyrä, Janne and Virtanen, Elina and Jokinen, Ari-Pekka and Koskikala, Joni and Väkevä, Sakari and Attila, Jenni, Mapping Recreational Marine Traffic from Sentinel-2 Imagery with Yolov8. Available at SSRN: https://ssrn.com/abstract=4827287 or http://dx.doi.org/10.2139/ssrn.4827287 ## Model Card Contact Janne Mäyrä