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. Segmentmytif can be used as a standalone commandline tool or as the backend for the QGIS plugin called DroneML.
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.
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:
To test this with our testdata, run:
python src/segmentmytif/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 Segmentmytif. Either run:
pip install segmentmytif
Or run:
git clone git@github.com:DroneML/segmentmytif.git
cd segmentmytif
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/segmentmytif/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/segmentmytif/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.
Metadata
Release files for segmentmytif 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| segmentmytif-0.3.0.tar.gz | 4.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| segmentmytif-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.7 MB
Release files / segmentmytif-0.3.0.tar.gz
| Download URL | segmentmytif-0.3.0.tar.gz |
|---|---|
| Size | 4.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3033f55afa83516fd6f23a6d88fe83f457919dfd488ffcf63cfdf677087d1caf
|
|
BLAKE2b-256 checksum How to use checksums |
c72d1f4b76a45ec60f9eeeafc5ae49b4f99158f40b457bbec6ff660e6e4748e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / segmentmytif-0.3.0-py3-none-any.whl
| Download URL | segmentmytif-0.3.0-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fd80557b7ab4848f4391873fff51590c097caf5f946f70ad60fafa086c00de1
|
|
BLAKE2b-256 checksum How to use checksums |
96647999b31ba45490e6efb50225f1fe4eedf376145007ef3d2613793a42e83f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|