lingbot-map-3d-reconstruction
Feed-forward 3D foundation model for streaming scene reconstruction using Geometric Context Transformer
What this skill does
# LingBot-Map 3D Reconstruction Skill
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
LingBot-Map is a feed-forward 3D foundation model that reconstructs scenes from streaming image or video data using a Geometric Context Transformer. It achieves ~20 FPS on 518×378 resolution over sequences exceeding 10,000 frames via paged KV cache attention.
## What It Does
- **Streaming 3D reconstruction** from image sequences or video
- **Feed-forward inference** (no iterative optimization needed)
- **Outputs**: point clouds with per-point confidence, camera poses, depth maps
- **Key features**: anchor context, pose-reference window, trajectory memory for drift correction
## Installation
```bash
# 1. Create environment
conda create -n lingbot-map python=3.10 -y
conda activate lingbot-map
# 2. Install PyTorch (CUDA 12.8)
pip install torch==2.9.1 torchvision==0.24.1 --index-url https://download.pytorch.org/whl/cu128
# 3. Install lingbot-map
git clone https://github.com/Robbyant/lingbot-map.git
cd lingbot-map
pip install -e .
# 4. Install FlashInfer for fast paged KV cache attention (recommended)
pip install flashinfer-python -i https://flashinfer.ai/whl/cu128/torch2.9/
# 5. Optional: visualization support
pip install -e ".[vis]"
# 6. Optional: sky masking for outdoor scenes
pip install onnxruntime # CPU
pip install onnxruntime-gpu # GPU
```
## Model Download
Models available on HuggingFace and ModelScope:
```python
# Download via huggingface_hub
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(
repo_id="robbyant/lingbot-map",
filename="checkpoint.pt"
)
```
Or manually download from:
- HuggingFace: `https://huggingface.co/robbyant/lingbot-map`
- ModelScope: `https://www.modelscope.cn/models/Robbyant/lingbot-map`
## CLI Commands
### Demo with Interactive 3D Viewer (browser at localhost:8080)
```bash
# From image folder
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder /path/to/images/
# From video file
python demo.py --model_path /path/to/checkpoint.pt \
--video_path video.mp4 --fps 10
# Outdoor scene with sky masking
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder /path/to/images/ --mask_sky
# Example scenes included in repo
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder example/church --mask_sky
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder example/oxford --mask_sky
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder example/university4 --mask_sky
```
### Long Sequence Handling
```bash
# Keyframe interval: store every Nth frame in KV cache (saves memory)
# Use when sequence > 320 frames
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder /path/to/images/ --keyframe_interval 6
# Windowed mode: for very long sequences (>3000 frames)
python demo.py --model_path /path/to/checkpoint.pt \
--video_path video.mp4 --fps 10 \
--mode windowed --window_size 64
```
### Without FlashInfer (SDPA fallback)
```bash
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder /path/to/images/ --use_sdpa
```
### Sky Masking with Custom Paths
```bash
python demo.py --model_path /path/to/checkpoint.pt \
--image_folder /path/to/images/ --mask_sky \
--sky_mask_dir /path/to/cached_masks/ \
--sky_mask_visualization_dir /path/to/mask_viz/
```
## CLI Arguments Reference
### Input
| Argument | Description |
|:---|:---|
| `--model_path` | Path to model checkpoint (.pt file) |
| `--image_folder` | Directory of input images |
| `--video_path` | Input video file path |
| `--fps` | Frames per second to sample from video |
### Inference Mode
| Argument | Default | Description |
|:---|:---|:---|
| `--mode` | `streaming` | `streaming` or `windowed` |
| `--window_size` | `64` | Window size for windowed mode |
| `--keyframe_interval` | `1` | Store every Nth frame in KV cache |
| `--use_sdpa` | `False` | Use PyTorch SDPA instead of FlashInfer |
### Sky Masking
| Argument | Description |
|:---|:---|
| `--mask_sky` | Enable sky segmentation and masking |
| `--sky_mask_dir` | Custom directory for cached sky masks |
| `--sky_mask_visualization_dir` | Save side-by-side mask visualizations |
### Visualization
| Argument | Default | Description |
|:---|:---|:---|
| `--port` | `8080` | Viser viewer port |
| `--conf_threshold` | `1.5` | Filter low-confidence points |
| `--point_size` | `0.00001` | Point cloud point size |
| `--downsample_factor` | `10` | Spatial downsampling for display |
## Python API Usage
### Basic Streaming Inference
```python
import torch
from lingbot_map import LingBotMap # adjust import to actual module structure
# Load model
device = "cuda" if torch.cuda.is_available() else "cpu"
model = LingBotMap.from_pretrained("/path/to/checkpoint.pt")
model = model.to(device).eval()
# Streaming inference over image list
from pathlib import Path
from PIL import Image
import torchvision.transforms as T
transform = T.Compose([
T.Resize((378, 518)),
T.ToTensor(),
T.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
image_paths = sorted(Path("/path/to/images").glob("*.jpg"))
with torch.no_grad():
for img_path in image_paths:
img = Image.open(img_path).convert("RGB")
frame = transform(img).unsqueeze(0).to(device)
output = model.stream(frame)
# output contains: pointmap, confidence, camera pose
```
### Loading and Running the Demo Programmatically
```python
# The demo.py script is the primary entry point
# Run it as a subprocess or study it for API patterns
import subprocess
result = subprocess.run([
"python", "demo.py",
"--model_path", "/path/to/checkpoint.pt",
"--image_folder", "example/church",
"--mask_sky",
"--port", "8080"
], check=True)
```
### Video Input Pattern
```python
import cv2
import torch
# Extract frames from video for batch processing
def extract_frames(video_path: str, fps: int = 10):
cap = cv2.VideoCapture(video_path)
video_fps = cap.get(cv2.CAP_PROP_FPS)
interval = max(1, int(video_fps / fps))
frames = []
frame_idx = 0
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
if frame_idx % interval == 0:
# Convert BGR to RGB
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
frames.append(frame_rgb)
frame_idx += 1
cap.release()
return frames
frames = extract_frames("video.mp4", fps=10)
```
## Common Patterns
### Pattern 1: Outdoor Scene Reconstruction
```bash
# Always use --mask_sky for outdoor scenes to remove noisy sky points
python demo.py \
--model_path ./checkpoint.pt \
--image_folder ./outdoor_images \
--mask_sky \
--conf_threshold 2.0 \
--downsample_factor 5
```
### Pattern 2: Long Indoor Sequence
```bash
# Use keyframe_interval to manage KV cache for sequences 320-3000 frames
python demo.py \
--model_path ./checkpoint.pt \
--image_folder ./long_sequence \
--keyframe_interval 6 \
--conf_threshold 1.5
```
### Pattern 3: Very Long Video (>3000 frames)
```bash
# Use windowed mode for extremely long sequences
python demo.py \
--model_path ./checkpoint.pt \
--video_path long_video.mp4 \
--fps 5 \
--mode windowed \
--window_size 64
```
### Pattern 4: High Quality Dense Reconstruction
```bash
# Lower conf_threshold keeps more points, smaller downsample shows more detail
python demo.py \
--model_path ./checkpoint.pt \
--image_folder ./images \
--conf_threshold 1.0 \
--downsample_factor 1 \
--point_size 0.00005
```
### Pattern 5: CPU / No FlashInfer Fallback
```bash
# When FlashInfer is unavailable, use SDPA
python demo.py \
--model_path ./checkpoint.pt \
--image_folder ./images \
--use_sdpa
```
## Architecture Concepts
| Component | Role |
|:---|:---|
| **Anchor Context** | CoordinRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.