Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,103 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- robotics
|
| 7 |
+
- motion-planning
|
| 8 |
+
- segmentation
|
| 9 |
+
- unet
|
| 10 |
+
- topological-traps
|
| 11 |
+
- viability-prediction
|
| 12 |
+
- non-holonomic
|
| 13 |
+
pipeline_tag: image-segmentation
|
| 14 |
+
datasets:
|
| 15 |
+
- DanielDDDs/topological-traps-dataset
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# Neural Prediction of Heading-Dependent Topological Traps
|
| 19 |
+
|
| 20 |
+
**TAU Algorithmic Robotics - Fall 2025/2026 - Daniel Simanovsky**
|
| 21 |
+
|
| 22 |
+
A U-Net model that predicts directional viability maps for non-holonomic robot navigation:
|
| 23 |
+
given a 2D occupancy grid and robot dimensions, the model outputs four binary masks (N/S/E/W)
|
| 24 |
+
indicating which pixels are topological traps - cells the robot can enter but cannot escape
|
| 25 |
+
by translating in that heading without first rotating.
|
| 26 |
+
|
| 27 |
+
## Models in this repo
|
| 28 |
+
|
| 29 |
+
| File | Description | Val IoU |
|
| 30 |
+
|---|---|---|
|
| 31 |
+
| `models/viability_cardinal_best_iou.pth` | Cardinal model - 3-ch input, 4-ch binary output (N/S/E/W) | 0.9793 |
|
| 32 |
+
| `models/viability_continuous_angle_best_iou.pth` | Angle model - 5-ch input (sin/cos theta), 1-ch arbitrary heading | 0.984 |
|
| 33 |
+
| `configs/training_config.yaml` | Training configuration | - |
|
| 34 |
+
|
| 35 |
+
## Architecture
|
| 36 |
+
|
| 37 |
+
- Backbone: U-Net with ResNet34 encoder (ImageNet pre-trained), ~24.5M parameters
|
| 38 |
+
- Input: 3-channel tensor - binary occupancy grid + normalised robot L/512, W/512
|
| 39 |
+
- Output: 4-channel sigmoid map, one per cardinal direction
|
| 40 |
+
- Training: AdamW (lr=1e-4, wd=1e-4), CosineAnnealingLR, BCE+Dice loss, FP16, batch 16, 50 epochs
|
| 41 |
+
|
| 42 |
+
## Results
|
| 43 |
+
|
| 44 |
+
| Metric | Value |
|
| 45 |
+
|---|---|
|
| 46 |
+
| IoU (seen sizes) | 0.978 |
|
| 47 |
+
| IoU (unseen size 25x18) | 0.953 |
|
| 48 |
+
| Generalisation gap | 0.025 |
|
| 49 |
+
| Inference time | 8.8 ms/map (GPU) |
|
| 50 |
+
| Oracle speedup | 21.5x |
|
| 51 |
+
| PRM trap reduction | 81% |
|
| 52 |
+
|
| 53 |
+
## Quick start
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import torch, numpy as np
|
| 57 |
+
from huggingface_hub import hf_hub_download
|
| 58 |
+
import segmentation_models_pytorch as smp
|
| 59 |
+
|
| 60 |
+
ckpt_path = hf_hub_download(
|
| 61 |
+
repo_id="DanielDDDs/topological-traps",
|
| 62 |
+
filename="models/viability_cardinal_best_iou.pth"
|
| 63 |
+
)
|
| 64 |
+
model = smp.Unet(encoder_name="resnet34", encoder_weights=None, in_channels=3, classes=4)
|
| 65 |
+
state = torch.load(ckpt_path, map_location="cpu")
|
| 66 |
+
model.load_state_dict(state["model_state_dict"])
|
| 67 |
+
model.eval()
|
| 68 |
+
|
| 69 |
+
def predict(occupancy, robot_L=30, robot_W=20):
|
| 70 |
+
x = np.zeros((1, 3, 512, 512), dtype=np.float32)
|
| 71 |
+
x[0, 0] = occupancy
|
| 72 |
+
x[0, 1] = robot_L / 512.0
|
| 73 |
+
x[0, 2] = robot_W / 512.0
|
| 74 |
+
with torch.no_grad():
|
| 75 |
+
out = torch.sigmoid(model(torch.from_numpy(x)))
|
| 76 |
+
return out[0].numpy() # (4, 512, 512) N/S/E/W viability
|
| 77 |
+
|
| 78 |
+
viability = predict(occupancy_grid)
|
| 79 |
+
north_viable = viability[0] > 0.5
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Dataset
|
| 83 |
+
|
| 84 |
+
Full processed maps and Oracle labels: [DanielDDDs/topological-traps-dataset](https://huggingface.co/datasets/DanielDDDs/topological-traps-dataset)
|
| 85 |
+
|
| 86 |
+
## Code
|
| 87 |
+
|
| 88 |
+
[github.com/danielsddd/topological-traps-project](https://github.com/danielsddd/topological-traps-project)
|
| 89 |
+
|
| 90 |
+
## Compute
|
| 91 |
+
|
| 92 |
+
TAU CS SLURM cluster:
|
| 93 |
+
- NVIDIA TITAN Xp (12 GB) - nodes s-002, s-003, s-006
|
| 94 |
+
- NVIDIA GeForce RTX 2080 (8 GB) - nodes s-004, s-005
|
| 95 |
+
|
| 96 |
+
## Citation
|
| 97 |
+
@misc{simanovsky2026traps,
|
| 98 |
+
author = {Daniel Simanovsky},
|
| 99 |
+
title = {Neural Prediction of Heading-Dependent Topological Traps},
|
| 100 |
+
year = {2026},
|
| 101 |
+
school = {Tel Aviv University},
|
| 102 |
+
note = {Algorithmic Robotics, Prof. Dan Halperin}
|
| 103 |
+
}
|