point-cloud-registration / scripts /inspect_3dmatch.py
duytranus's picture
feat: Add point cloud registration demo using Open3D and Gradio
37ee115
#!/usr/bin/env python3
"""
Inspect 3DMatch redkitchen dataset
"""
import os
import sys
from pathlib import Path
def inspect_redkitchen(raw_root):
"""Inspect redkitchen dataset"""
raw_root = Path(raw_root)
if not raw_root.exists():
print(f"Error: {raw_root} does not exist")
return False
scene_dir = raw_root / '7-scenes-redkitchen'
eval_dir = raw_root / '7-scenes-redkitchen-evaluation'
ply_files = []
log_files = []
print("=== 3DMatch Redkitchen Inspection ===\n")
# Check scene folder
if scene_dir.exists():
print(f"βœ“ Scene folder: {scene_dir.name}")
for root, dirs, files in os.walk(scene_dir):
for f in files:
if f.endswith('.ply'):
ply_files.append(Path(root) / f)
else:
print(f"βœ— Scene folder not found: {scene_dir}")
return False
# Check evaluation folder
if eval_dir.exists():
print(f"βœ“ Evaluation folder: {eval_dir.name}")
for root, dirs, files in os.walk(eval_dir):
for f in files:
if f.endswith('.log'):
log_files.append(Path(root) / f)
else:
print(f"βœ— Evaluation folder not found: {eval_dir}")
return False
print(f"\nPLY files: {len(ply_files)}")
if ply_files:
for ply in sorted(ply_files)[:5]:
print(f" - {ply.relative_to(raw_root)}")
if len(ply_files) > 5:
print(f" ... and {len(ply_files) - 5} more")
print(f"\nLog files: {len(log_files)}")
for log in sorted(log_files):
print(f" - {log.relative_to(raw_root)}")
# Validation
success = True
if len(ply_files) == 0:
print("\nβœ— No .ply files found!")
success = False
else:
print(f"\nβœ“ Found {len(ply_files)} point clouds")
if len(log_files) == 0:
print("βœ— No evaluation .log files found!")
success = False
else:
print(f"βœ“ Found {len(log_files)} evaluation log(s)")
return success
if __name__ == '__main__':
raw_root = sys.argv[1] if len(sys.argv) > 1 else 'data/raw/3dmatch'
success = inspect_redkitchen(raw_root)
sys.exit(0 if success else 1)