bdck's picture
Upload example/demo.py
8a1ba16 verified
"""
One-click demo: creates a synthetic sphere point cloud and runs the full pipeline.
Perfect for beginners who want to see it work immediately.
Usage:
python example/demo.py
"""
import subprocess
import sys
import os
# 1. Generate synthetic data
print("=" * 60)
print("Step 1: Creating a synthetic sphere point cloud...")
print("=" * 60)
result = subprocess.run([sys.executable, os.path.join(os.path.dirname(__file__), "make_sphere.py")])
if result.returncode != 0:
print("Failed to generate sphere. Aborting.")
sys.exit(1)
# 2. Run the pipeline with reduced iterations for speed
print("\n" + "=" * 60)
print("Step 2: Running LightweightMR (reduced quality for speed)...")
print(" This will take ~5–15 minutes on CPU, ~1 minute on GPU.")
print("=" * 60)
cmd = [
sys.executable, "-m", "lightweightmr",
"-i", "example/sphere.ply",
"-o", "example/sphere_mesh.ply",
"--device", "cpu",
"--sdf-iters", "5000",
"--vg-iters", "2000",
"--vertices", "800",
]
print(f"Command: {' '.join(cmd)}\n")
result = subprocess.run(cmd)
if result.returncode != 0:
print("Pipeline failed. See error above.")
sys.exit(1)
print("\n" + "=" * 60)
print("SUCCESS!")
print("=" * 60)
print(f" Input: example/sphere.ply")
print(f" Output: example/sphere_mesh.ply")
print("\nOpen the mesh in Blender, MeshLab, or Windows 3D Viewer.")
print("For better quality, re-run with more iterations:")
print(" python -m lightweightmr -i example/sphere.ply -o example/sphere_mesh.ply --sdf-iters 20000 --vg-iters 8000 --vertices 3400")