Skip to content

ESA-PhiLab/floatingobjects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detection of Floating Objects

Check our ISPRS Conference Paper (Annals) and please consider citing

Mifdal, J., Longépé, N., and Rußwurm, M.: TOWARDS DETECTING FLOATING OBJECTS ON A GLOBAL SCALE WITH LEARNED SPATIAL FEATURES USING SENTINEL 2, ISPRS Ann. Photogramm. Remote Sens. Spatial Inf. Sci., V-3-2021, 285–293, https://doi.org/10.5194/isprs-annals-V-3-2021-285-2021, 2021.

Check also our most recent publication OCEANS Conference Paper

Carmo, R., Mifdal, J., and Rußwurm, M.: Detecting Macro Floating Objects on Coastal Water Bodies using Sentinel-2 Data, OCEANS 2021 San Diego – Porto, 2021.

Getting Started

The dataset is assumed to be located at /data. It can be downloaded from this link with the script python code/download.py /data

Environments

Anaconda

conda create -n floatingobjects pip
conda activate floatingobjects
conda install -c conda-forge gdal # GDAL needs to be conda installed
pip install -r requirements.txt

Docker

A docker with configured environment can be built and run via

# build
docker build -t floatingobjects .
# run
docker run -v /data:/data floatingobjects python main.py

Predict

Usa a model snapshot (--snapshot-path) to predict floating objects on an image (--image-path). The results will be stored in as tif in the location specified by --prediction-path

python code/predictor.py --prediction-path "prediction.tif" \\
    --image-path "Limassol20181215_l2a.tif" \\
    --snapshot-path unet-posweight10-lr001-aug1.pth.tar

Train

For the 5-fold training run

python code/main.py train --results-dir models --data-path /data

Load pretrained models using PyTorch Hub

Here you can load the models with pretrained weights from the 2-fold training of U-Net and MA-Net, according to what has been published in OCEANS Conference Paper

import torch
unet_seed0 = torch.hub.load('ESA-PhiLab/floatingobjects:master', 'unet_seed0')
unet_seed1 = torch.hub.load('ESA-PhiLab/floatingobjects:master', 'unet_seed1')
manet_seed0 = torch.hub.load('ESA-PhiLab/floatingobjects:master', 'manet_seed0')
manet_seed1 = torch.hub.load('ESA-PhiLab/floatingobjects:master', 'manet_seed1')

Dataset

Download

The dataset can be manually downloaded using this link and unzipped via

python code/download.py ./data/

to ./data

Dataset Overview and Predictions

Click on images for a detailed overview powered by the COG-Explorer of EOX.

The RGB, NDVI, FDI overview created from the 12/13-band Sentinel 2 images with code/create_overview_table.py.

Region/Date RGB NDVI FDI predictions
accra_20181031 accra_20181031 accra_20181031 accra_20181031 accra_20181031
danang_20181005 danang_20181005 danang_20181005 danang_20181005 danang_20181005
kolkata_20201115_l2a kolkata_20201115_l2a kolkata_20201115_l2a kolkata_20201115_l2a kolkata_20201115_l2a
lagos_20190101_l2a lagos_20190101_l2a lagos_20190101_l2a lagos_20190101_l2a lagos_20190101_l2a
longxuyen_20181102 longxuyen_20181102 longxuyen_20181102 longxuyen_20181102 longxuyen_20181102
mandaluyong_20180314 mandaluyong_20180314 mandaluyong_20180314 mandaluyong_20180314 mandaluyong_20180314
panama_20190425_l2a panama_20190425_l2a panama_20190425_l2a panama_20190425_l2a panama_20190425_l2a
riodejaneiro_20180504_l2a riodejaneiro_20180504_l2a riodejaneiro_20180504_l2a riodejaneiro_20180504_l2a riodejaneiro_20180504_l2a
sandiego_20180804_l2a sandiego_20180804_l2a sandiego_20180804_l2a sandiego_20180804_l2a sandiego_20180804_l2a
venice_20180630_l2a venice_20180630_l2a venice_20180630_l2a venice_20180630_l2a venice_20180630_l2a
venice_20180928_l2a venice_20180928_l2a venice_20180928_l2a venice_20180928_l2a venice_20180928_l2a
vungtau_20180423 vungtau_20180423 vungtau_20180423 vungtau_20180423 vungtau_20180423

Tests

The dataset.py tests require a downloaded dataset

export TESTS_DATA_ROOT=/data
python tests/dataset.py

and check if all samples of the datasets can be returned and that no overlap exists in the train/test splits.

Bibtex

@Article{mifdal2021floating,
    AUTHOR = {Mifdal, J. and Long\'ep\'e, N. and Ru{\ss}wurm, M.},
    TITLE = {TOWARDS DETECTING FLOATING OBJECTS ON A GLOBAL SCALE WITH LEARNED SPATIAL FEATURES USING SENTINEL 2},
    JOURNAL = {ISPRS Annals of the Photogrammetry, Remote Sensing and Spatial Information Sciences},
    VOLUME = {V-3-2021},
    YEAR = {2021},
    PAGES = {285--293},
    URL = {https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/V-3-2021/285/2021/},
    DOI = {10.5194/isprs-annals-V-3-2021-285-2021}
}