Skip to content

tldr-group/interactive-seg-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

interactive-seg-backend

Generic backend for interactive feature-based segmentation in python.

Installation:

To install:

git clone https://github.com/tldr-group/interactive-seg-backend
cd interactive-seg-backend
pip install .
# requires some extra build steps
pip install --no-build-isolation "pydensecrf @ git+https://github.com/lucasb-eyer/pydensecrf.git"

Pip:

For GPU-enabled featurising (recommended), install with:

pip install '.[gpu]'

For development (linters, tests), install with

pip install -e '.[lint,test]'

To get all the optional dependencies at once:

pip install '.[all]'

UV:

curl -LsSf https://astral.sh/uv/install.sh | sh
# restart your shell
uv sync --extra gpu
uv pip install --no-build-isolation "pydensecrf @ git+https://github.com/lucasb-eyer/pydensecrf.git"
uv sync --all-extras 
uv pip install --no-build-isolation "pydensecrf @ git+https://github.com/lucasb-eyer/pydensecrf.git"

Benchmark

mkdir tmp
python -m cProfile -s tottime interactive_seg_backend/features/multiscale_classical_cpu.py > tmp/bench.txt

Tests

Requires the pytest package (pip install '.[test]')

mkdir tests/data
curl -o tests/data/feature-stack.tif https://sambasegment.blob.core.windows.net/resources/isb_test_data/feature-stack.tif
pytest -s

Install locally (i.e for dev)

pip uninstall interactive_seg_backend -y
pip install -e . --no-cache-dir

If offline

pip uninstall interactive_seg_backend -y
pip install . --no-cache-dir --no-index

TODO:

  • logging

  • docstrings

  • make typing story more compelling:

    • helper typesafe functions?
    • pydantic?
    • actually make the main functions able to take in tensors or arrays
    • or give up and make separate functions where necesarry
    • make core vs main distinction make more sense
      • make CPU version still work with conditional imports and string quote types
      • export everything important from main / init
      • pass down things you care about i.e sample weights into train / train and apply
  • improvements: fixed vf, rules (connectivity) ?

  • applying: patched, 3D (+ average), all with memory consideration (caching)

About

Generic backend for interactive feature-based segmentation in python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages