Skip to main content

Segment (georeferenced) raster data in an interactive fashion. Retrain models in seconds. Only small amounts of labeled data necessary because of our use of pretrained base models as feature extractors.

Project description

workflow pypi badge Documentation Status build

icon

Pycoeus

Segment (georeferenced) raster data in an interactive fashion. Retrain models in seconds. Only small amounts of labeled data necessary because of our use of pretrained base models as feature extractors. Pycoeus can be used as a standalone commandline tool or as the backend for the QGIS plugin called CoeusAI.

The project setup is documented in project_setup.md.

Typical usage

Let's say you've got the image on the left, along with the labels (superimposed on the image) on the right.

image image

You run the commandline tool as follows, selecting both input image and labels, the path where the output should be, and the type of features to use.

python main.py --input image.tif --labels labels.tif --predictions output.tif

The resulting output looks like:

image

To test this with our testdata, run:

python src/pycoeus/main.py --input tests/test_data/test_image.tif -l tests/test_data/test_image_labels.tif -p output.tif

Installation

There are 2 ways to install pycoeus. Either run:

pip install pycoeus

Or run:

git clone git@github.com:DroneML/pycoeus.git
cd pycoeus
python -m pip install .

Logging

The application writes logs to the 'logs' dir, which will be created if it doesn't exist yet. Messages printed to the screen (stdout) are stored in info.log for later reference. More detailed information, such as input data shapes and value distributions, are written to debug.log.

Train a feature extraction model

To train a feature extraction model run the script "train_model.py" in this repo:

python ./src/pycoeus/utils/train_model.py -r ../monochrome_flair_1_toy_dataset_flat/ --train_set_limit 10

This assumes a 'flat', grayscale, version of the FLAIR1 dataset is present at the selected root location.

root
- train
    - input
        - IMG_061946_0.tif
        - IMG_061946_1.tif
        - ...
    - labels
        - MSK_061946_0.tif
        - ...    

Use the script 'monochromize.py' to create greyscale (single band) tifs for every multiband tif in a source folder:

python ./src/pycoeus/utils/monochromize.py -i ../flair_1_toy_dataset/ -o ../monochrome_flair_1_toy_dataset/

Credits

This package was created with Copier and the NLeSC/python-template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycoeus-0.4.1.tar.gz (4.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycoeus-0.4.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file pycoeus-0.4.1.tar.gz.

File metadata

  • Download URL: pycoeus-0.4.1.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pycoeus-0.4.1.tar.gz
Algorithm Hash digest
SHA256 9e38b6082a27f34d251c01c0acd6f4cc61a659bdb90d488f327f5908a579fb96
MD5 a9212e6fce911240f37ce758529f0c48
BLAKE2b-256 1e89d9b53ca8c9c863bd3b891f637a6154e268966bddeb10f558064c250c2db2

See more details on using hashes here.

File details

Details for the file pycoeus-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: pycoeus-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pycoeus-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4380fa35ed0fdfc4fae5b79d0b7bb470b3c78709e514f5a5bce137d04aef4cda
MD5 4bc122a725a24501737d7df30a324f4d
BLAKE2b-256 456794d4b7b6066b372aef39c413bb2e9f1fa9fd34b616a1a36f45abb17a1de6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page