deepfly3d-app / scripts /smoke.py
katospiegel's picture
Deploy deepfly3d-app as an imaging-plaza Gradio Space (SDSC)
c2b902d verified
Raw
History Blame Contribute Delete
903 Bytes
"""Contract smoke test: make the example, reconstruct 3D, save the summary."""
from __future__ import annotations
import json
import sys
from PIL import Image
from core.io import APP_TMP_DIR
from core.processing import simulate_full
def main() -> int:
tif = APP_TMP_DIR / "example.tif"
if not tif.exists():
import scripts.make_example as me
me.main()
r = simulate_full(str(tif), engine="fast", fps=20.0)
rep = r["report"]
assert r["summary"].ndim == 3 and r["summary"].shape[2] == 3
assert rep["keypoints_3d_tracked_fraction"] > 0.8, "3D reconstruction failed"
assert rep["mean_reprojection_error_px"] < 3.0, "triangulation inaccurate"
Image.fromarray(r["summary"]).save(APP_TMP_DIR / "smoke_summary.png")
print("REPORT:", json.dumps({k: v for k, v in rep.items() if k != "legs"}))
return 0
if __name__ == "__main__":
sys.exit(main())