This repository implementes a neural network with the strucure of the UNet to segment pixels of a Sentinel 2 image to detect among others suspected marine debris. It is trained on the Marine Debris Archive (MARIDA) using the following classes:
- Marine Debris
- Dense Sargassum
- Sparse Sargassum
- Natural Organic Material
- Ship
- Clouds
- Marine Water (SC)
- Sediment-Laden Water
- Foam
- Turbid Water
- Shallow Water
The UNet can be configured to an arbitrary depth, but limitied by the input image size and the available GPU memory. The UNet is composed of blocks with the following recursive structure:
flowchart LR
A(input) --> C1(conv. 3x3)
C1 --> C2(conv. 3x3)
C2 --> M(2x2 max pooling)
M --> I(inner block)
I --> CT(transp. conv. 2x2)
CT --> D[concatenation]
C2 --> D
D --> C3(conv. 3x3)
C3 --> C4(conv. 3x3)
where conv. and trans. conv. are the 2D convolution (followed by an activation function) and transposed convolution respectively. The inner block is either the identity function (at the deepest level) or a block with the same structure as above.
The weights of the trained network are available at: https://dox.uliege.be/index.php/s/cPCMw5rjeX5gwTI and are distributed in the BSON format. The trained neural network is integrated into the POS2IDON pipeline.
- You need the julia programming language available at https://julialang.org/downloads/ (the code is tested with julia version 1.8.0 and 1.10.0 on Linux with an NVIDIA GPU)
- Clone this repo:
git clone https://github.com/Alexander-Barth/MarineDebrisUNet.jl
- Install all dependencies by issuing the following julia commands:
using Pkg
cd("MarineDebrisUNet.jl") # change the directory
Pkg.activate(".") # make MarineDebrisUNet.jl the current environement
Pkg.instantiate() # install all dependency in the current environement
It is important to run these installation commands on the computer with the GPU.
The environment variable MARIDA_DATASET
should contain the directory with the
Marine Debris Archive (MARIDA).
If this environment variable is not set, the data set is expected to in ~/Data/MARIDA_dataset
.
The data set must be uncompressed and the training script will expect for example the file train_X.txt
to be located at
$MARIDA_DATASET/splits/train_X.txt
.
This can be done using the following shell commands:
mkdir -p ~/Data/MARIDA_dataset
cd ~/Data/MARIDA_dataset
wget https://zenodo.org/records/5151941/files/MARIDA.zip
unzip MARIDA.zip
The main scripts are in the src
directory:
litter_classification_train.jl
: train the neural networklitter_classification_validate.jl
: validate a single trained neural networklitter_classification_post.jl
: post-process several validation statistics of different neural networks