Spaces:
Running
Running
File size: 23,142 Bytes
edae745 95f5290 d646dd7 bb59211 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 edae745 d646dd7 95f5290 d646dd7 edae745 d646dd7 edae745 d646dd7 edae745 d646dd7 edae745 d646dd7 edae745 d646dd7 edae745 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 95f5290 d646dd7 edae745 d646dd7 95f5290 d646dd7 95f5290 d646dd7 bb59211 d646dd7 bb59211 d646dd7 | 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 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | Β
# processor
[English](README.md) | [δΈζ](README.zh-CN.md)
> Documentation: 2026-09-28 Β· Backend: `1.19.4` Β· Frontend: `1.12.3`
processor is EgoData's service for data capture, processing, review, and export. It is
designed for embodied AI and robot manipulation data. The system consists of a FastAPI backend,
an asynchronous Worker, Web review pages, and Workflow Studio.
> Beginners: start with the [illustrated user guide](docs/en/README.md).
```text
Capture upload β Project matching β Workflow processing β AI/Human review β LeRobot/HDF5 export
```
## Documentation navigation
- [System overview](#1-system-overview)
- [Installation and startup](#7-installation-and-startup)
- [Code layout](#2-code-layout)
- [Project data structure](#3-project-data-structure)
- [Video data specification](#4-video-data-specification)
- [Workflow modules](#5-workflow-modules)
- [Web Workflow Studio modules](#web-workflow-studio-frontend-module-reference)
- [Processing result storage](#6-processing-result-storage)
- [Configuration](#8-configuration)
- [API](#9-api)
- [Testing and troubleshooting](#10-testing-and-troubleshooting)
## 1. System overview
```text
Capture client
β
βΌ
FastAPI backend
βββ Project, Episode, workflow, and review APIs
βββ Upload reception, extraction, normalization, and validation
βββ Worker task scheduling
β
βΌ
Worker
βββ MediaPipe hand keypoints
βββ RGB-D metric 3D hand keypoints
βββ AI annotation through an API
βββ Video and annotation quality review
β
βΌ
Web review pages
βββ Original RGB video
βββ Browser-side SVG/Canvas keypoint overlays
βββ Pseudo-color depth preview
β
βΌ
LeRobot v2.1 / v3.0 or HDF5
```
The local `processor/` directory is the only source of frontend and backend code. The
remote server provides data storage or SFTP access only; its deprecated frontend and backend
code must not be used as the project source.
## 2. Code layout
<details>
<summary>Click to expand: code layout</summary>
```text
processor/
βββ app/ # FastAPI, storage, workflows, processing, and export logic
βββ worker/ # Asynchronous processing Worker
βββ scripts/ # Deployment, startup, checks, and maintenance scripts
βββ web/
β βββ templates/ # Web page templates
β βββ static/ # CSS, JavaScript, and frontend build artifacts
β βββ workflow-studio/ # React + Vite workflow editor source
βββ tests/ # Automated tests
βββ requirements*.txt # Python dependency manifests
βββ deploy.py # Cross-platform deployment entry point
βββ deploy.sh # Linux deployment entry point
βββ deploy.bat # Windows deployment entry point
βββ .env.example # Configuration template
```
Runtime data is stored under `STORAGE_DIR` by default:
```text
data/
βββ sessions/ # Project datasets
βββ state/ # System state, queues, run records, and export jobs
βββ tmp/ # Upload and Worker temporary files
```
Runtime data, model weights, archives, credentials, and virtual environments must not be
committed to Git. Dependency manifests such as `requirements*.txt` and `package.json` should be
kept in the repository.
</details>
## 3. Project data structure
<details>
<summary>Click to expand: project data structure, Episodes, Chunks, and metadata</summary>
A project is the root directory of one dataset. Its canonical root contains exactly `data/`,
`meta/`, and `videos/`; no additional batch-level data directory is created under the project:
```text
data/sessions/<project>/
βββ data/
β βββ chunk-000/
β βββ episode_000000.parquet
β βββ episode_000001.parquet
βββ meta/
β βββ info.json
β βββ stats.json
β βββ tasks.json
β βββ episodes/
β βββ chunk-000/
β βββ episode_000000.parquet
β βββ episode_000001.parquet
βββ videos/
βββ chunk-000/
βββ observation.images.head_rgb/
β βββ episode_000000.mp4
βββ observation.images.head_depth/
βββ episode_000000.mp4
```
### Episodes and Chunks
- Episode numbering starts at `000000`;
- `episode_000000` through `episode_000999` are stored in `chunk-000`;
- `episode_001000` starts `chunk-001`;
- each chunk contains at most 1,000 Episodes;
- `data`, `meta/episodes`, and `videos` use the same Episode/Chunk mapping;
- the capture batch name is used for business tracking and does not replace the dataset's
`episode_index`.
### Meta directory
The canonical `meta/` directory contains:
- `info.json`: dataset version, FPS, frame counts, features, and path templates;
- `stats.json`: statistics for dataset fields;
- `tasks.json`: task IDs and task descriptions;
- `episodes/chunk-XXX/episode_XXXXXX.parquet`: per-Episode timestamps, device information, video
information, capture metadata, calibration information, and processing state.
Timestamps, device information, and calibration information are written to the corresponding
Episode. Review and annotation pages use only the actual videos, depth streams, and metadata of
the current Episode.
</details>
## 4. Video data specification
<details>
<summary>Click to expand: video sources, depth storage, and browser pseudo-color preview</summary>
### Video sources
| Type | Example source name | Description |
| ------------ | ----------------------------------------- | ------------------------------ |
| Mono RGB | `head_rgb` | Regular RGB video |
| Metric depth | `head_depth` | Independent metric-depth video |
| Stereo RGB | `stereo_left_rgb`, `stereo_right_rgb` | Left and right RGB videos |
| Stereo depth | `stereo_depth` | Independent depth video |
RGB and Depth are always stored as independent streams. A depth-only stream is never treated as
RGB and is never duplicated alongside the RGB stream.
### Depth storage
New metric-depth videos use:
```text
HEVC (H.265) in MP4 / hvc1 / gray12le / qp=6 / range=full
```
The depth video stores 12-bit logarithmic depth codes, not pseudo-color images:
```text
100β5000 mm logarithmic depth β 0..4095 gray12le codes
```
The corresponding feature in `meta/info.json` is marked with `video.is_depth_map=true` and the
depth encoding parameters. Readers dequantize the codes back to millimeters. The original depth
video is preserved during processing and export.
### Frontend depth preview
Pseudo-color depth is used only for browser preview and is never written back to the dataset:
```text
HEVC gray12le
β
βββ Browser Canvas: depth codes β JET pseudo-color
```
Preview color convention:
- invalid depth: black;
- near range: blue-violet;
- middle range: green and yellow;
- far range: orange and red.
Depth preview data is prefetched when an Episode is opened. RGB video, stereo RGB video, and
export data are not pseudo-colorized, and no additional pseudo-color video is generated.
</details>
## 5. Workflow modules
<details>
<summary>Click to expand: input, processing, review, export modules, and node states</summary>
Workflows consist of Input, Process, Review, and Export modules. Ports have explicit data types;
each connected branch processes only the stream connected to that port. A branch without an input
connection is marked `Skipped Β· Missing Input` and does not block other connected branches.
### Input modules
- `RGB Camera`: single-view RGB video;
- `RGB-D Camera`: RGB video and Depth;
- `Stereo RGB Camera`: Left RGB Video and Right RGB Video;
- `Stereo RGB-D Camera`: left/right RGB video and Depth;
- `Glove Sensor`: glove pressure, joint, or sensor data.
### Process modules
- `MediaPipe Hand`: extracts 2D hand keypoints from RGB video;
- `Human Annotation`: manual annotation;
- `AI Annotation`: video/segment annotation through the configured API;
- `RGB_TO_2D_BareHand`: 2D bare-hand keypoints;
- `RGB_TO_2D_BlackGlove`: 2D black-glove keypoints;
- `RGB-D_3D_BareHand`: true metric 3D bare-hand keypoints from RGB video + Depth;
- `RGB-D_3D_BlackGlove`: true metric 3D black-glove keypoints from RGB video + Depth.
The `Spatial` button on `RGB_TO_2D_*` only controls a browser visualization. It does not create
fake 3D data or add 3D values to exports. The `RGB Video` and `Depth` ports on `RGB-D_3D_*` are
independent inputs and should be connected to the corresponding capture outputs.
### Web Workflow Studio frontend module reference
The following modules are the ones currently registered by the frontend palette and canvas. Node
names, port names, and connection types are maintained by the frontend registry and are not
overwritten by a stale workflow or deprecated backend catalog. The legacy types
`rgb_hand_3d`, `black_hand_rgb_3d`, `stereo_triangulate`, and `black_glove_hand` are mapped only
when old workflows are loaded; they are not shown in the new-workflow palette.
#### Capture modules (Input)
| Frontend module | Inputs | Outputs | Purpose and rules |
| ----------------------- | ------ | -------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `RGB Camera` | None | `RGB Video` | Mono RGB video. The device is selected from the current project's data; blank means auto-match. |
| `RGB-D Camera` | None | `RGB Video`, `Depth` | Emits RGB and real depth streams from the same device; Depth can connect only to a depth input. |
| `Stereo RGB Camera` | None | `Left RGB Video`, `Right RGB Video` | Stereo RGB input. Connecting one side creates the corresponding left/right relationship. |
| `Stereo RGB-D Camera` | None | `Left RGB Video`, `Right RGB Video`, `Depth` | Stereo RGB plus real depth; Depth is used by RGB-D 3D processing. |
| `Glove Sensor` | None | `Glove Sensor Data` | Pressure, joint, or glove sensor data; no video output. It can connect directly to quality review. |
#### Video and keypoint processing modules (Process)
| Frontend module | Inputs | Outputs | Purpose and rules |
| ------------------------ | ------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------- |
| `Human Annotation` | `RGB Video` | `Annotation` | Frame-level manual annotation on RGB video. |
| `AI Annotation` | `RGB Video` | `Annotation` | Video/segment annotation through a local or API VLM; API is recommended for deployment. |
| `RGB_TO_2D_BareHand` | `RGB Video` | `Hand 2D` | Bare-hand 2D keypoints.`Spatial` is display-only and exports no metric 3D. |
| `RGB_TO_2D_BlackGlove` | `RGB Video` | `Hand 2D` | Black-glove 2D keypoints. Without Depth, it does not calculate metric 3D. |
| `RGB-D_3D_BareHand` | `RGB Video`, `Depth` | `Hand 3D` | Metric 3D bare-hand keypoints from RGB and real Depth; a missing branch is skipped. |
| `RGB-D_3D_BlackGlove` | `RGB Video`, `Depth` | `Hand 3D` | Metric 3D black-glove keypoints from RGB and real Depth; it does not search the disk or fall back to RGB estimation. |
`MediaPipe Hand` remains available for historical workflows and backend compatibility but is hidden
from the new-workflow palette. All nodes provide hover text describing their purpose and accepted
connection types.
#### Review modules (Review)
| Frontend module | Inputs | Outputs | Purpose and rules |
| --------------------- | ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------ |
| `Human Review` | `Review Target` | `Reviewed Data` | Human inspection of video, keypoints, or annotation results before downstream processing. |
| `AI Quality Review` | `Quality Review Target` | `Reviewed Data` | Checks video decoding, frame continuity, black screens, freezes, annotation coverage, and sensor data. |
#### Export modules (Export)
| Frontend module | Inputs | Outputs | Purpose and rules |
| ------------------ | ------------------- | ----------- | ------------------------------------------------------------------ |
| `LeRobot Export` | `Exportable Data` | `Dataset` | Exports LeRobot v2.1 or v3.0; the version is selected on the node. |
| `HDF5 Export` | `Exportable Data` | `Dataset` | Exports HDF5 with the configured compression parameters. |
#### Workflow Studio UI components
<details>
<summary>Click to expand: frontend component reference</summary>
| UI component | Function |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `NodePalette` | Displays Input, Process, Review, and Export categories; supports search, category collapse, and hover descriptions. |
| `WorkflowCanvas` | Supports drag-and-drop node creation, typed-port connections, node movement, selection, zoom, grid snapping, and minimap navigation. |
| `WorkflowNode` | Renders the card title, ports, project device selector/input,`Spatial` button, and API settings button. |
| `WorkflowDrawer` | Lists workflows, creates new workflows, loads workflows, and refreshes project-specific input sources. |
| `PipelineToolbar` | Provides New, Save, Save As, workflow JSON Export, and Run actions; the yellow dot indicates unsaved changes. |
| `NodeSettingsModal` | Configures AI Annotation API vendor, model, endpoint, and key fields. |
| `DeletableEdge` | Renders data connections; a selected edge can be deleted. |
Device selection is always scoped to the current project. A new empty workflow does not display a
device from another project. After data is uploaded, each card's selector shows only real sources
matching that card's RGB, RGB-D, stereo, or glove category.
</details>
### Review and execution rules
Connect inputs and outputs by their port names. An unconnected processing branch is skipped and
does not affect other branches. RGB-D 3D produces true metric 3D only when both RGB Video and
Depth are available.
Node states are limited to:
```text
Connected
Processing
Completed
Skipped Β· Missing Input
Completed with Warning
```
</details>
## 6. Processing result storage
<details>
<summary>Click to expand: processing results, upload extraction, and cleanup rules</summary>
When a Worker finishes processing, its results are merged into the corresponding Episode:
```text
data/chunk-000/episode_000000.parquet
βββ 2D keypoints, metric 3D, sensor, and annotation fields
meta/episodes/chunk-000/episode_000000.parquet
βββ processing_*, run_id, node states, and output indexes
```
Original RGB/Depth videos are not overwritten. Hand-keypoint previews are overlaid on the original
RGB video in the browser; a second skeleton video is not saved. System-level run records are kept
under `data/state/runs/`, and temporary export products under `data/state/exports/`; neither is
part of the project dataset directory.
The upload archive lifecycle is: receive β extract β normalize β write to project β validate β
update status. Temporary upload files and extraction directories are cleaned only after extraction,
atomic commit, and validation all succeed. On failure, staging content is retained for retry and
diagnosis.
</details>
## 7. Installation and startup
### Linux
```bash
cd "processor"
cp .env.example .env
# Edit .env and set API_KEY, WORKER_API_KEY, JWT_SECRET, and storage settings.
chmod +x deploy.sh
./deploy.sh
```
Common options:
```bash
python deploy.py --check-only # Check only; do not install, change config, or start services.
python deploy.py --skip-vllm # Do not start local VLM; use an API for AI annotation.
python deploy.py --no-services # Run in the foreground without installing startup services.
```
The current AI annotation deployment uses an API. Use `--skip-vllm`, then configure the API vendor,
model, and endpoint in the `AI Annotation` settings in Workflow Studio.
### Windows
```bat
cd /d "processor"
copy .env.example .env && deploy.bat
```
### Start the backend manually
```bash
cd "processor"
source .venv-linux/bin/activate
export PYTHONPATH="$PWD"
./scripts/run_backend_linux.sh
```
Alternatively:
```bash
uvicorn app.main:app --host 0.0.0.0 --port 8000
```
### Start the Worker
```bash
cd "processor"
export EGODATA_SERVER_URL=http://127.0.0.1:8000
export EGODATA_WORKER_API_KEY='same Worker API key as the server'
./scripts/run_worker_linux.sh
```
On Windows, use `scripts/run_worker_windows.ps1`. Linux and Windows virtual environments are
independent and must not be copied between operating systems.
### Workflow Studio
```bash
cd "processor/web/workflow-studio"
npm ci
npm run dev
```
Production build:
```bash
npm run build
```
The build output is written to `web/static/workflow-studio/` and served by FastAPI.
## 8. Configuration
<details>
<summary>Click to expand: environment variables and security configuration</summary>
Configuration is stored in `processor/.env` or environment variables and must not be
committed:
| Setting | Purpose |
| ---------------------- | ------------------------------------------------------ |
| `STORAGE_DIR` | Root directory for data and system state |
| `STORAGE_BACKEND` | `local` or `sftp` |
| `SFTP_*` | Remote data directory and SSH connection settings |
| `API_KEY` | API key for the capture client and protected endpoints |
| `WORKER_API_KEY` | API key used by the Worker to claim and return jobs |
| `JWT_SECRET` | Secret used to sign Web login sessions |
| `UPLOAD_STAGING_DIR` | Local staging directory for upload archives |
| `HOST` / `PORT` | Web/API listen address and port |
| `PUBLIC_BASE_URL` | Public service URL |
See [`.env.example`](.env.example) for the complete template. Production environments must use
random secrets and restrict `.env` permissions. Never put passwords, tokens, API keys, or database
credentials in logs, workflow JSON, frontend code, or documentation.
</details>
## 9. API
<details>
<summary>Click to expand: primary APIs and OpenAPI documentation</summary>
After startup, these endpoints are available:
```text
GET /health
GET /docs
GET /openapi.json
```
Primary API groups:
```text
/api/v1/auth/* Login and authentication
/api/v1/projects/* Projects and Episodes
/api/v1/workflows/* Workflow definitions
/api/v1/session/* Capture-client uploads
/api/v1/video/* Video, depth, and keypoint previews
/api/v1/annotations/* Annotation and review
/api/v1/export/* Dataset export
/api/v1/worker/* Worker job claiming and callbacks
```
The running FastAPI OpenAPI document is the authoritative API contract.
</details>
## 10. Testing and troubleshooting
<details>
<summary>Click to expand: test commands and common troubleshooting steps</summary>
Backend and Worker checks:
```bash
cd "processor"
python -m compileall app worker
python deploy.py --check-only
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -q tests/test_depth_codec.py
```
Frontend check:
```bash
cd "processor/web/workflow-studio"
npm run build
```
Troubleshooting order:
1. Open `/health` and confirm that the service and storage are available;
2. check that `STORAGE_DIR` points to the actual data directory;
3. inspect the upload status and the actual files for the current Episode;
4. check that the Worker is online, can claim jobs, and sends heartbeats;
5. verify that Episode numbering matches across `data`, `meta/episodes`, and `videos`;
6. for RGB-D 3D nodes, verify that `RGB Video` and `Depth` are connected separately;
7. if depth preview is incorrect, verify that the video uses `gray12le` and is not a pseudo-color
preview saved as source depth data.
</details>
## 11. Versioning
<details>
<summary>Click to expand: version maintenance rules</summary>
- The backend version is maintained in `app/version.py` and covers the backend **only**;
- **the frontend version is maintained in `web/VERSION`**. It covers every piece of frontend
code under `processor/web/` (`templates/`, `static/`, `workflow-studio/`) β **not just the
React SPA**. The version inside `web/workflow-studio/package.json` only represents the SPA
itself; all three numbers are independent and do not need to stay in sync.
- **Bump `web/VERSION` β that one file β whenever you change the frontend.** A single number
serves two purposes: β the `?v={{ asset_version }}` cache key on static assets (so browsers
re-fetch changed JS/CSS), β‘ the "frontend X" part of commit messages. Sharing one number
means the commit message can never disagree with what the browser actually loaded.
You do **not** need to touch the backend version for a frontend change.
- `web/VERSION` is read once at startup and cached (`app/web_version.py`), so **restart the
service** after bumping it.
- increment the patch version for fixes and small adjustments, the minor version for new features,
and the major version for architectural changes;
- before release, record the software version, data format, and API changes together.
Current versions: backend `1.19.4`, frontend `1.12.3`.
</details>
|