File size: 8,310 Bytes
f9b94bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80d32d0
f9b94bf
 
 
80d32d0
f9b94bf
 
 
80d32d0
f9b94bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
---
license: apache-2.0
library_name: transformers
pipeline_tag: robotics
tags:
  - vision-language-action
  - robotics
  - embodied-ai
  - minicpm
  - visual-tracking
---

<h1 align="center">
  MiniCPM-RobotTrack
</h1>

<p align="center">
  <strong>A Compact Vision-Language-Action Policy for Embodied target Tracking</strong>
</p>

<p align="center">
    <span style="display: inline-flex; align-items: center; margin-right: 2px;">
    <img src="assets/github.png" alt="github" width="15" height="15" style="margin-right: 4px;">
    <a href="https://github.com/OpenBMB/MiniCPM-Robot" target="_blank"> Github</a> &nbsp;|
    </span>
    <span style="display: inline-flex; align-items: center; margin-right: 2px;">
    <img src="assets/x.jpg" alt="X" width="15" height="15" style="margin-right: 4px;">
    <a href="https://huggingface.co/openbmb/MiniCPM-RobotTrack/resolve/main/assets/x.png" target="_blank"> X</a> &nbsp;|
    </span>
    <span style="display: inline-flex; align-items: center; margin-right: 2px;">
    <img src="assets/discord.png" alt="Discord" width="15" height="15" style="margin-right: 4px;">
    <a href="https://huggingface.co/openbmb/MiniCPM-RobotTrack/resolve/main/assets/discord.jpg" target="_blank"> Discord</a> &nbsp;|
    </span>
</p>

<strong>MiniCPM-RobotTrack</strong> is a compact vision-language-action model built on MiniCPM4-0.5B for target tracking with the following highlights:
<ul>
  <li><b>Language-conditioned target tracking:</b> The model combines natural-language instructions with fused DINOv3 and SigLIP visual features, then directly predicts eight future <code>[x, y, yaw]</code> waypoints for embodied person following.</li>
  <li><b>Quality-driven Self-evolving Data:</b> Automated checks and manual review remove abnormal trajectories, incorrect actions, and invalid interactions. DAgger-style model-environment interaction continually adds difficult samples involving target crossings, rapid turns, short occlusions, and multi-person intersections.</li>
  <li><b>Efficient On-device Inference:</b> Joint optimization of visual capture, input encoding, model inference, action generation, command transmission, and execution delivers a stable <b>5+ FPS</b> with approximately <b>180 ms</b> end-to-end latency on the Unitree Go2's native onboard compute.</li>
</ul>

<table align="center">
  <tr>
    <td align="center" width="33%">
      <img src="assets/track1.gif" width="100%" alt="Outdoor obstacle-aware person-tracking demo" />
    </td>
    <td align="center" width="33%">
      <img src="assets/track2.gif" width="100%" alt="Elevator person-tracking demo" />
    </td>
    <td align="center" width="33%">
      <img src="assets/track3.gif" width="100%" alt="Underground parking person-tracking demo" />
    </td>
  </tr>
  <tr>
    <td align="center"><b>Outdoor Obstacle-aware Tracking</b></td>
    <td align="center"><b>Elevator Tracking</b></td>
    <td align="center"><b>Underground Parking Tracking</b></td>
  </tr>
</table>

## Benchmark Results
<p align="center">
  <img src="assets/metric.png" width="700" alt="MiniCPM-RobotTrack benchmark results" />
</p>

## Inference Example

Please ensure `transformers>=4.56,<5`.

<pre><code class="language-python">from __future__ import annotations

from pathlib import Path

import torch
from transformers import AutoModel, AutoTokenizer


VISION_FEATURE_DIM = 1536
HISTORY_FRAMES = 31
COARSE_TOKENS_PER_FRAME = 4
FINE_TOKENS_CURRENT_FRAME = 64


