Skip to content
Snippets Groups Projects

PySegCNN: Image segmentation with convolutional neural networks in Python

pysegcnn is a Python package to build deep fully convolutional neural networks for semantic image segmentation. The package is primarily designed to work with multispectral satellite imagery. pysegcnn is based on the machine learning framework PyTorch.

Installation

Requirements

pysegcnn requires Python>=3.7. The list of dependencies, in addition to PyTorch , is defined in environment.yml and requirements.txt.

Download

You can download pysegcnn from this repository's website or alternatively use git from terminal:

git clone https://gitlab.inf.unibz.it/REMSEN/ccisnow/pysegcnn.git

This creates a copy of the repository in your current directory on the file system.

Conda package manager

To install pysegcnn, I recommend to use the conda package manager. You can download conda here. Once successfully installed conda, I recommend to add conda-forge as your default channel:

conda config --add channels conda-forge

Conda environment

To install pysegcnn, I recommend to create a specific conda environment, by using the provided environment.yml file. In a terminal, navigate to the cloned git repositories root directory and type:

conda env create -f environment.yml

This may take a while. The above command creates a conda environment with all required dependencies except the pytorch package. The first line in environment.yml defines the environment name, in this case pysegcnn. Activate your environment using:

conda activate pysegcnn

Alternatively, use the requirements.txt file to install the dependencies in an existing conda environment:

conda install --file requirements.txt

Install PyTorch

The installation of pytorch is heavily dependent on the hardware of your machine. Therefore, after activating your environment, install the version of PyTorch that your system supports by following the official instructions.

If you have to build pytorch from source, follow this guide.

To verify the installation, run some sample PyTorch code.

Install PySegCNN

To finally install pysegcnn run the below command from this repositories root directory within the activated ``pysegcnn`` conda environment:

pip install -e .

If successful, you should be able to import pysegcnn from any Python interpreter using:

import pysegcnn

Datasets

Currently, the following publicly available satellite imagery datasets are supported out-of-the-box:

Contact

For further information or ideas for future development please contact: daniel.frisinghelli@gmail.com.

License

If not explicitly stated otherwise, this repository is licensed under the GNU GENERAL PUBLIC LICENSE v3.0 (see LICENSE).

Acknowledgements

I wrote a part of the code base for the pysegcnn package while I was working at the Institute for Earth Observation of Eurac Research, Bolzano.