Skip to main content

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.

SegCraft GPU demo: original dashcam video beside semantic segmentation overlay

Install

Use an isolated environment. Installing ML/video stacks into a global or Conda base Python can make pip upgrade unrelated packages and produce dependency conflicts.

python --version

If this opens the Microsoft Store or says Python was not found, install Python from https://python.org with python.exe on PATH, or run the commands from Anaconda Prompt.

python -m venv segcraft-env
.\segcraft-env\Scripts\activate
python -m pip install --upgrade pip
python -m pip install segcraft

For the browser UI from PyPI:

python -m pip install "segcraft[web]"
segcraft doctor
segcraft-web

Other extras:

python -m pip install "segcraft[torch]"                    # prediction/training with TorchVision
python -m pip install "segcraft[torch,smp]"                # segmentation-models-pytorch
python -m pip install "segcraft[torch,transformers]"       # Hugging Face segmentation models
python -m pip install "segcraft[torch,transformers,video]" # video files and YouTube helpers

From a checkout:

python -m pip install -e ".[web,dev]"

For NVIDIA GPUs, install the CUDA-enabled PyTorch wheel that matches your system from the PyTorch install page, then run:

segcraft doctor

segcraft doctor reports the Python executable, Torch version, CUDA build, CUDA availability, visible GPU names, and NumPy/OpenCV import checks. If it reports CUDA available: False, launch SegCraft from the environment where Torch can see CUDA, or keep runtime.device: auto so SegCraft falls back to CPU instead of failing.

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, shows the active Torch/CUDA runtime, and exposes downloads for the generated outputs. YouTube downloads are cached under outputs/web by URL and format, and running jobs can be stopped from the UI.

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:

  1. configs/base.yaml
  2. optional preset
  3. 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_fast_video: faster TorchVision PASCAL/VOC video prediction.
  • pascal_video: TorchVision PASCAL/VOC video prediction.
  • pascal_quality_video: larger TorchVision PASCAL/VOC video prediction.
  • cityscapes_video: SegFormer Cityscapes video prediction.
  • cityscapes_quality_video: larger SegFormer Cityscapes video prediction.
  • cpu_video_demo: short Cityscapes CPU demo settings.
  • ade20k_video: SegFormer ADE20K video prediction.
  • ade20k_quality_video: larger 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.

For more pretrained models, use Hugging Face semantic-segmentation model IDs with model.backend: transformers, TorchVision segmentation model names with model.backend: torchvision, or SMP architectures/encoders with model.backend: smp:

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.mp4
  • overlay.mp4
  • comparison.mp4
  • summary.json

Image-folder prediction writes masks, overlays, an optional overlay video, and the same summary metadata.

Development

python -m pip install -e ".[web,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


Download files

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

Source Distribution

segcraft-0.1.4.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

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

segcraft-0.1.4-py3-none-any.whl (54.5 kB view details)

Uploaded Python 3

File details

Details for the file segcraft-0.1.4.tar.gz.

File metadata

  • Download URL: segcraft-0.1.4.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for segcraft-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2344634f124558e680c2c492a1f1f6962ef9958d5571f41562c206984a419868
MD5 1afcf96de1e79c0184d95f5d4fd0a1f8
BLAKE2b-256 5d007be18ba370ac6e4c87aac15cdacb7718a404a7a4165516dab3f7514d7659

See more details on using hashes here.

Provenance

The following attestation bundles were made for segcraft-0.1.4.tar.gz:

Publisher: release.yml on iodriller/SegCraft-Semantic-Segmentation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file segcraft-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: segcraft-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 54.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for segcraft-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 690b1e0b3abae7f3c18767b4c4bdf7f0b6879a900d78b28f2241ef3f81be6a37
MD5 cdef9e6b883b9b0e5ec3b3ccb15bad76
BLAKE2b-256 4a03a364b3a8d035196a308a137e8bdbc281764cb18b7eb6234b7357ab422ee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for segcraft-0.1.4-py3-none-any.whl:

Publisher: release.yml on iodriller/SegCraft-Semantic-Segmentation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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