- Notifications
You must be signed in to change notification settings - Fork1
Applying YOLOv8 to Kaggle Ships in Google Earth dataset
License
robmarkcole/kaggle-ships-in-satellite-imagery-with-YOLOv8
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This project demonstrates the training of bothYOLOv5 andYOLOv8 to perform detection of ships on a Google Earth dataset. Training is performed on a GPU machine but inference is on any CPU machine.
The source dataset used is on Kaggle atShips in Google Earth. This dataset consists of images extracted from Google Earth which are approximately 30 to 50cm resolution. Images generally consist of a range of sizes of ship/boat against the blank ocean background, but some images are captured with ships close to the shoreline or with multiple clustered ships. Each ship is annotated with a bounding box in Pascal VOC (XML) format.
YOLOv5/8 requires images in a specific annotation format. To transform the annotations from Pascal VOC to YOLOv5/8 format I uploaded the dataset toRoboflow as Roboflow allows transormation of the annotations to the required format. I also rebalanced the dataset into train/validation/test splits with a 70%/20%/10% split (note these % change after augmenting the test images). I applied three augmentations to the training images which are appriate for aerial imagery: a horizontal flip and 2x rotations. This increased the training set size threefold to approximately 1.4k images. I also resized all images to 640x640 since this is the required size for the YOLOv8m model. This dataset is publicly availablehere
Roboflow provide ready to use training notebooks, and I used theYOLOv5 notebook. The notebook is provided here in the fileyolov5_kaggle_ships.ipynb.
I again used the RoboflowYOLOv8 notebook as my starting point. The notebook is provided here in the fileyolov8_kaggle_ships.ipynb. Training was performed on Google Colab Pro using a Tesla T4. The results of training for 100 epochs are below (yolov8n model):
Metrics for the best models, which are in themodels folder:
| Metric | yolov8n | yolov8m |
|---|---|---|
| Precision | 0.919 | 0.943 |
| Recall | 0.863 | 0.927 |
| mAP@.5 | 0.941 | 0.957 |
| mAP@.5:.95 | 0.683 | 0.720 |
Reviewing the predictions on the validation set I observed some errors, particularly for small boats. Overall the results are very encouraging:
Reviewing the test predictions (see notebook), in general ships are accurately detected with high confidence but some small and very long ships are missed.
With relatively little time and effort I trained a YOLOv8 model for ship detection. For improved results, future work could include experimentation with larger models, and augmentation strategies could be explored to help balance out some of the variations due to sea conditions (rough or calm), lighting (overcast or bright sunshine), ship density. However the training dataset is very small, so simply gathering a larger training dataset would have the largest impact on performance.
Theinference.ipynb notebook shows how to inference (process) images on a machine without GPU (I am on Intel Mac).
python3 -m venv venvsource venv/bin/activate(venv) $ pip install -r requirements.txt- Using VScode open
inference.ipynb
About
Applying YOLOv8 to Kaggle Ships in Google Earth dataset
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.



