Config-driven semantic segmentation framework
Project description
SegCraft
SegCraft is a config-first semantic segmentation toolkit for training, evaluating, and running image/video prediction from the same YAML setup.
Install
pip install segcraft
Install only the extras you need:
pip install "segcraft[torch]" # prediction/training with TorchVision
pip install "segcraft[torch,smp]" # segmentation-models-pytorch
pip install "segcraft[torch,transformers]" # Hugging Face segmentation models
pip install "segcraft[torch,transformers,video]" # video files and YouTube helpers
pip install "segcraft[torch,transformers,video,app]" # optional FastAPI UI
From a checkout:
pip install -e ".[torch,transformers,video,app,dev]"
For NVIDIA GPUs, install the CUDA-enabled PyTorch wheel that matches your system from the PyTorch install page.
CLI
segcraft validate
segcraft predict --preset cityscapes_video --local configs/local.yaml
segcraft train --preset fast_dev --local configs/local.yaml
segcraft evaluate --preset quality --local configs/local.yaml
configs/local.yaml is for machine-specific paths and is ignored by git.
Start from configs/local.example.yaml.
Web App
segcraft-web
Open http://127.0.0.1:8000. The UI accepts either a video upload or a
YouTube URL, lets you choose a preset or type a custom preset path/name, shows
job progress, and exposes downloads for the generated outputs.
Notebooks
notebooks/01_quickstart.ipynb: video prediction demo.notebooks/02_config_and_api.ipynb: config and API basics.notebooks/03_web_app.ipynb: launching the optional FastAPI app.
Presets
SegCraft merges configs in this order:
configs/base.yaml- optional preset
- optional local config
Preset names work in the CLI, Python API, and web app:
fast_dev: tiny CPU training run.quality: longer training settings with scheduler and metrics.binary_quickstart: binary foreground/background setup.pascal_video: TorchVision PASCAL/VOC video prediction.cityscapes_video: SegFormer Cityscapes video prediction.cpu_video_demo: short Cityscapes CPU demo settings.ade20k_video: SegFormer ADE20K video prediction.smp_unet_resnet34: SMP Unet training setup.
task.num_classes controls trainable model heads. task.class_names only
controls display names; if labels are missing or do not match the model,
SegCraft falls back to class_<id> names during prediction.
Python API
from segcraft import load_config, load_config_object, list_available_presets
from segcraft.prediction import run_prediction
print(list_available_presets())
config = load_config("configs/base.yaml", preset_path="cityscapes_video")
typed = load_config_object("configs/base.yaml", preset_path="cityscapes_video")
events = []
summary = run_prediction(config, progress_callback=events.append)
Outputs
Video prediction writes:
original.mp4overlay.mp4comparison.mp4summary.json
Image-folder prediction writes masks, overlays, an optional overlay video, and the same summary metadata.
Development
pip install -e ".[dev]"
pytest
python -m build
twine check dist/*
Publishing uses .github/workflows/release.yml with GitHub trusted publishing.
Configure the PyPI/TestPyPI publisher for owner iodriller, repository
SegCraft-Semantic-Segmentation, workflow release.yml, and environment
pypi, then run the workflow manually for the target repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file segcraft-0.1.1.tar.gz.
File metadata
- Download URL: segcraft-0.1.1.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cea76819c908cbdfcf2fb5138dc17f202fa5f1f47e61ab1a8fe2c59e3d8225a9
|
|
| MD5 |
cadfd3bea9f41248b868171b31f01c99
|
|
| BLAKE2b-256 |
c37158456fea5fb739183148b51ebe234d46a190e9a244498d3fbef673209670
|
Provenance
The following attestation bundles were made for segcraft-0.1.1.tar.gz:
Publisher:
release.yml on iodriller/SegCraft-Semantic-Segmentation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
segcraft-0.1.1.tar.gz -
Subject digest:
cea76819c908cbdfcf2fb5138dc17f202fa5f1f47e61ab1a8fe2c59e3d8225a9 - Sigstore transparency entry: 1500844926
- Sigstore integration time:
-
Permalink:
iodriller/SegCraft-Semantic-Segmentation@4a90dac5e82dc58a9078f7ed8fceb4258b88beac -
Branch / Tag:
refs/heads/master - Owner: https://github.com/iodriller
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a90dac5e82dc58a9078f7ed8fceb4258b88beac -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file segcraft-0.1.1-py3-none-any.whl.
File metadata
- Download URL: segcraft-0.1.1-py3-none-any.whl
- Upload date:
- Size: 47.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cc9220c2eded2c78b9ee550c301f6dd46bf70e9d02f95f61d57d433ca6fadbc
|
|
| MD5 |
0f12c76026a2f8986d8c3f9eddb2a577
|
|
| BLAKE2b-256 |
f22da74e56e96367d26d7346bad39e231595a932658178ff367bf6d0abfe45c7
|
Provenance
The following attestation bundles were made for segcraft-0.1.1-py3-none-any.whl:
Publisher:
release.yml on iodriller/SegCraft-Semantic-Segmentation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
segcraft-0.1.1-py3-none-any.whl -
Subject digest:
9cc9220c2eded2c78b9ee550c301f6dd46bf70e9d02f95f61d57d433ca6fadbc - Sigstore transparency entry: 1500844947
- Sigstore integration time:
-
Permalink:
iodriller/SegCraft-Semantic-Segmentation@4a90dac5e82dc58a9078f7ed8fceb4258b88beac -
Branch / Tag:
refs/heads/master - Owner: https://github.com/iodriller
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a90dac5e82dc58a9078f7ed8fceb4258b88beac -
Trigger Event:
workflow_dispatch
-
Statement type: