DeFM is one depth encoder that any robot can use off the shelf, frozen. It learned from 60 million depth images with no labels. Inside a navigation policy, it reaches the goal in 93% of runs in a hangar the robot never trained in. An ImageNet encoder reaches 50%.
Learn how to pretrain a vision foundation model on depth alone: the input that keeps metres meaningful, the self-distillation that needs no labels, and the small networks that fit on a robot.
Pick an encoder and a place, then press Run 100 episodes. Watch where the robot crashes. Try ImageNet in the Abandoned Cable site, where the gap is widest. Then we build DeFM piece by piece, from one depth pixel to a robot in a park.
You need what a neural network layer does and what a probability is. We build the rest from zero.
Press Run to send the robot from start to goal 100 times.
The maps, paths and robot are a toy. The success rates are the paper's Table VIII (the policy of Yang et al. on a Unitree B2W, a frozen encoder, 64 × 40 depth input, 100 start-goal pairs per place, three runs averaged). Each grid shows the rate rounded to whole runs. How failures split into collisions and timeouts is illustrative; the paper's Figure 8 shows DeFM has the fewest collisions.
Chapter 0
See why robots trust depth in simulation, and why nobody had a pretrained encoder for it
"Can we build a universal pretrained depth encoder for robotics? The simple answer is yes."Patel et al., DeFM, Section I
A team trains a four-legged robot to climb stairs. The robot learns in a simulator, millions of falls in a few hours on one GPU. It sees the world through one depth camera. Then the team copies the policy onto the real robot, and it climbs real stairs on the first day.
That last step is the hard one in robot learning. It is called sim-to-real transfer: a policy trained in a simulator must work on the real machine. Depth cameras make it much easier. Here is why.
The same toy scene as a colour photo (left) and as a depth image (right). Drag the light and swap the textures. Watch which picture changes.
A toy ray-cast scene. The point is the paper's (Section I): depth does not change with lighting, texture or colour, so a simulator can render it faithfully and a depth policy transfers well.
A simulator draws shapes well. It draws light, dirt, reflections and paint badly. A colour photo depends on all of those, so a policy that learned on simulated photos meets a strange world on the real robot. A depth image depends only on shape. The simulated stairs and the real stairs produce nearly the same depth image.
So robot learning uses depth everywhere. Legged robots climb terrain from depth. Wheeled robots avoid obstacles from depth. Robot hands grasp objects from depth. Depth cameras sit on manipulators, drones, mobile robots and headsets.
For colour photos, the field has foundation models: one large network, pretrained once on huge data, that turns any image into useful numbers. DINOv2, DINOv3 and CLIP are examples. You download the weights, freeze them, and train only a small head for your task. The frozen network is called an encoder, and its output numbers are features.
For depth, no such encoder existed. Teams had two options, and both are bad:
| Option | How it works | What goes wrong |
|---|---|---|
| Borrow an RGB encoder | Squash the depth image into 0 to 1, copy it into three colour channels, and feed it to DINOv2 or an ImageNet network. | The encoder never saw images like this (a distribution mismatch). The squashing also throws away the metres. |
| Train from scratch | Train a small CNN together with the policy, on the task's own simulated images. | The encoder learns only what that one task needs, in that one simulator. Each new task or sensor starts again. |
| DeFM | Pretrain one encoder on 60 million depth images with no labels, then freeze it. | The rest of this lesson. |
DeFM ("Depth Foundation Model") comes from the Robotic Systems Lab at ETH Zurich, with UC Berkeley, NVIDIA and Imperial College London. The authors take DINOv2, the best recipe for self-supervised RGB features, and change only what depth demands. The changes are few, and each one is a lesson:
| Piece | What it is | Chapter |
|---|---|---|
| An input with three rulers | Three log-scaled copies of the depth image, so the network sees millimetres near the hand and tens of metres outdoors, and keeps the metres. | 2 |
| Self-distillation | DINOv2's teacher-student training with no labels: two views of one scene must mean the same thing. | 3, 4 |
| 60.4 million depth images | 18 datasets: real sensors, simulators, and RGB photos turned into depth by another network. | 5 |
| Small students | The 304-million-weight model distilled into CNNs of 3 to 30 million weights, fast enough for a robot. | 7 |
The results hold up. DeFM-L tops its RGB rivals at reading depth images of 1,000 object classes: 71.7% with a linear probe. Its small version beats theirs by up to 10 points. It wins most segmentation tests. Frozen inside three robot policies, it navigates, grasps and climbs ladders, and it carries a robot through a real park. Here is the road.
Chapter 1
Read a depth image pixel by pixel, and learn what a zero means
Before we can train an encoder, we must agree on its input. A photo is a grid of colours. A depth image is a grid of distances. But "distance" has two possible meanings, and the sensors disagree in their failures. So we start with one pixel.
The paper defines a depth image D as a 2-D array. Each valid pixel holds the distance along the camera's Z axis, in metres. The Z axis points straight out of the lens. So a pixel's depth is how far in front of the camera its surface lies, not how far away it is along the ray.
Those two numbers differ off-centre. A surface seen 30° off the optical axis, 2.0 m in front of the camera, is 2.0 / cos 30° = 2.31 m away along its ray. The depth image stores 2.0. A flat wall facing the camera therefore has the same depth in every pixel, which is what a robot wants.
The second rule is about failure. Every depth sensor has pixels where it could not measure. Some sensors write NaN there, some write a huge number, some write zero. DeFM fixes one convention: every missing or invalid pixel is exactly 0. A real surface is never at 0 m, so a zero can only mean "no measurement".
Move over the image (or tap it) to read one pixel. Then switch on the sensor failures and watch zeros appear. Missing pixels show in red.
A toy ray-cast scene at 96 × 64 pixels. The conventions (metres along Z, zero for missing) are the paper's Section IV-A. The failure patterns are typical of stereo and time-of-flight sensors, not measurements of a specific camera.
Real depth cameras make three kinds of mistake, and DeFM must survive all of them.
The third point has a clean formula for a stereo camera, which finds depth by comparing two images taken a small distance apart. A surface at depth Z shifts by a disparity of d pixels between the two images. Near things shift a lot and far things shift a little:
Put in numbers like a small stereo camera: f = 600 px, b = 0.05 m, δd = 0.1 px. At 1 m the error is 1 / 30 × 0.1 = 3.3 mm. At 4 m it is 16 / 30 × 0.1 = 53 mm. Four times the distance, sixteen times the error. Hold on to this square. In Chapter 2 it tells us how to scale the input.
Let us fix the data at each step, since the rest of the lesson builds on it. A sensor gives a depth image of, say, 480 × 640 pixels. Each pixel is one float32 in metres. The encoder wants a fixed size, so training crops and resizes it.
| Stage | Shape | Values |
|---|---|---|
| Sensor output | 480 × 640 × 1 | metres along Z; 0 = missing |
| Three rulers (Chapter 2) | 480 × 640 × 3 | C1, C2, C3, each about 0 to 1 |
| Global crop for training | 224 × 224 × 3 | then mean and standard deviation removed |
| ViT-L/14 patches | 16 × 16 = 256 patches | each 14 × 14 × 3 = 588 numbers |
| Encoder output | 1 + 256 tokens × 1,024 | one summary token plus one feature per patch |
Chapter 2
Build the input that keeps millimetres near the gripper and metres in the distance
A neural network learns best when its inputs sit roughly between 0 and 1. A depth image does not: it holds 0.4 m on a tabletop and 60 m on a road. One foundation model must take both. How do we squash metres into 0 to 1 without losing what matters?
Try the obvious answers first. Each one fails in a way that teaches something.
The first two keep metres but waste resolution. The third keeps resolution but loses metres. Chapter 1 hinted at a way out: a sensor's error grows with depth. So we do not need the same resolution everywhere. Near depths deserve fine steps, far depths only coarse ones.
The function that does this is the logarithm. DeFM uses log(1 + D), written logp. The "1 +" keeps it finite at D = 0 (a missing pixel maps to 0) and makes it close to D for small depths. Its slope says how much the output moves per metre:
At 0.5 m the slope is 1 / 1.5 = 0.67 per metre. At 50 m it is 1 / 51 = 0.020 per metre. So one metre near the robot moves the input 34 times more than one metre far away. That matches what matters: avoiding an obstacle at 1 m is urgent; the exact distance to a building at 60 m is not.
One log scale is still a choice of range. So DeFM does not choose. It builds three channels from the same image and stacks them like the red, green and blue of a photo:
Work one pixel through. Take a tabletop image with Dmin = 0.3 m and Dmax = 0.9 m, and a pixel at D = 0.5 m.
Now move the pixel 1 cm, to 0.51 m. C1 rises by 0.017, C2 by 0.0028, C3 by 0.0014. So C1 shows the 1 cm step 12 times more clearly than C3. Outdoors the roles swap: C1 and C2 saturate or blur, and C3 still separates 20 m from 40 m.
Pick a scene and a normalization. The left shows what the network would see. The right plots each mapping from metres to input value. Drag the probe to read the three channels at any depth.
The formulas are the paper's Section IV-C (Figure 3 shows the same comparison on real images). The scenes are toy renders. "Contrast" is the spread of input values across the image's valid pixels, as a share of the 0 to 1 range. In the stacked view, C1, C2 and C3 drive the green, yellow and pink tints.
Estimated depth. Part of the training data is depth estimated from photos by another network (Chapter 5). Those depths have the right order but no true scale. For them, C2 and C3 still order near and far consistently, but carry no real metres. C1 is scale-free, so it stays exactly as valid. The design degrades gracefully: the relative channel always works, and the metric channels add metres when the data has them.
One last normalization. After stacking, DeFM subtracts a mean and divides by a standard deviation for each channel. These six numbers are computed once over the whole pretraining set, not per image. A per-image version would erase the metres again.
Does the stack actually help? The authors trained three small ViT-S models for 125,000 steps, identical except for the input, and probed each one on five segmentation tests (Chapter 8 explains the probe):
Bars are segmentation quality (mIoU, higher is better) for each input. Tap a test to highlight it.
Numbers: the paper's Table VI, input-normalization rows (ViT-S, 125k steps, batch 1,024, linear-probe segmentation mIoU). The bars start at zero.
The stack wins four of five tests. The interesting case is GraspNet-1B, the tabletop test: the far-range channel C3 alone scores 15.38, below even the relative channel C1 (16.68). That is the "divide by 100" failure in miniature: C3 squashes the centimetres a grasp depends on. The stack (17.07) keeps both.
Here is the whole input pipeline in a few lines of NumPy. It is a sketch with the paper's formulas, not the authors' code.
pythonimport numpy as np def defm_input(D, mean, std): """D: (H, W) float32 metres along Z, 0 = missing. Returns (3, H, W).""" L = np.log1p(D) # logp(D) = log(1 + D); missing stays 0 valid = D > 0 lo, hi = L[valid].min(), L[valid].max() c1 = np.where(valid, (L - lo) / max(hi - lo, 1e-6), 0) # relative, per image c2 = L / np.log1p(10.0) # metric, 10 m -> 1 c3 = L / np.log1p(100.0) # metric, 100 m -> 1 X = np.stack([c1, c2, c3]) # three rulers, one image return (X - mean[:, None, None]) / std[:, None, None] # dataset-wide stats, not per image D = np.array([[0.3, 0.5], [0.9, 0.0]], dtype=np.float32) # one missing pixel print(defm_input(D, np.zeros(3), np.ones(3))[:, 0, 1]) # [0.377 0.169 0.088]
Chapter 3
Learn features from 60 million images that nobody labelled, and stop the network from cheating
We have 60 million depth images and not one label. Nobody wrote "mug" or "stairs" on them. What can a network learn from a pile of unlabelled pictures?
One thing is free: two crops of the same image show the same scene. A crop of the mug's handle and a crop of the whole table both come from "a mug on a table". So we ask the network to give the two crops the same description. If it can do that for millions of scenes, its description must capture what the scene is, not where the crop was cut.
There is a trivial way to win that game. The network can describe every image with the same output. Then any two crops agree perfectly and the loss is zero. This failure is called collapse, and every method of this family is built around preventing it. DINO, the method DeFM uses, prevents it with three tricks. We build them one at a time.
DINO runs two copies of the same network. The student is trained by gradient descent. The teacher is never trained directly. After each step, its weights move a little toward the student's:
With λ = 0.994, each step moves the teacher 0.6% of the way to the student. The teacher is roughly an average of the last 1 / (1 − 0.994) ≈ 167 students. An average of many recent networks is steadier and usually a bit better than the latest one, so it makes a good target. And because the teacher gets no gradient, the student cannot pull it toward a shortcut in one step.
The thin line is one student weight over 400 steps. The thick line is the teacher's copy. Drag the momentum and watch the teacher smooth and lag.
A toy random walk standing in for one weight. The schedule 0.994 to 1.0 is the paper's Table XI.
Each network ends in a projection head: a small MLP that maps the image's summary token to K scores, one per prototype. You can think of the prototypes as K learned "kinds of scene". DeFM uses K = 131,072. A softmax with a temperature turns the scores into probabilities that sum to 1:
The student must match the teacher's distribution. The measure of mismatch is the cross-entropy, the paper's Equation 1:
A worked case with K = 4. The teacher says pt = (0.70, 0.20, 0.05, 0.05). The student says ps = (0.40, 0.30, 0.20, 0.10). Then L = 0.70 · 0.916 + 0.20 · 1.204 + 0.05 · 1.609 + 0.05 · 2.303 = 1.08 nats. If the student copied the teacher exactly, the loss would fall to the teacher's own entropy, 0.87 nats. The gap of 0.21 nats is what the gradient removes.
The slow teacher alone does not stop collapse. Two pressures act on the teacher's outputs, and each one blocks one way of cheating:
Centring pushes toward flat; sharpening pushes toward peaked. Together they force a distribution that is peaked and different for different images. The only way for the student to match that is to tell scenes apart.
Solid warm boxes are the teacher's two global crops; hollow boxes are the student's eight local crops. The bars below are each network's distribution over 12 toy prototypes, and the strip shows which prototype six different images pick. Switch centring off, or raise the temperature, and watch the batch collapse.
The scores are a toy (12 prototypes instead of 131,072; scene scores plus a shared bias plus crop noise). The crop sizes and counts are the paper's: 2 global crops of 224² covering 32 to 100% of the image, 8 local crops of 98² covering 5 to 32%. The loss shown is Equation 1 for the selected local crop.
Plain centring subtracts an average. Sinkhorn-Knopp goes further: it rescales the teacher's batch of distributions so that every prototype is used equally often across the batch. It does this by alternately normalizing the columns (prototypes) and the rows (images) of the batch's probability table, three times.
A tiny example. Two images, two prototypes, and a teacher that leans to prototype 1 for both: rows (0.9, 0.1) and (0.8, 0.2). Prototype 1 gets 1.7 of the batch's 2.0 total. Rescale each column to total 1.0, then each row back to 1.0. Image 1 becomes (0.61, 0.39) and image 2 becomes (0.41, 0.59). The shared lean is gone, and the images now point to different prototypes.
From each depth image, DeFM cuts two global crops (224 × 224 pixels, covering 32 to 100% of the image) and eight local crops (98 × 98, covering 5 to 32%). The teacher sees only the two global crops. The student sees all ten. Two losses use them, the paper's Equations 2 and 3:
The local loss carries the deep idea. A 98-pixel crop might show only a mug's handle. To match the teacher's view of the whole table, the student must learn that "this curve" goes with "mug on a table". That is how part-whole knowledge enters the features, without a single label.
Chapter 4
Add the patch-level loss that makes every patch feature useful, then run the whole training
The losses of Chapter 3 train only the summary token, the one vector per image. A robot needs more. To grasp a mug it must know which patch is the handle. To avoid a pole it must know where the pole is. So DeFM also trains the 256 patch features, with a loss from iBOT.
Take one of the student's global crops. With probability 0.5, hide a random 10 to 50% of its patches: replace them with a learned "mask" token. The teacher sees the same crop with nothing hidden. At every hidden position, the student must predict the teacher's distribution for that patch. The paper's Equation 4:
Count the work. A 224 × 224 crop with 14-pixel patches gives 16 × 16 = 256 patches. With 30% masked, the student fills in about 77 of them per masked crop. To predict a hidden patch on a mug's rim, the student must know the rim continues. That is the kind of dense, contextual feature that segmentation and grasping need.
Left: what the teacher sees. Right: what the student sees, with masked patches hidden. Drag the mask ratio, then press Predict to fill each hidden patch from its neighbours, the way a trained student must.
The grid and the mask ratio range (10 to 50%, applied to half the crops) are the paper's Table XI. "Predict" here fills each patch with the average of its visible neighbours: a stand-in that shows why context is enough for smooth surfaces and fails at edges. The real student predicts the teacher's 131,072-way distribution, not depth.
One more failure is possible. The features could crowd into a small corner of their space. They would still differ a little, so nothing collapses, but nearby images would be hard to tell apart. The KoLeo regularizer fights this. For each image in the batch, find the distance di to its nearest neighbour, and penalize small distances:
Four features on a circle: (1, 0), (0, 1), (0.8, 0.6) and (−1, 0). The nearest-neighbour distances are 0.63, 0.89, 0.63 and 1.41. The loss is −(−0.46 − 0.11 − 0.46 + 0.35) / 4 = 0.17. Move (0.8, 0.6) away from (1, 0) and the loss falls.
Twelve features on the unit circle, crowded in one arc. Press Spread to take gradient steps on the KoLeo loss and watch them separate.
Real gradient descent on the KoLeo loss for 12 points in 2-D, projected back to the circle after each step. DeFM applies it to its features in many more dimensions, with weight 0.1.
Add the pieces. The paper's Equation 5, with the weights of Table XI:
DeFM-L is a ViT-L/14: 24 transformer layers, features of 1,024 numbers, 14-pixel patches, 304 million weights. The DINO and iBOT losses have separate projection heads. Here is the run, from the paper's Table XI.
| Setting | Value |
|---|---|
| Hardware | 96 NVIDIA GH200 Grace Hopper GPUs, fully-sharded data parallel |
| Batch and length | 3,072 images per step, 625,000 steps |
| Optimizer | AdamW, peak learning rate 3.5 × 10−4, 100,000 warm-up steps, cosine decay to 10−6 |
| Weight decay | 0.04 rising to 0.2 (cosine) |
| Teacher | momentum 0.994 to 1.0; temperature 0.04 to 0.07; Sinkhorn-Knopp centring |
| Precision | float16 mixed precision |
Multiply: 625,000 steps × 3,072 images = 1.92 billion image views. Over 60.4 million images, that is about 32 passes through the data, each time with fresh crops and noise.
The heart of the training step, as a PyTorch sketch with the paper's settings. Sinkhorn-Knopp and the iBOT head are left out to keep it short.
pythondef dino_loss(student_logits, teacher_logits, center, t_temp=0.04, s_temp=0.1): p_t = F.softmax((teacher_logits - center) / t_temp, dim=-1).detach() # centre, sharpen, no gradient log_p_s = F.log_softmax(student_logits / s_temp, dim=-1) return -(p_t * log_p_s).sum(-1).mean() # Equation 1 def train_step(depth_batch): g, l = make_crops(depth_batch) # 2 global 224², 8 local 98², depth augmentations g_masked, mask = random_mask(g) # 10-50% of patches, on half the crops with torch.no_grad(): t_cls, t_patch = teacher(g) # teacher sees unmasked global crops only s_cls_g, s_patch = student(g_masked) s_cls_l, _ = student(l) loss = sum(dino_loss(s_cls_g[i], t_cls[j], c) for i in (0, 1) for j in (0, 1) if i != j) # Eq. 2 loss += sum(dino_loss(s, t_cls[j], c) for s in s_cls_l for j in (0, 1)) # Eq. 3 loss += dino_loss(s_patch[mask], t_patch[mask], c_patch) # Eq. 4 loss += 0.1 * koleo(F.normalize(s_cls_g, dim=-1)) # Eq. 5 loss.backward(); opt.step(); opt.zero_grad() with torch.no_grad(): # the teacher follows the student for pt, ps in zip(teacher.parameters(), student.parameters()): pt.mul_(lam).add_(ps, alpha=1 - lam)
Chapter 5
Assemble a depth dataset from three sources, then add sensor noise on purpose
DINOv2 showed that a foundation model needs both scale and variety. For photos, the web provides billions. For depth, there is no web. No one posts depth images. So where do 60 million come from?
The authors combine 18 datasets, 60.4 million images, from three kinds of source. Each one brings something the others lack.
| Source | Images | What it gives | What it lacks |
|---|---|---|---|
| Estimated (MDE) ImageNet-21k, SA-1B | 25.0 M | Object variety: snakes, cups, tools, furniture. Photos turned into depth by a network. | True metres; some inherited errors. |
| Synthetic TartanAir, TartanGround, SHIFT, … | 13.0 M | Clean, exact metric depth in places too costly to capture: cities, caves, roads. | Real sensor noise. |
| Real sensors HM3D, Taskonomy, DROID, … | 22.4 M | Real holes, edge errors and noise from many different cameras. | Variety: mostly rooms and tabletops. |
The estimated depth needs a word. ImageNet-21k has 14 million photos of 21,000 kinds of object. No depth dataset comes close. So the authors run every photo through Depth Anything V2, a monocular depth estimation (MDE) network that guesses depth from a single photo. Its output is relative: right order, unknown scale. The authors map each output to a fixed pseudo-metric range rather than guessing real metres. Recall Chapter 2: the relative channel C1 stays fully valid for these images.
The mix view shows all 18 datasets by size, coloured by source. The ablation view shows what happens when a small model trains on one source alone.
Sizes: the paper's Table I (millions of images). Ablation: Table VI, pretraining-data rows (ViT-S, 125k steps, linear-probe segmentation mIoU). The paper notes this reduced-scale test does not establish the best mix at full scale.
The ablation tells a clear story. Each single source is good somewhere and weakest somewhere else. Real data alone does best on ScanNet, whose sensor it has seen, but worst outdoors. Synthetic alone wins TartanGround, a simulated benchmark, but is worst in real rooms. Estimated depth alone is worst on the tabletop test. The full mix has the best average, 36.3, and is never the weakest on any test.
DINOv2 trains with photo augmentations: colour jitter, grey-scale conversion and solarization. None of these mean anything for depth. DeFM replaces them with augmentations that copy real depth sensors (Table XII):
Switch on each augmentation. The settings are those of the first global crop. Press Resample to draw new random values.
Parameters from the paper's Table XII, global crop 1: jitter ±20% brightness and contrast per channel (p 0.8), blur radius up to 2 (p 1.0), noise σ 0.03 (p 0.3), dropout up to 10% with one mask shared by all three channels (p 0.3). Here each switch forces its augmentation on, so you can see it.
Pixel dropout matters most for robots. It writes zeros into random pixels, the same zeros a real sensor writes in its holes (Chapter 1). The mask is shared across all three channels, because a missing pixel is missing in every ruler. After 32 passes of this, DeFM has seen holes in every possible place, and learns that a zero is "no data", not "a wall".
One honest detail from the limitations section. Some real datasets are video, with many near-identical frames. The authors subsample them at 1 to 5 frames per second and use others whole. They call this balancing naive, and list proper de-duplication as future work.
Chapter 6
Look inside the features with PCA and find object parts that agree across four sensors
Training is done. DeFM turns a depth image into 256 patch features of 1,024 numbers each. Are they any good? Before any benchmark, we can simply look at them. But how do you look at 1,024 numbers per patch?
Principal component analysis (PCA) finds the few directions along which a cloud of points varies most. Picture 2-D points scattered along a tilted line. The first principal direction runs along the line. The second runs across it. Project each point on the first direction and you keep most of its information in one number.
The recipe, for N patch features of D numbers each:
Two patches with similar features get similar colours. So if the colours follow object parts, the features know about parts. The paper also removes the background: patches with a low first component are blanked.
A cup seen by four depth sensors, each with its own noise. Left: the input depth. Right: its patch features after PCA, painted as colour. Switch sensors and watch the handle keep its colour.
The PCA is real (power iteration on the covariance, computed in your browser). The features are not DeFM's: each patch gets a hand-built descriptor of its local shape (height, curvature, distance to the rim, the handle's loop) plus sensor noise. The point is the method, and what the paper reports (Figure 5): DeFM's handle patches cluster in one colour across all four sensors.
In the paper's Figure 5, the handles of different cups come out yellow for all four sensors, and the rims magenta. The sensors work in different ways and have different noise. The features still agree. In Figure 1 the same thing happens for drawer and cabinet handles. In kitchen scenes from the DROID dataset (Figure 13), the countertop, the walls, the robot arm and the objects separate into their own colours.
A robot learning to grasp mugs from depth could discover "grab the handle" through millions of trials. With DeFM, "this patch is a handle" is already in the input. The policy only has to learn what to do with it. That is what a good prior means: the right distinctions are already made, so learning is faster and transfers to new sensors.
The paper is honest about a flaw you can see in these maps. Some patches show isolated odd colours: patch artifacts, a known habit of plain ViTs, which store global information in a few background patches. Adding register tokens (extra tokens that give the network somewhere else to store it) usually fixes this. The authors list it for future versions.
Chapter 7
Distil the 304-million-weight model into CNNs small enough for reinforcement learning and a robot's computer
DeFM-L is too big for most robots. On a Jetson AGX Orin, the computer inside many robots, it takes 72.8 ms to encode one image. A robot that sees at 10 frames per second has 100 ms for everything. And training is worse.
Robot policies are trained by reinforcement learning (RL), usually with PPO, in thousands of simulated copies of the robot at once. Every copy renders a depth image every step, and every image passes through the encoder. PPO needs large batches to stay stable, and GPU memory holds the encoder's activations for all of them. A 304-million-weight encoder makes that slow or impossible. The paper's answer is knowledge distillation: train a small network to copy the big one's features.
Chapter 3's training is already a distillation, from teacher to student. So the authors reuse it with two changes. The teacher is now the finished DeFM-L, frozen. The student is a small network: a ViT-S, or a CNN from one of three families (ResNet, RegNet, EfficientNet). As before, the final model is an EMA of the student's weights. Several students train together in one run, sharing the teacher's forward pass.
A ViT keeps a feature per patch all the way to its output. A standard CNN does not. It shrinks the image stage by stage and ends with global pooling: one vector for the whole image. That is fine for "what is in this image" and useless for "where is the handle".
So the authors add a BiFPN (bi-directional feature pyramid network) on top of the CNN. It takes the CNN's feature maps at three scales, 1/8, 1/16 and 1/32 of the input size, and mixes them top-down and bottom-up. Coarse maps know what; fine maps know where. After fusion, each scale knows both.
One more detail makes the shapes line up. The ViT-L/14 teacher sees a 224-pixel crop as 224 / 14 = 16 × 16 patch tokens. The CNN student gets a 256-pixel crop, so its 1/16 map is 256 / 16 = 16 × 16 too. Each CNN cell now sits on the same spot as one teacher token, and the two can be compared one to one.
Press Step to move one stage through a distillation step. Each block is labelled with its tensor shape. The two losses appear at the end.
Shapes follow the paper's Section IV-E and Figure 4 for a ResNet-18 student (its stage widths 128, 256 and 512 channels). The BiFPN width of 256 is illustrative.
The two losses mirror pretraining:
Does the pyramid earn its place? The authors distilled DeFM-S into three ResNet-18s and probed segmentation (Table VI):
| ResNet-18 head | ScanNet | SUN-RGBD | OFFSED | TartanGround | GraspNet-1B |
|---|---|---|---|---|---|
| No pyramid | 14.81 | 12.96 | 40.50 | 57.75 | 18.30 |
| FPN | 17.18 | 15.46 | 45.81 | 58.93 | 16.88 |
| BiFPN | 17.13 | 16.35 | 42.39 | 60.24 | 19.32 |
Either pyramid beats none, by up to 5 points. BiFPN is best on three tests and FPN on two. The paper's own reading is fair: multi-scale fusion is what matters, and either kind works.
The result is a family of encoders from 3 to 304 million weights. Which one should a robot use? It depends on what you are short of, and the answer is not always "the fewest weights".
Each dot is one DeFM model. Choose what to put on the horizontal axis, then tap a dot to read its numbers. The dashed line is the best RGB-pretrained ViT-S on the same test.
Accuracy: linear-probe top-1 on ImageNet-1k-Depth, the paper's Tables II and III. Size and latency: Table VII (224² images, plain PyTorch, no TensorRT). RGB line: DINOv2 ViT-S/14, 55.06%.
Two lessons hide in this plot. First, small DeFM students beat big RGB ones. RegNetY-800MF has 6.3 million weights and scores 57.0%, above both RGB ViT-S models (21 million weights, 55.1% and 50.9%). Second, on the Orin, weights do not predict speed. RegNetY and EfficientNet use squeeze-and-excitation layers and depthwise convolutions, which plain PyTorch runs poorly on that chip. RegNetY-400MF has a third of ResNet-18's weights and runs nearly three times slower: 25.2 ms against 8.7 ms. Measure on your own hardware.
Chapter 8
Measure feature quality with linear probes on classification and segmentation, and read the results honestly
Robot experiments are slow and noisy. Before them, we want a quick, fair test of the features. The standard test for foundation models is the linear probe: freeze the encoder, and train only a single linear layer on its features. A linear layer can only draw straight boundaries. If it still separates the classes well, the encoder already did the hard work.
A second, even simpler test is k-nearest neighbours (KNN): label a test image by the labels of its 20 closest training features. No training at all. It measures whether similar things sit close together.
There was no depth classification benchmark, so the authors made one. ImageNet-1k-Depth is ImageNet's 1,000 classes, each photo turned into depth by Depth Anything V2. The classes include 50-odd breeds of dog and several kinds of snake. Without colour or texture, how well can a frozen depth encoder plus one linear layer do?
Set your guess for DeFM-L's linear-probe accuracy on 1,000 classes from depth alone, then press Reveal.
DeFM-L/14: 71.72% (Table II). Chance: 0.1%. The RGB state of the art with colour photos: about 87.2% (DINOv3, quoted in Section V-B).
71.7% from shape alone is the paper's "surprisingly" moment, and it deserves one. A color photo model does better, 87.2%, but the gap is smaller than most people guess. Shape carries most of what a class is.
How should the RGB models be fed depth? The authors tried both ways and kept the better one for them: per-image min-max scaling, copied into three channels, then the usual ImageNet mean and standard deviation. DeFM's own three-ruler input did worse for the RGB models. So each baseline gets its best input, not DeFM's.
Choose a size class and a test. Bars show each encoder's score on that test. Higher is better.
Classification: Table II (linear-probe top-1 on ImageNet-1k-Depth). Segmentation: Table V (linear-probe mIoU). DAv2 is Depth Anything V2's encoder. Concerto and Utonia are point-cloud models, fed the depth image lifted to 3-D. The point-cloud models are much larger than ViT-S; they appear in both views for reference.
Read the large models first. DeFM-L wins the linear probe (71.7% against DINOv3's 69.6%) and four of five segmentation tests. It loses SUN-RGBD to DINOv3, 36.9 against 39.2. Top-1 KNN is a near tie, 63.5 against 64.1. These are solid wins, not a rout.
The small models are a rout. DeFM-S beats the best small RGB model by about 10 points in classification (61.5 against 50.9 to 55.1) and by about 7 mIoU points, some 28% relative, on rooms. The paper's reading: the small RGB models were distilled from big RGB teachers and lost what little transferred to depth. A small model trained for depth keeps it.
Chapter 9
Plug the frozen encoder into navigation, dexterous grasping and ladder climbing, and see what transfers
Benchmarks are a proxy. The paper's real question is whether a robot policy can use DeFM as its eyes, frozen, with no task-specific tuning. The authors test three very different bodies. In each, they swap only the encoder and compare four options: ImageNet RGB weights, a depth VAE (an autoencoder trained to reconstruct depth, the previous best for navigation), DINOv3 distilled into the same small network, and DeFM.
Choose a task. For grasping, also choose whether the encoder stays frozen and which noise the test camera has.
Navigation: Table VIII (success %, 100 start-goal pairs per place, 3 runs). Grasping: Table IX (success relative to the privileged teacher policy, 2,000 episodes, all ResNet-18). Ladder: Table X (climb success %, 750 episodes per setting).
The task comes from earlier ETH work: a Unitree B2W must drive 10 to 80 m to a goal point over rough ground, using one front depth camera. The encoder is a small RegNetX-400MF with a feature pyramid, frozen. Its features meet the robot's own sensing in a cross-attention layer, then a recurrent memory unit and an MLP output velocity commands. The depth image is tiny: 64 × 40 pixels.
In the training world of mazes, pits and stairs, DeFM and the VAE tie at about 90%. The test worlds are realistic, never-seen sites: a hangar, an abandoned cable yard and a city downtown. There, DeFM leads every time. ImageNet's weights collapse to 50% and 38%. DINOv3 falls behind the VAE in two of three. The paper's explanation: DINOv3 treats depth as one more brightness channel, so the metres are lost; ImageNet lacks dense spatial pretraining altogether.
The failures say more than the totals. A collision usually means the eyes missed an obstacle. A timeout usually means the policy got stuck. DeFM has the fewest collisions in every test place, especially with thin, unusual obstacles: fences, traffic signs, lamp posts.
Then the real robot. With DeFM, the B2W reached goals 5 to 100 m away in four real places: a cluttered indoor space, city streets, a park and a construction site. It avoided pedestrians, scooters and barriers. The VAE baseline needed a hand-tuned noise model and depth clipping at 0.1 and 10 m to transfer. DeFM needed none.
The second task uses a Kuka arm with an Allegro hand, from DextrAH. A teacher policy learns to grasp using perfect simulator state (the object's exact pose). A student policy then learns to copy it from depth images alone. Scores are relative to the teacher: 1.0 means the student grasps as well as the all-knowing teacher. Every encoder is a ResNet-18.
Frozen, DeFM scores 0.81, ahead of every frozen rival (0.65 to 0.69) and of a ResNet-18 trained from scratch (0.78). Fine-tuned, every encoder improves, and DeFM leads at 0.89.
The stress test changes the camera noise. Policies trained with speckle, dropout and "stick" noise are tested with a Kinect noise model, which adds edge and distance errors. Every frozen encoder suffers, because the small policy on top overfits to the training noise. ImageNet falls to 0.004 and the VAE to 0.02. DeFM keeps 0.49, the most by far. Fine-tuned DeFM barely notices: 0.88. The fine-tuned VAE does the opposite and collapses to 0.04: it learned the training noise itself.
The third task is the hardest to perceive: an ANYmal must climb ladders with rungs 15 to 45 mm thick at 70 to 90°, under random pushes, using four depth cameras. Here every encoder lands near 90%. DeFM is the best frozen encoder at 90.14%, against 89.3 to 89.8 for the others. A CNN trained from scratch for this exact task gets 90.45%.
Read that honestly: on this task the encoders tie. The claim it supports is narrower than "DeFM wins". It is that a general, frozen encoder can match an encoder built for the task, with no tuning. The authors expect DeFM's noise training to matter more on the real robot. That is a hypothesis; the paper shows only qualitative PCA maps from real ladder runs, where the rungs keep one feature colour through heavy stereo noise.
Chapter 10
Collect the whole method on one page, weigh the limits, and place DeFM in the field
DeFM takes the DINOv2 recipe and changes only what depth demands. It feeds the network three log-scaled rulers, so millimetres near the gripper and tens of metres outdoors both survive. It trains a ViT-L with self-distillation on 60.4 million depth images from estimated, synthetic and real sources, corrupted like real sensors. It distils the result into CNNs of 3 to 30 million weights with a feature pyramid. Frozen, it leads RGB foundation models on depth benchmarks and carries robots through places they never trained in.
| Piece | The formula or setting | The number to remember |
|---|---|---|
| Depth image | metres along Z; missing = 0 | stereo error grows as Z² |
| Input | C1 = min-max of log(1+D); C2 = log(1+D) / log 11; C3 = log(1+D) / log 101 | 0.5 m → (C2, C3) = (0.169, 0.088) |
| DINO loss | −Σ pt log ps, teacher centred and sharpened | 2 global 224², 8 local 98²; 18 pairs |
| Teacher | θt ← λθt + (1−λ)θs | λ 0.994 → 1.0; τt 0.04 → 0.07 |
| iBOT loss | cross-entropy at masked patches only | 256 patches; 10 to 50% masked |
| Total | LGlobal + LLocal + LiBOT + 0.1 LKoLeo | 625k steps × 3,072 = 1.92 B views |
| Data | MDE 25.0 M + synthetic 13.0 M + real 22.4 M | 60.4 M from 18 datasets |
| Distillation | frozen DeFM-L teacher; CNN + BiFPN; 256² crops | 16 × 16 cells meet 16 × 16 tokens |
| Headline results | linear probe; navigation success; grasping | 71.7%; 92.7% hangar vs 50.0%; 0.81 frozen |
And the use of it, as code. Loading the released weights depends on the authors' repository, so the encoder line is a placeholder; the rest is the pattern every robot task in the paper follows.
pythonencoder = load_defm("regnetx_400mf").eval() # placeholder: any DeFM size for p in encoder.parameters(): p.requires_grad_(False) # frozen eyes class Policy(nn.Module): def __init__(self, feat_dim, prop_dim, act_dim): super().__init__() self.rnn = nn.GRU(feat_dim + prop_dim, 256, batch_first=True) self.head = nn.Linear(256, act_dim) def forward(self, depth, prop, h=None): x = defm_input_torch(depth) # three rulers (Chapter 2) with torch.no_grad(): f = encoder(x).mean(dim=(-2, -1)) # pooled features; only the policy trains z, h = self.rnn(torch.cat([f, prop], -1).unsqueeze(1), h) return self.head(z.squeeze(1)), h # PPO (or teacher-student distillation) then trains Policy only; thousands of envs, big batches.
Two more are worth stating plainly. The authors did not tune the DINOv2 recipe for depth at all, so the method may have easy gains left. And most robot results are in simulation; the real-world evidence is the navigation deployments and qualitative feature maps, not success rates measured on real hardware.
| Approach | Input | Pretraining | For depth robots |
|---|---|---|---|
| RGB foundation models (DINOv2/v3, CLIP, RADIO) | photos | web-scale, self-supervised or with text | must squash depth into a photo; metres lost |
| RGB-D models (DFormer, LingBot-Depth) | photo + depth pairs | paired data | need a colour camera too |
| Point-cloud models (Sonata, Concerto, Utonia) | 3-D points | scans, LiDAR | heavy; struggle with one-view partial clouds |
| Task encoders (from scratch, VAE) | depth | none, or reconstruction | tuned per task and sensor |
| DeFM | depth only | DINOv2 self-distillation, 60 M depth images | frozen, general, 3 M to 304 M weights |
The pieces connect to other lessons on this site. The parent methods are in DINO and DINOv2. Where the estimated depth came from is in Depth Anything V2, and its successor in Depth Anything 3. For depth learned together with colour, compare LingBot-Depth. The noise model of Chapter 1 is the starting point of the Kalman filter, and the RL that trains the policies is PPO, built from zero in PPO.
Now press Present or Teach and explain, out loud and from memory, why DeFM's input has three channels and what goes wrong with each one alone. If you can, you own this paper. Then go back to the robot, pick the Abandoned Cable site, and run ImageNet and DeFM side by side.