Thread is an image pipeline.
It takes one image.
It makes tiles.
It can upscale tiles.
It can stitch tiles back into one image.
It has a local API.
| Part | State |
|---|---|
| Python API | Active |
| Upload image | Active |
| Make tiles | Active |
| CPU upscale fallback | Active |
| Stitch output | Active |
| C preprocessor | Active |
| CUDA | Optional |
| Metal | Optional |
The default path is CPU.
CUDA and Metal are not needed for the local flow.
Install tools.
bash scripts/setup.shWhat the setup script does:
| Area | Default |
|---|---|
| macOS | Homebrew, CMake, Ninja, Xcode command line tools |
| Linux | apt packages for CMake, Ninja, Python, Git |
| Windows | Chocolatey packages for CMake, Ninja, Python, Git |
| Python | venv, requirements, test and lint tools |
| Native OpenCV | Off |
| Metal tools | Off |
| CUDA install | Off |
Optional setup:
| Need | Command |
|---|---|
| Native OpenCV packages | INSTALL_NATIVE_OPENCV=true bash scripts/setup.sh |
| Apple Metal tools | WITH_METAL=ON bash scripts/setup.sh |
| CUDA toolkit on Linux | INSTALL_CUDA=true bash scripts/setup.sh |
Build CPU path.
cmake -S . -B build -DUSE_CUDA=OFF -DWITH_OPENCV=OFF -DWITH_METAL=OFF -DENABLE_BENCHMARK=OFF
cmake --build build --parallel
ctest --test-dir build --output-on-failureRun Python tests.
python -m pytestRun full image flow.
python scripts/e2e.pyStart API.
python api/server.pyAPI: http://localhost:5001.
Version: v1.
Upload an image:
curl -X POST http://localhost:5001/v1/images \
-F "file=@image.jpg"Create tiles:
curl -X POST http://localhost:5001/v1/images/<image_id>/tiles \
-H "Content-Type: application/json" \
-d '{"tile_size": 512}'Upscale a tile:
curl -X POST http://localhost:5001/v1/tiles/<tile_id>/upscale \
-H "Content-Type: application/json" \
-d '{"scale": 2}'Stitch tiles:
curl -X POST http://localhost:5001/v1/stitch \
-H "Content-Type: application/json" \
-d '{"tile_ids": ["tile_0", "tile_1", "tile_2", "tile_3"], "rows": 2, "cols": 2}'Use WITH_METAL=ON only with Apple Metal tools.
Use USE_CUDA=ON only with CUDA.
The default build keeps both off.
| Path | Use |
|---|---|
api/ |
Flask API |
src/ |
Local preprocess and Metal code |
cloud_gpu/ |
CUDA code |
scripts/ |
Setup, tests, image flow |
tests/ |
C and Python tests |
docs/ |
Notes and small site |
| Check | State |
|---|---|
| Build | Active |
| Tests | Active |
| Release check | Active |
| Docs deploy | Active |
| Extra workflows | Manual or slash command |
BSD 3-Clause. See LICENSE.
