Views
No views yet
| Input (BW) | Colorized Output |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
1# Install dependencies
2pip install -r requirements.txt
3
4# Single image
5python inference.py --input input/bw1.jpg
6
7# All images in a folder
8python inference.py --input input/
9
10# Custom output folder
11python inference.py --input input/ --output_dir output/
12
13# Custom inference resolution
14python inference.py --input input/ --infer-size 1024| Argument | Required | Default | Description |
|---|---|---|---|
--input | Yes | - | Input grayscale image or folder |
--onnx-model | No | models/v6_generator.onnx | Generator ONNX model path |
--sam-onnx | No | models/v6_sam_encoder.onnx | SAM 2.1 encoder ONNX path |
--output_dir | No | ./output/ | Output folder for colorized images |
--infer-size | No | 768 | Inference resolution (square) |
--ort-device | No | cpu | ONNX Runtime device (cpu or cuda) |
The model was trained at 512×512 pixels. Inference currently runs at 768×768 pixels by default.More the inference resolution differs from 512×512, the less faithful the colors will be.For best results, use the training resolution:bash1# Best color accuracy, but lower resolution — matches training resolution 2python inference.py --input input/ --infer-size 512 3 4# Default (good quality) 5python inference.py --input input/ 6 7# Higher resolution (may reduce color accuracy) 8python inference.py --input input/ --infer-size 1024
Input (grayscale) → Resize to infer-size → SAM 2.1 (zeros) → Generator ONNX → Resize to originalrequirements.txt for full list.