class MiniCPMRobotTrackInference:
    """Tokenizer and model wrapper for MiniCPM-RobotTrack inference."""

    def __init__(
        self,
        checkpoint_path: str | Path = "openbmb/MiniCPM-RobotTrack",
        device: str | torch.device | None = None,
    ):
        if device is None:
            device = "cuda" if torch.cuda.is_available() else "cpu"
        self.device = torch.device(device)
        checkpoint = str(checkpoint_path)

        self.tokenizer = AutoTokenizer.from_pretrained(checkpoint)
        if self.tokenizer.pad_token_id is None:
            self.tokenizer.pad_token = self.tokenizer.eos_token

        self.model = AutoModel.from_pretrained(
            checkpoint,
            trust_remote_code=True,
        )
        self.model.to(self.device).eval()

    @staticmethod
    def _prepare_visual_tokens(
        tokens: torch.Tensor,
        time_indices: torch.Tensor,
        name: str,
    ) -> tuple[torch.Tensor, torch.Tensor]:
        tokens = torch.as_tensor(tokens, dtype=torch.float32)
        time_indices = torch.as_tensor(time_indices, dtype=torch.long)

        if tokens.ndim == 2:
            tokens = tokens.unsqueeze(0)
        if time_indices.ndim == 1:
            time_indices = time_indices.unsqueeze(0)
        if tokens.ndim != 3 or tokens.shape[-1] != VISION_FEATURE_DIM:
            raise ValueError(
                f"{name}_tokens must have shape [B, N, {VISION_FEATURE_DIM}]"
            )
        if time_indices.shape != tokens.shape[:2]:
            raise ValueError(
                f"{name}_time_indices must match the first two dimensions of "
                f"{name}_tokens"
            )
        return tokens, time_indices

    @torch.inference_mode()
    def predict(
        self,
        instruction: str,
        coarse_tokens: torch.Tensor,
        coarse_time_indices: torch.Tensor,
        fine_tokens: torch.Tensor,
        fine_time_indices: torch.Tensor,
    ) -> torch.Tensor:
        """Return eight ``[x, y, yaw]`` waypoints for each batch item."""
        coarse_tokens, coarse_time_indices = self._prepare_visual_tokens(
            coarse_tokens,
            coarse_time_indices,
            "coarse",
        )
        fine_tokens, fine_time_indices = self._prepare_visual_tokens(
            fine_tokens,
            fine_time_indices,
            "fine",
        )

        batch_size = coarse_tokens.shape[0]
        if fine_tokens.shape[0] != batch_size:
            raise ValueError("coarse and fine feature batch sizes must match")

        text = self.tokenizer(
            [instruction] * batch_size,
            return_tensors="pt",
            padding=True,
            truncation=True,
            max_length=self.model.config.max_text_tokens,
        )
        outputs = self.model(
            input_ids=text.input_ids.to(self.device),
            attention_mask=text.attention_mask.to(self.device),
            coarse_tokens=coarse_tokens.to(self.device),
            coarse_time_indices=coarse_time_indices.to(self.device),
            fine_tokens=fine_tokens.to(self.device),
            fine_time_indices=fine_time_indices.to(self.device),
        )
        return outputs.trajectories.float().cpu()


if __name__ == "__main__":
    infer_runner = MiniCPMRobotTrackInference()

    # Replace these placeholders with fused DINOv3 + SigLIP features produced
    # by the project preprocessing pipeline.
    coarse_tokens = torch.zeros(
        HISTORY_FRAMES * COARSE_TOKENS_PER_FRAME,
        VISION_FEATURE_DIM,
    )
    coarse_time_indices = torch.arange(HISTORY_FRAMES).repeat_interleave(
        COARSE_TOKENS_PER_FRAME
    )
    fine_tokens = torch.zeros(
        FINE_TOKENS_CURRENT_FRAME,
        VISION_FEATURE_DIM,
    )
    fine_time_indices = torch.full(
        (FINE_TOKENS_CURRENT_FRAME,),
        HISTORY_FRAMES,
        dtype=torch.long,
    )

    trajectory = infer_runner.predict(
        instruction="Follow the person in the red shirt.",
        coarse_tokens=coarse_tokens,
        coarse_time_indices=coarse_time_indices,
        fine_tokens=fine_tokens,
        fine_time_indices=fine_time_indices,
    )
    print(trajectory)  # [1, 8, 3]

</code></pre>



## Acknowledgement

<p>
  This project builds on and references
  <a href="https://github.com/OpenBMB/MiniCPM">MiniCPM</a>,
  <a href="https://github.com/facebookresearch/dinov3">DINOv3</a>,
  <a href="https://huggingface.co/google/siglip-so400m-patch14-384">SigLIP</a>,
  <a href="https://github.com/facebookresearch/habitat-lab">Habitat-Lab</a>,
  <a href="https://github.com/facebookresearch/habitat-sim">Habitat-Sim</a>,
  EVT-Bench,
  and
  <a href="https://github.com/wsakobe/TrackVLA">TrackVLA</a>.
  We thank the authors for their open-source contributions.
</p>

## License

Model weights and code are open-sourced under the [Apache-2.0](./LICENSE) license.