Robotics
LeRobot
Safetensors
imitation-learning
act
b-spline
so101
bspline_act
aryankakad commited on
Commit
d2f77bd
·
verified ·
1 Parent(s): b0a5ded

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +196 -0
README.md ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: lerobot
4
+ pipeline_tag: robotics
5
+ tags:
6
+ - robotics
7
+ - lerobot
8
+ - imitation-learning
9
+ - act
10
+ - b-spline
11
+ - so101
12
+ - bspline_act
13
+ datasets:
14
+ - aryankakad/CUPSTACKING
15
+ model_name: cupstack_bspline_act
16
+ ---
17
+
18
+ # cupstack_bspline_act
19
+
20
+ An [ACT](https://huggingface.co/papers/2304.13705) policy that predicts **B-spline
21
+ trajectory segments** instead of discrete action chunks, trained on SO-101 cup
22
+ stacking. This is the "Reg.+BSP" variant from
23
+ [B-spline Policy: Accelerating Manipulation Policies via B-spline Action Representations](https://arxiv.org/abs/2607.09648).
24
+
25
+ The practical consequence: **you can run this checkpoint faster without retraining it.**
26
+ The policy outputs a curve, so executing `a(n·t)` replays the same trajectory geometry
27
+ n times faster. Speed-up is an inference flag.
28
+
29
+ > [!WARNING]
30
+ > **This checkpoint has never been evaluated on held-out data or on hardware.**
31
+ > It was trained on all 50 episodes with no validation split, so its numbers measure
32
+ > fit, not generalization. Treat first hardware runs as untested — keep the e-stop
33
+ > within reach. See [Limitations](#limitations).
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ lerobot-rollout \
39
+ --strategy.type=base \
40
+ --policy.path=aryankakad/cupstack_bspline_act \
41
+ --policy.speed_up=1.0 \
42
+ --device=cuda \
43
+ --robot.type=so101_follower --robot.port=/dev/ttyACM0 --robot.id=FOLLOWER \
44
+ --robot.cameras='{front: {type: opencv, index_or_path: 0, width: 640, height: 480, fps: 30}, gripper: {type: opencv, index_or_path: 4, width: 640, height: 480, fps: 30}}' \
45
+ --task="stack the cups" \
46
+ --fps=30 --duration=30 --display_data=true
47
+ ```
48
+
49
+ Raise `--policy.speed_up` to 2.0 or 4.0 to execute faster. Start at 1.0 and step up
50
+ only once the task succeeds.
51
+
52
+ ### Camera naming is not optional
53
+
54
+ The policy requires exactly these observation keys, so the `--robot.cameras` dict keys
55
+ must be **`front`** and **`gripper`**, lowercase:
56
+
57
+ | Key | Shape |
58
+ |---|---|
59
+ | `observation.images.front` | `(3, 480, 640)` |
60
+ | `observation.images.gripper` | `(3, 480, 640)` |
61
+ | `observation.state` | `(6,)` |
62
+
63
+ Joint order is `shoulder_pan, shoulder_lift, elbow_flex, wrist_flex, wrist_roll, gripper`.
64
+ Swapping the two cameras produces confident but wrong behaviour rather than an error.
65
+
66
+ ### Requirements
67
+
68
+ This policy type is not in upstream LeRobot. You need a checkout containing the
69
+ `bspline_act` policy, installed with the scipy extra:
70
+
71
+ ```bash
72
+ uv pip install -e ".[feetech,bspline]"
73
+ ```
74
+
75
+ `scipy>=1.15` is required for `interpolate.generate_knots`.
76
+
77
+ ### No dataset needed at inference
78
+
79
+ Unnormalization statistics are stored as buffers inside `model.safetensors`, so the
80
+ checkpoint is self-contained. You do not need the training dataset on the robot machine.
81
+
82
+ ## Training
83
+
84
+ | | |
85
+ |---|---|
86
+ | Steps | **100,000** |
87
+ | Batch size | 32 |
88
+ | Epochs | 133.09 |
89
+ | Dataset | [`aryankakad/CUPSTACKING`](https://huggingface.co/datasets/aryankakad/CUPSTACKING) → B-spline converted |
90
+ | Episodes / frames | 50 / 24,044 @ 30 fps |
91
+ | Optimizer | AdamW, lr 2e-5 (backbone 1e-5), wd 1e-4 |
92
+ | Precision | bf16 autocast + `channels_last` |
93
+ | Hardware | 1× RTX 4090, 5 h 24 min |
94
+ | Seed | 1000 |
95
+
96
+ Learning rate is 2e-5 rather than ACT's default 1e-5, sqrt-scaled for batch 32.
97
+
98
+ ### Loss
99
+
100
+ | Step | loss | l1_loss | kld_loss |
101
+ |---|---|---|---|
102
+ | 500 | 3.027 | 0.390 | 0.264 |
103
+ | 10k | 0.166 | 0.104 | 0.007 |
104
+ | 50k | ~0.111 | 0.041 | 0.007 |
105
+ | **100k** | **0.095** | **0.026** | **0.007** |
106
+
107
+ Training loss only — there was no validation split.
108
+
109
+ ## Architecture
110
+
111
+ Standard ACT with one change: the decoder emits a B-spline **parameter matrix** rather
112
+ than an action chunk.
113
+
114
+ ```
115
+ (n_knots, 1 + action_dim) = (16, 7) = 112 values per prediction
116
+ column 0 knot vector, in source-frame units, 0 = "now"
117
+ columns 1: control points, one per joint
118
+ ```
119
+
120
+ | | |
121
+ |---|---|
122
+ | Params | 52 M |
123
+ | Vision backbone | ResNet18 (ImageNet init) |
124
+ | dim_model / chunk_size | 512 / 16 |
125
+ | VAE | enabled, kl_weight 10.0 |
126
+ | B-spline degree | 3 (cubic, C² continuous) |
127
+ | bspline_chunk_size | 10 |
128
+ | Fitting tolerance ε | 0.2 (degrees) |
129
+
130
+ Knot spacing is fitted adaptively per episode, so a fixed 16 rows covers a **variable**
131
+ time horizon — 0.53 s to 1.47 s per segment on this dataset, 0.84 s mean. The network
132
+ only runs when a segment is exhausted, which decouples policy rate from control rate.
133
+
134
+ ### On the fitting tolerance
135
+
136
+ ε = 0.2 is not the paper's value. The paper uses 0.002 for metre-scale end-effector
137
+ actions; SO-101 stores joint targets in **degrees** (~±120), roughly 100× larger. At
138
+ ε = 0.002 compression is 1.06× — one knot per frame, which defeats the representation.
139
+
140
+ | ε | Compression | p99 reconstruction | Segment span |
141
+ |---|---|---|---|
142
+ | 0.05 | 1.4× | 0.05° | 0.44 s |
143
+ | **0.2** | **2.7×** | **0.19°** | **0.84 s** |
144
+ | 0.5 | 4.1× | 0.48° | 1.24 s |
145
+
146
+ 2.7× sits inside the paper's reported 1.12×–3.34× range.
147
+
148
+ ## Evaluation
149
+
150
+ **Offline only. No hardware evaluation has been performed.**
151
+
152
+ Open-loop prediction error — decoded trajectory vs ground-truth actions, measured on
153
+ **training data**:
154
+
155
+ | Checkpoint | Mean | Median | p90 | Max |
156
+ |---|---|---|---|---|
157
+ | 20k | 5.99° | 4.12° | 8.78° | 45.2° |
158
+ | 50k | 3.34° | 2.28° | 6.53° | 30.8° |
159
+ | **100k** | **2.10°** | **1.61°** | **3.86°** | **18.6°** |
160
+
161
+ Error was still falling at 100k and 2.10° is far from zero, which argues against
162
+ outright memorization — but this is training data, so it is not evidence of
163
+ generalization.
164
+
165
+ The representation is not the bottleneck: B-spline fitting reconstructs to 0.19° p99,
166
+ so essentially all of the 2.10° is policy prediction error.
167
+
168
+ Temporal rescaling is **exact**. On a real predicted segment (0.76 s span), `a(2t)` and
169
+ `a(4t)` reproduce the 1× samples to 0.00e+00, consuming the segment in 22 / 11 / 5
170
+ control ticks.
171
+
172
+ ## Limitations
173
+
174
+ - **No validation split.** All 50 episodes were used for training (`eval_steps: 0`).
175
+ Generalization is unmeasured.
176
+ - **No hardware evaluation.** Task success rate is unknown.
177
+ - **Speed-up has a hardware ceiling.** The paper reaches 4× on cube picking but only 2×
178
+ on speed stacking before the low-level controller loses tracking. Cup stacking is the
179
+ same precise-placement regime, so expect degradation near 2×. Retiming does not make
180
+ the arm faster — past the tracking limit it overshoots rather than stopping.
181
+ - **Single task, single scene.** 50 demonstrations of one cup-stacking setup; no
182
+ robustness to lighting, camera placement, or cup position changes should be assumed.
183
+ - **Camera assignment is silent when wrong.** Swapped views degrade behaviour without
184
+ raising an error.
185
+
186
+ ## Citation
187
+
188
+ ```bibtex
189
+ @article{han2026b,
190
+ title={B-spline Policy: Accelerating Manipulation Policies via B-spline Action Representations},
191
+ author={Han, Xiaoshen and Xiong, Haoyu and Chen, Haonan and Liu, Chaoqi and
192
+ Torralba, Antonio and Zhu, Yuke and Du, Yilun},
193
+ journal={arXiv preprint arXiv:2607.09648},
194
+ year={2026}
195
+ }
196
+ ```