Update model card for defm 1.1.0 and the benchmarks
Browse files- Link the benchmark datasets (ImageNet-1k-Depth, TartanGround, GraspNet) in the card metadata
- Usage: `pip install defm`, loading with `create_defm_model`, and a CNN example
- Model Zoo: corrected parameter counts and the ImageNet-1k-Depth numbers from the released benchmark code
- New Benchmarks section linking the benchmark code and datasets
12345621 unmodified lines282930313233343536373839404142434445464748495051526 unmodified lines5960616263646566676869707172737475767778798081828384---license: apache-2.0pipeline_tag: image-feature-extraction---# DeFM: Learning Foundation Representations from Depth for Robotics21 unmodified lines## 🚀 Usage### 1. Loading the ModelLoad via **TorchHub** for easy integration:```pythonimport torch# Load the 307M Parameter Foundation Modelmodel = torch.hub.load('leggedrobotics/defm:main', 'defm_vit_l14', pretrained=True)model.eval().to("cuda")```### 2. PreprocessingDeFM requires depth maps to be processed into our metric-aware 3-channel format.```pythonfrom defm import preprocess_depth_image# Depth needs to be in meters (numpy array, tensor or PIL image)normalized_depth = preprocess_depth_image(metric_depth, target_size=518, patch_size=14)```### 3. Inference6 unmodified linesclass_token = output[0][1] # (B, C)```For more details, visit our [GitHub repository](https://github.com/leggedrobotics/defm).## 📊 Model ZooThe following table provides a comprehensive overview of the DeFM model family, including architectural parameters, inference latency across training and deployment hardware (224x224), and performance on the ImageNet-1k-Depth benchmark.| Model | Params (M) | RTX 4090 (ms) | Jetson Orin (ms) | Top-5 KNN (%) | Linear Prob (%) | Checkpoint || :--- | :---: | :---: | :---: | :---: | :---: | :---: || **DeFM ViT-L/14** | 307.0 | 624.91 | 72.82 | 84.79 | 71.72 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_vit_l14.pth) || **DeFM ViT-S/14** | 22.1 | 63.76 | 11.92 | 78.06 | 61.54 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_vit_s14.pth) || **DeFM ResNet-50** | 26.2 | 69.39 | 17.79 | 77.63 | 61.54 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_resnet50.pth) || **DeFM ResNet-34** | 21.8 | 33.08 | 13.54 | 72.72 | 54.39 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_resnet34.pth) || **DeFM ResNet-18** | 11.7 | 21.06 | 8.67 | 69.69 | 50.58 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_resnet18.pth) || **DeFM EfficientNet-B6** | 28.98 | 150.98 | 54.11 | 77.81 | 59.23 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b6.pth) || **DeFM EfficientNet-B4** | 14.16 | 86.51 | 39.67 | 74.74 | 54.73 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b4.pth) || **DeFM EfficientNet-B2** | 4.95 | 46.12 | 28.37 | 71.51 | 50.32 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b2.pth) || **DeFM EfficientNet-B0** | 3.01 | 29.39 | 21.04 | 67.98 | 46.17 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b0.pth) || **DeFM RegNetY-1.6GF** | 12.4 | 44.25 | 41.82 | 76.21 | 57.28 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_regnet_y_1_6gf.pth) || **DeFM RegNetY-800MF** | 6.3 | 25.21 | 24.16 | 74.91 | 57.03 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_regnet_y_800mf.pth) || **DeFM RegNetY-400MF** | 4.1 | 17.27 | 25.17 | 72.87 | 50.51 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_regnet_y_400mf.pth) |---## 📖 Citation1234567891021 unmodified lines3233343536373839404142434445464748495051525354555657585960616263646566676869706 unmodified lines7778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135---license: apache-2.0pipeline_tag: image-feature-extractiondatasets:- leggedrobotics/defm-bench-imagenet-depth- leggedrobotics/defm-bench-tartanground- leggedrobotics/defm-bench-graspnet---# DeFM: Learning Foundation Representations from Depth for Robotics21 unmodified lines## 🚀 UsageInstall the package from PyPI:```bashpip install defm```Loading through TorchHub only needs `torch torchvision numpy huggingface_hub omegaconf`.### 1. Loading the ModelLoad via **TorchHub** for easy integration:```pythonimport torch# Load the 304M-parameter foundation modelmodel = torch.hub.load('leggedrobotics/defm:main', 'defm_vit_l14', pretrained=True)model.eval().to("cuda")```or, with the `defm` package installed:```pythonfrom defm.model_factory import create_defm_modelmodel = create_defm_model("defm_vit_l14", pretrained=True) # weights from the Hugging Face Hub```### 2. PreprocessingDeFM requires depth maps to be processed into our metric-aware 3-channel format.```pythonfrom defm import preprocess_depth_image# Depth in meters: (H, W) numpy array, tensor or PIL image. target_size is an int (square) or (H, W).normalized_depth = preprocess_depth_image(metric_depth, target_size=518, patch_size=14).to("cuda")```### 3. Inference6 unmodified linesclass_token = output[0][1] # (B, C)```The CNN models (`defm_resnet50`, `defm_efficientnet_b0`, ...) return a dict instead, and their input height and widthmust be multiples of 32:```pythonmodel = torch.hub.load('leggedrobotics/defm:main', 'defm_resnet50', pretrained=True).eval().to("cuda")normalized_depth = preprocess_depth_image(metric_depth, target_size=(224, 320)).to("cuda")with torch.no_grad():output = model(normalized_depth)class_token = output["global_backbone"] # (B, C)spatial_tokens = output["dense_bifpn"]["P4"] # (B, C, H/16, W/16), the features distilled from the ViT```For more details, visit our [GitHub repository](https://github.com/leggedrobotics/defm).## 📊 Model ZooThe following table provides a comprehensive overview of the DeFM model family, including architectural parameters, inference latency across training and deployment hardware (224x224), and performance on the ImageNet-1k-Depth benchmark.| Model | Params (M) | RTX 4090 BS-128 (ms) | Jetson Orin (ms) | Top-5 KNN (%) | Linear Prob (%) | Checkpoint || :--- | :---: | :---: | :---: | :---: | :---: | :---: || **DeFM ViT-L/14** | 303.7 | 624.91 | 72.82 | 85.42 | 72.76 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_vit_l14.pth) || **DeFM ViT-S/14** | 21.6 | 63.76 | 11.92 | 79.37 | 62.74 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_vit_s14.pth) || **DeFM ResNet-50** | 26.2 | 69.39 | 17.79 | 78.93 | 62.56 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_resnet50.pth) || **DeFM ResNet-34** | 23.3 | 33.08 | 13.54 | 73.84 | 54.78 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_resnet34.pth) || **DeFM ResNet-18** | 11.7 | 21.06 | 8.67 | 70.93 | 51.57 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_resnet18.pth) || **DeFM EfficientNet-B6** | 28.98 | 150.98 | 54.11 | 79.30 | 60.70 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b6.pth) || **DeFM EfficientNet-B4** | 14.16 | 86.51 | 39.67 | 76.45 | 56.24 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b4.pth) || **DeFM EfficientNet-B2** | 4.95 | 46.12 | 28.37 | 72.89 | 51.64 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b2.pth) || **DeFM EfficientNet-B0** | 3.01 | 29.39 | 21.04 | 69.54 | 47.17 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_efficientnet_b0.pth) || **DeFM RegNetY-1.6GF** | 12.4 | 44.25 | 41.82 | 77.96 | 58.88 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_regnet_y_1_6gf.pth) || **DeFM RegNetY-800MF** | 6.3 | 25.21 | 24.16 | 76.43 | 58.62 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_regnet_y_800mf.pth) || **DeFM RegNetY-400MF** | 4.1 | 17.27 | 25.17 | 74.43 | 51.80 | [Download](https://huggingface.co/leggedrobotics/defm/resolve/main/defm_regnet_y_400mf.pth) |---## 📏 Benchmarks[`benchmarks/`](https://github.com/leggedrobotics/defm/blob/main/benchmarks/README.md) reproduces the linear-probe evaluations of the paper for DeFM and all imagebaselines (DINOv2, DINOv3, Depth Anything V2, C-RADIOv3, Theia), loading every model from its officialHugging Face weights:```bashgit clone https://github.com/leggedrobotics/defm && cd defmpip install -e ".[benchmarks]"python -m benchmarks.segmentation --encoder defm_vit_l14 --dataset tartanground # ScanNet, SUN RGB-D, OFFSED, TartanGround, GraspNetpython -m benchmarks.classification --encoder defm_vit_s14 --eval knn linear # ImageNet-1k-Depth```[TartanGround](https://huggingface.co/datasets/leggedrobotics/defm-bench-tartanground), [GraspNet-1Billion](https://huggingface.co/datasets/leggedrobotics/defm-bench-graspnet) and [ImageNet-1k-Depth](https://huggingface.co/datasets/leggedrobotics/defm-bench-imagenet-depth) are downloaded from the Hub; ScanNet, SUN RGB-D and OFFSEDare built from their official releases with the scripts in `scripts/datasets/`. See the[benchmark README](https://github.com/leggedrobotics/defm/blob/main/benchmarks/README.md) for datasets, protocol and results.---## 📖 Citation
README.md+67-16