Presentation

This repository contains the code of our paper: Weakly-supervised continual learning for class-incremental segmentation.

To use

To install

    conda create -n ICSS python gdal=2.4.4 shapely rtree -c 'conda-forge'
    conda activate ICSS
    pip install -r requirements.txt

Prepare data

The training datasets should be stored in a folder MyDataset organized as follows:

  • a folder named imgs containing the RGB images.
  • a folder named gts containing the ground-truths.

⚠️ Ground-truth files must have the same names than their associated image.

Example for ISPRS Potsdam dataset.

cd <PotsdamDataset>
sudo apt install rename
cd gts; rename 's/_label//' *; cd ../imgs; rename 's/_RGB//' *

The ground-truth maps have to be one-hot encoded (i.e. not in a RGB format):

cd ICSS
python preprocess/format_gt.py -n 6 -d <PathToMyDataset>/gts

To create a sub-folder with only roads and buildings:

python preprocess/roads_buildings.py -d <PathToMyDataset>

To train:

python -m src.train -d /data/gaston/Potsdam/roads_buildings -c configs/some_config.yml

To add a semantic segmentation class:

python -m src.increment_class -d /data/gaston/Potsdam/roads_buildings -c configs/some_config.yml -p data/models/LinkNet34_Potsdam__template.pt

To infer

python -m src.infer -c configs/some_config.yml -o ~/preds -i ~/data/Potsdam/imgs/top_potsdam_7_12.tif  -p data/models/LinkNet34_roads_buildings_template.pt

Licence

Code is released under the MIT license for non-commercial and research purposes only. For commercial purposes, please contact the authors.

See LICENSE for more details.

Acknowledgements

This work has been jointly conducted at Alteia and ONERA-DTIS.

GitHub

View Github