Table of Contents
The marine-anomaly-detection project provides code to apply the state of the art of semi-supervised learning techniques to marine anomaly detection semantic segmentation problems on satellite imagery of marine regions. The considered anomalies are marine-litter (marine debris), ships, clouds, and algae/organic materials.
The code builds on and extends the following two repositories:
- FixMatch-pytorch implementation based on PyTorch. Compared to the original repository, this repository adapts FixMatch to be used for semantic segmentation tasks and to work with multispectral images.
- marine-debris.github.io, which provides the code to work with the MARIDA dataset.
It is recommended to use conda to set-up the environment. conda will take care of all requirements for you. For a detailed list of required packages, please refer to the conda environment file.
- Get micromamba, or Miniconda, or similar. Micromamba is preferred to Miniconda for its greater speed in creating the virtual environment.
- Clone the repo.
git clone https://github.com/lucamarini22/marine-anomaly-detection.git
- Setup and activate the environment. This will create a conda environment called
marine-anomaly-detection
.micromamba env create -f environment.yml
micromamba activate marine-anomaly-detection
- [Optional] Install the local package.
pip install -e .
To launch the training on MARIDA, it is necessary to download the dataset. The dataset can be downloaded here and has the following structure:
patches
: folder containing the patches (multispectral images).splits
: folder containing split files of the training, validation, and test sets.
The --patches_path
and --splits_path
arguments in marineanomalydetection/parse_args_train.py
file shall be respectively point to the patches
and splits
folders.
- Create a Weight and Biases account to keep track of the runs.
- Set the values of the hyperparameters in this config.yaml file.
- Enter the main folder.
cd /marine-anomaly-detection/
- Create a Sweep to keep track of your training runs.
wandb sweep --project <project-name> <config-file.yaml>
- Specify all the values of the arguments in
marineanomalydetection/parse_args_train.py
you did not specify in<config-file.yaml>
. - Start an agent and execute $NUM training runs.
wandb agent --count $NUM <your-entity/sweep-demo-cli/sweepID>
- Evaluate a model.
python evaluation.py --model_path=<path_to_model>
- Visualize the predictions of the last evaluated model by running the cells of the notebook Visualize Predictions.ipynb. Specify the variable
tile_name
to see the predictions for the patches of the specified tile.