Datasets:
image image |
|---|
DD2600 Integration
Run all commands from the Codebase project root.
Setup
conda create -n DD2600_integration python=3.11.17 -y
conda activate DD2600_integration
SAM2_BUILD_CUDA=0 python -m pip install -r dd2600/Integration/requirements.txt
Place the depth, SAM2 and YOLO model checkpoints in their module checkpoint directories. CLIP downloads its weights on first use if they are not cached.
Run the Pipeline
The default input is inputs/dataset/newdata_ARK. Each sequence must contain RGB images/, frames.csv, ARKit camera data in parameters/, and video/wide.mp4.
Preview the commands without running models:
python dd2600/Integration/run_pipeline.py --sequence 0002 --dry-run
Run a complete sequence using a separate output root:
python dd2600/Integration/run_pipeline.py --sequence 0002 --output-root outputs/pipeline_run
Run only the first 12 frames:
python dd2600/Integration/run_pipeline.py --sequence 0002 --max-frames 12 --output-root outputs/pipeline_test
Use --input to select another ARKit dataset root and --sequence to select its video folder. The default output root is outputs. Existing module outputs stop a full rerun; select a fresh output root to avoid mixing results.
When upstream results already exist, run planning only:
python -m dd2600.planning.code --input inputs/dataset/newdata_ARK --sequence 0002
If those results use a custom output root, pass it to planning with --outputs-root.
Module Responsibilities
| Module | Function |
|---|---|
| Depth | Predicts depth and estimates terrain slope using camera intrinsics and ARKit gravity. |
| SAG tracking | Segments and propagates regions with SAM2, and tracks YOLO targets with forward and backward propagation. |
| Traversability | Uses CLIP to classify tracked regions and generates terrain visualizations. |
| Planning | Combines terrain and slope costs, runs A*, and exports path visualizations as video and GIF. |
| Integration | Prepares camera geometry, runs depth and SAG in parallel, starts traversability after SAG, then runs planning after both branches finish. |
Output Layout
<output-root>/
depth_out/<dataset>/<sequence>_out/
sag_out/<dataset>/<sequence>_out/
tranverse_out/<dataset>/<sequence>_out/
planning_out/<dataset>_out/<sequence>_out/
<dataset> is the input dataset folder name. Final planning videos and GIFs are stored in the sequence's videos/ folder.
Project Overview
Robot Terrain Traversability Planning Using a Camera and Vision Foundation Models KTH DD2600 Robot Learning and Embodied AI, Fall 2026 Kerun Xiang · Zihui Zhu · Ziqi Wang · Ziran Wei
Reaching a goal with only a camera
Task
- Input: video from one phone camera, and a goal object (a backpack)
- Output: where it is safe to walk, and a path to the goal
Constraints
- No depth sensor
- Zero-shot: no training on our terrain
- Stable from frame to frame
Motivation. Recent traversability methods such as ZeST combine 3D LiDAR mapping with LLM-based semantic reasoning in a probabilistic 3D map. This needs 3D sensing, global mapping and a full navigation stack. We instead work entirely in image space with a single monocular camera, so the method can run on any camera-equipped robot and can be evaluated passively on ordinary phone video.
Pipeline
Every camera frame goes through three parallel branches. Goal tracking finds the target, region tracking splits the scene into regions that keep their identity over time, and depth estimation measures distance and slope. CLIP labels each tracked region, the terrain labels and slopes are fused into one cost map, and A* plans a path to the goal.
| Module | Method | Output |
|---|---|---|
| Goal tracking | YOLO at keyframes + SAM2 video in between | Goal mask and goal point |
| Region tracking | SAM2 auto-mask at keyframes + SAM2 video propagation | Region IDs that stay stable over time |
| Traversability | CLIP zero-shot classification of each region | Terrain class per region |
| Depth | Depth Anything V2 Metric Small | Metric depth and surface slope |
| Cost map & planning | Terrain + slope cost map, A* search, integration | Path to the goal, replanned every frame |
Demo
▶️ Results: obstacle avoidance (video)
One frame of the output video (newdata_ARK 0001). Panels, left to right and top to bottom: (1) RGB with blocked areas, the planned path and the goal; (2) predicted depth; (3) CLIP region labels; (4) live top-down map; (5) slope from depth and ARKit gravity; (6) A* cost map (terrain + slope, black = blocked). Objects, unknown regions and invalid geometry are excluded from the search, and the path bends around obstacles toward reachable ground near the goal.
Modules
1. Goal tracking
Idea. YOLO alone misses the bag in many frames, and SAM2 alone drifts over time. Combining them lets each correct the other: YOLO finds the bag at keyframes, and SAM2 follows its mask in between.
Online loop (keyframes t, t+10, …; past frames only). At each keyframe YOLO runs on the frame with every class enabled, then:
- Confirm: if a box sits on the current goal mask, SAM2 is re-seeded inside that box.
- Start: otherwise, if a box of the goal class has confidence ≥ 0.3, a new track starts and SAM2 is seeded inside it.
- Hold: otherwise SAM2 is re-seeded from its own last mask; after more than 5 misses in a row the track is dropped.
SAM2 video then follows the mask through frames t+1 … t+9. The output per frame is the goal mask and the goal point, the bottom middle of the mask, which the planner uses as the target.
Offline pass (after the run). From each new track, SAM2 also tracks backwards in time until the mask is empty. This fills far-away frames where the bag was too small for YOLO. It uses future frames, so it is for evaluation only, not for a robot.
2. Region segmentation and tracking
Goal. Keep the same ID for the same region across frames, while still picking up new things as they appear. Running SAM2 on every frame independently gives new IDs every frame (top right, "Before"); our tracker keeps them stable ("After").
Keyframes (t, t+10, …). SAM2 auto-mask segments everything in the frame. These new segments are merged with the regions that SAM2 video has carried forward from the previous keyframe, using four rules.
In-between frames (t+1 … t+9). SAM2 video only; each pixel takes the best-scoring region, and gaps (no region sure) are filled from the nearest region.
- Keep. Why: the keyframe segmentation cuts the scene differently every time; taking it directly would give new IDs every second. How: at keyframe t, SAM2 is reset and every ID's mask is added as a mask prompt. SAM2 video propagates all masks to t+1 … t+10, and each pixel takes the ID with the highest logit (0 if no logit > 0). At t+10 this propagated map is the starting point. Pixels only change ID through Add or Carve; leftover 0 pixels go to the nearest region.
- Add. Why: new things enter the view, hidden ground appears, or SAM2 drops pixels it is unsure about, so nobody owns these pixels. How: for each new segment S, U = the pixels of S that no propagated mask covers. If U ≥ 50% of S and U ≥ 0.2% of the image, U gets a new ID (Revive is tried first). Only U is claimed; pixels of S inside a mask keep their ID. Otherwise S is skipped here and checked for Carve.
- Carve. Why: SAM2 masks of grass and bushes slowly grow and swallow their neighbours, e.g. a thin trunk ends up inside the bush mask. How: for segment S, find the ID p that owns most of it: inside = S ∩ mask p, rest = mask p − S. Carve if inside ≥ 80% of S, rest > inside (cut the smaller part), and the mean Lab colour of inside and rest differs by > 20. Inside gets a new ID (Revive is tried first); rest keeps p.
- Revive. Why: a region is occluded for a moment, or SAM2 loses it for a few frames; a new ID would split one region into two short tracks. How: IDs that were there at the last keyframe but are gone now go to a lost list, with their last mask and mean colour, for 3 keyframes (30 frames). Whenever Add or Carve would give a new ID, take the lost ID whose last mask overlaps most; if IoU ≥ 0.15 and Lab colour distance < 15, reuse that ID and remove it from the list.
3. Semantic traversability
Region-wise semantic classification: attach a predicted category to each segmented region. For each region:
- Region: use the RGB content of the SAM2 region; region boundaries come from the segmentation stage.
- CLIP: feed the cropped image patches into CLIP with a given set of categories (e.g. asphalt, grass, trees), sampling 5 keyframes uniformly per region.
- Output: keep the region ID with its predicted label, as the semantic input for downstream traversability reasoning.
4. Depth estimation
Depth Anything V2. Frames are sampled every 0.1 s and each frame is predicted independently (examples above: a woodland path and a grass slope, colour scale 0 m to 50+ m). For each sampled frame:
- Input: a single monocular RGB image, resized to 640 px width with the aspect ratio preserved.
- Model: dense depth with DAV2 Metric Small, using the outdoor metric checkpoint, giving depth in metres.
- Depth: an aligned depth map is stored, one float32 value per pixel (camera-axis Z).
- Terrain: depth is back-projected to 3D to compute the local slope. The slope is a proxy that relies on an assumed camera calibration.
5. Cost map and planning
Each cell's cost combines terrain and slope:
C = terrain + λ · min(θ / 45°, 1)², where θ is the surface slope and the current default λ = 100.
- Terrain cost: asphalt 0; dirt 0.4; sand, path and stairs 1; mud 2; puddle 8; gravel 10; water 12; grass 20. Objects, unknown labels and invalid depth are blocked.
- Directional slope cost: uphill keeps the surface-slope penalty; downhill up to 20° has no slope penalty, steeper keeps it.
- A* routing: 8 neighbours with no diagonal corner cutting; step cost = distance × (1 + mean cell cost). The route is replanned every frame. When the goal is unreachable, the planner selects nearby reachable ground as the endpoint.
Limitations
Goal tracking failure cases
- Too far: the bag is too small for YOLO.
- Wrong class: the bag is called a "bear"; the track is kept because the box sits on our mask.
- Person's back: detected as a backpack.
- Leaves the view: the track is dropped.
Semantic traversability failure cases
Wrong labels come either from CLIP misclassifying a region (left) or from a wrong segmentation boundary (right).
Navigation endpoint jumps
When the goal is unreachable, the planner selects nearby reachable ground, and a change in connectivity can move this endpoint abruptly. Between these two frames the goal moves ≈2 pixels, but the navigation endpoint moves ≈81 pixels.
Cost map and path instability
- Independent frame predictions: depth, slope and CLIP labels vary between frames.
- Changing route costs: small changes can alter connectivity and the route chosen by A*.
- Current limitation: there is no temporal fusion of planning costs, so a stable goal does not ensure a stable path.
Descending stairs
- Observed limitation: the path uses the stairs on descent.
- Likely cause: occluded risers leave mostly flat treads visible, so local slope can miss the step height.
- Proposed update: combine slope with depth-based height differences and penalise large jumps between surfaces. This height-jump check is not yet implemented.
Conclusion
- Useful candidate routes: the method generally produces plausible candidate routes in the tested outdoor footage.
- Visual perception can fail: misclassification, lighting and shadows, occlusion, depth errors, and target or pose drift can distort the cost map.
- No absolute safety or feasibility guarantee: a path in the cost map does not prove that a real robot can traverse it safely. Temporal consistency, depth validation and real-world robot tests remain necessary.
Data
- RELLIS-3D
- Our own phone videos, including ARKit-recorded sequences with camera intrinsics and gravity
References
- S. Gummadi et al. ZeST: an LLM-based zero-shot traversability navigation for unknown environments. arXiv:2508.19131, 2025.
- L. Yang et al. Depth Anything V2. NeurIPS 2024.
- N. Ravi et al. SAM 2: Segment Anything in Images and Videos. arXiv:2408.00714, 2024.
- A. Radford et al. Learning Transferable Visual Models From Natural Language Supervision (CLIP). ICML 2021.
- G. Jocher and J. Qiu. Ultralytics YOLO11 (v11.0.0). 2024. https://github.com/ultralytics/ultralytics
- Downloads last month
- 236





