Skip to content

Latest commit

 

History

84 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SegCraft logo

SegCraft

Train, evaluate, and run semantic segmentation from one YAML configuration.

CI status PyPI version MIT license Python 3.11+

SegCraft GPU demo: original dashcam video beside semantic segmentation overlay

Choose a preset and use it through the CLI, Python API, or web app.

SegCraft is alpha software. Its Python API and configuration schema can still change.

Quick start

pip install "segcraft[web]"
segcraft-web          # open http://127.0.0.1:8000

Upload a video or provide a YouTube URL, choose a preset, and download the original, overlay, and side-by-side output videos. By default, runtime.device: auto uses an NVIDIA GPU when a CUDA-enabled PyTorch build is available and falls back to CPU otherwise. The first prediction may download pretrained model weights; choose pascal_fast_video for a smaller model.

From a checkout, the launchers set up the environment and open the app:

./run.sh       # Linux; macOS: ./run.command

On Windows, use .\run.bat. When it finds an NVIDIA GPU it installs the matching CUDA build of PyTorch for you (a large download the first time; set SEGCRAFT_CPU_ONLY=1 to keep the CPU build). With pip, install the CUDA-enabled PyTorch wheel that matches your system first. Run segcraft doctor to confirm what Torch and CUDA can see.

What it does

  • Use TorchVision, segmentation-models-pytorch, or Hugging Face SegFormer models through one interface.
  • Run image or video prediction. Video output includes original.mp4, overlay.mp4, comparison.mp4, and summary.json.
  • Use the same presets in the CLI, Python API, and web app.
  • Validate configuration and inspect the actual Torch, CUDA, and device state with segcraft validate and segcraft doctor.

Common commands

segcraft validate works with the packaged defaults. For the other examples, first copy configs/local.example.yaml to configs/local.yaml and set your machine-specific paths; an explicitly supplied local config must exist.

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 ignored by Git.

Useful presets include fast_dev for a small CPU training run, binary_quickstart for foreground/background work, and the Cityscapes, ADE20K, PASCAL VOC, and SMP examples. task.num_classes controls the trainable model head; task.class_names only controls display labels.

Python and notebooks

After installing segcraft[web], supply your own video path. The first run may download the preset's pretrained weights:

from segcraft import load_config
from segcraft.prediction import run_prediction

config = load_config(preset_path="cityscapes_video")
config["predict"]["input_path"] = "path/to/your/video.mp4"
config["predict"]["output_path"] = "outputs/prediction"
summary = run_prediction(config)

The notebooks provide a quick start, configuration and API guide, and web-app guide.

For optional model extras, Docker, presets, output formats, and development setup, see the installation and reference guide. Changes are recorded in the Changelog.

MIT licensed. Built by Oney Erge.

Releases

Packages

Used by

Contributors

Languages