This repo is the poster-demo bundle for DetectiveSAM. It is intentionally narrow: inference only, bundled checkpoints, and a small set of ready-to-run examples for live demos.
- Inference checkpoints under
checkpoints/ - SAM2 config under
sam2configs/ - Poster demo pairs under
demo/cocoglide/,demo/flux_test/, anddemo/qwen_test/ - A drop-in single-image slot at
demo/user_image/demo_input.png
Built-in checkpoint aliases:
detective_samdetective_sam_sota
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtThen add the SAM2 Hiera Base Plus checkpoint at:
sam2configs/sam2.1_hiera_base_plus.pt
The expected path is also documented in sam2configs/README.md.
Place your image at demo/user_image/demo_input.png, then run:
python -m detectivesam_inference.predict \
--checkpoint detective_sam \
--output-dir outputs/poster_user_imageIn this mode the CLI reuses the target image as its own source reference so the demo stays runnable with a single image.
If demo/user_image/demo_input.png is absent, the default predict command falls back to the bundled CocoGlide sample banana_28809.
python -m detectivesam_inference.predict \
--checkpoint detective_sam \
--output-dir outputs/poster_baselineFlux example:
python -m detectivesam_inference.predict \
--checkpoint detective_sam_sota \
--source demo/flux_test/source/548.png \
--target demo/flux_test/target/548.png \
--mask demo/flux_test/mask/548.png \
--output-dir outputs/poster_fluxQwen example:
python -m detectivesam_inference.predict \
--checkpoint detective_sam_sota \
--source demo/qwen_test/source/166.png \
--target demo/qwen_test/target/166.png \
--mask demo/qwen_test/mask/166.png \
--output-dir outputs/poster_qwenEach predict run writes a compact set of visual artifacts plus a JSON summary:
<name>_comparison.png<name>_probability.png<name>_pred_mask.png<name>_pred_overlay.png<name>_summary.json
If a ground-truth mask is provided, the run also saves:
<name>_gt_mask.png<name>_gt_overlay.png
The evaluate command writes summary.json plus a few visualization examples under visualizations/.
- The runtime selects
cudaautomatically when available and otherwise runs on CPU. - Checkpoint settings come from the YAML sidecars in
checkpoints/; you only need the alias or checkpoint path. - The public repo does not bundle
sam2configs/sam2.1_hiera_base_plus.pt; add that file locally before running inference. - This repo does not include training code or training-only dependencies.