Upload example/demo.py
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748"""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 subprocessimport sysimport os
# 1. Generate synthetic dataprint("=" * 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 speedprint("\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")example/demo.pyAdded+48