File size: 4,954 Bytes
3c41fb5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | # Cable representation analysis — ACT encoder, DG-5F / UR5e cable sorting
What the ACT encoder's internal representation holds about the cable being
handled. All figures come from a forward hook on `policy.model.encoder`: the
transformer tokens are mean-pooled into a single 512-d vector per frame.
**Every split in this directory is episode-level.** Frames inside one episode
are near-duplicates, so a frame-level split leaks the answer and inflates every
number below.
## Model under analysis
| | |
|---|---|
| policy | ACT, action chunk 60 |
| training | 300k steps on `Kaz55/dg5f_ur5e_bluev2_cable170_330_270ep` (270 episodes) |
| cameras | 2× RealSense + 2× GelSight |
| excluded | `observation.velocity`, `observation.effort` |
Cable naming: **1.70 sq → 1.7 mm**, **blue → 2.6 mm**, **3.30 sq → 4.5 mm**
(mm = outer diameter; sq = conductor cross-section).
## Headline results
**The encoder knows which cable it is holding.**
```
full 512-d linear probe, 3 cables 97.9% (chance 33.3%)
full 512-d linear probe, 4 cable sizes 94.0% (chance 25.0%)
```
**It encodes thickness as a quantity, not just as a class label.** Ridge
regression onto physical diameter, fitted on training episodes only — the
ordering is never supplied, yet 2.6 mm lands between 1.7 and 4.5:
```
held-out R^2 = 0.88
true 1.7 mm -> 1.81 +- 0.33 mm
true 2.6 mm -> 2.66 +- 0.39 mm
true 4.5 mm -> 4.33 +- 0.43 mm
```
**But the discrimination is visual, not tactile.** Splitting each episode at
contact onset (detected per episode from finger torque) gives almost the same
accuracy before the GelSight has touched anything as after:
```
probe accuracy diameter R^2
pre-contact 94.9% 0.72
post-contact 95.6% 0.83
```
This reconciles the training-loss result seen across 4+ datasets: **removing
GelSight entirely leaves training loss unchanged**, and GelSight resolution from
192 tokens down to 0 makes no difference. The policy separates cables by sight.
PCA in each phase, probe accuracy on exactly the axes drawn:
```
PC1/PC2 PC1-PC3 variance PC1 / PC2 / PC3
pre-contact 46.7% 77.2% 18.9% / 9.2% / 5.8%
post-contact 64.9% 82.8% 9.7% / 7.0% / 6.1%
```
PC1/PC2 is dominated by arm pose, which is why the unsupervised 2-D view looks
messier than the probe numbers suggest. The cable-identity structure lives on
later components (PC3/PC4) and in the 3-D view.
## Four cable sizes — does an intermediate size land in between?
`4sizes/`. Adds **3.00 sq**, an intermediate cross-section, from
`Kaz55/dg5f_ur5e_cable3sizes_180ep`. 900 frames per size (60 episodes × 15
frames), 3600 total.
**Yes — 3.00 sq sits between blue and 3.30 sq.** On the regressed size axis:
```
size axis held-out R^2 = 0.86
1.70 sq true 1.70 -> 1.83 +- 0.22
blue (2.6 mm) true 2.30 -> 2.36 +- 0.22
3.00 sq true 3.00 -> 2.94 +- 0.22
3.30 sq true 3.30 -> 3.21 +- 0.20
```
and in raw 512-d centroid distances, where blue↔3.30 is the largest of the three
— exactly what it must be if 3.00 lies between them:
```
blue <-> 3.00 4.59
3.00 <-> 3.30 3.33
blue <-> 3.30 5.27 <- largest
```
**Caveat.** 3.00 sq comes from a different dataset, so session-level confounds
(lighting, gel condition, recording day) travel with that label. The ordering
result is what guards against over-reading it: a session artefact has no reason
to land *between* two other sizes — it would sit off to one side.
`blue` was entered as 2.30 sq for the ordering test; the ordering itself does not
depend on that value.
## Directory map
| path | contents |
|---|---|
| `4sizes/` | t-SNE and size axis over 4 cable sizes, `results_4sizes.txt` |
| `contact/` | pre/post-contact PCA (2-D, 3-D, rotating GIFs), phase analysis, `results_contact.txt` |
| `diameter/` | diameter-ordered clusters, `results_diameter.txt` |
| `pca2d/` | PC1/PC2 views, informative-component views |
| `pca3d/` | PC1-PC3, rotating GIF |
| `tsne/` | t-SNE over the 3 original cables |
| `pptx/` | `cable_representation.pptx` — the figures as PowerPoint slides |
| `cache/` | extracted encoder features (`.npz`) — every figure replots from these without a GPU |
| `scripts/` | extraction (`collect_*.py`) and plotting (`plot_*.py`) |
| `results_probe.txt` | full-512-d probe accuracies |
## Reproducing
Replot from the cached features (no GPU, no model download):
```bash
python scripts/plot_4sizes_tsne.py --cache cache/cache_4sizes.npz --outdir 4sizes/
python scripts/plot_contact_pca.py --cache cache/cache_cable_contact.npz --out contact/cable_contact_pca.png
python scripts/summarize_from_cache.py --cache cache/cache_cable_feats.npz
```
Re-extract features from the trained policy (needs the checkpoint and a GPU):
```bash
python scripts/collect_4sizes.py --policy-path <checkpoint>
python scripts/collect_contact_feats.py --policy-path <checkpoint>
```
|