Datasets:
Publish TraceSpatial RGB and QA Parquet release
Browse filesFiles changed (27)
- README.md+109-57
- data/agibot/train-00000.parquetAdded+3
- data/agibot/train-00001.parquetAdded+3
- data/agibot/train-00002.parquetAdded+3
- data/agibot/train-00003.parquetAdded+3
- data/ca1m/train-00000.parquetAdded+3
- data/ca1m/train-00001.parquetAdded+3
- data/ca1m/train-00002.parquetAdded+3
- data/ca1m/train-00003.parquetAdded+3
- data/droid/train-00000.parquetAdded+3
- data/droid/train-00001.parquetAdded+3
- data/robotwin/train-00000.parquetAdded+3
- data/robotwin/train-00001.parquetAdded+3
- data/robotwin/train-00002.parquetAdded+3
- data/robotwin/train-00003.parquetAdded+3
- data/robotwin/train-00004.parquetAdded+3
- data/scannet/train-00000.parquetAdded+3
- data/scannet/train-00001.parquetAdded+3
- data/scannet/train-00002.parquetAdded+3
- manifest.jsonAdded+192
- scripts/README.template.mdAdded+122
- scripts/USAGE.mdAdded+108
- scripts/convert_dataset.pyAdded+297
- scripts/environment.ymlAdded+8
- scripts/requirements.txtAdded+8
- scripts/test_pipeline.pyAdded+73
- scripts/upload_dataset.pyAdded+89
1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091 unmodified linelanguage:- enpretty_name: TraceSpatial-Tracetags:- robotics- spatial-reasoning- visual-question-answering- trajectoryconfigs:- config_name: previewdata_files:- split: trainpath: preview/*.parquet---# TraceSpatial-TraceRGB images paired with question-answer conversations about object-centric and end-effector-centric trajectories. The annotations include 2D waypoints, depth-augmented waypoints, and lifting 2D waypoints to depth-augmented waypoints.> Preview release. The full dataset has not yet been uploaded. License, attribution, and coordinate conventions are pending author confirmation.## Dataset scopeThis release is intended to contain **RGB images and their corresponding QA only**. Depth maps and precomputed spatial features are not included. Answers may contain depth values as part of the trajectory annotations; these are text annotations, not depth images.## Verified local statistics| Source label | Conversation records | QA pairs | Unique referenced RGB images || --- | ---: | ---: | ---: || AgiBot | 325,846 | 977,538 | 325,846 || CA1M | 338,419 | 1,015,257 | 20,643 || DROID | 105,180 | 105,180 | 20,409 || RoboTwin | 146,587 | 1,070,535 | 146,587 || ScanNet | 151,790 | 455,370 | 3,730 || **Total** | **1,067,822** | **3,623,880** | **517,215** |Source labels follow the supplied metadata filenames. These counts describe the complete local annotations, not the small preview subset. Each QA pair is counted as one assistant answer in an alternating human/assistant conversation.All RGB image references resolve after mapping colons in DROID filenames to underscores, as present in the extracted files. This mapping affects 102,228 image references. Original sample IDs and QA text are preserved.The source image folder contains 604,660 files, including 87,445 files not referenced by the supplied QA. These extra files are not counted as paired examples above.## PreviewThe `preview` configuration contains 104 QA rows, expanded from the first eight valid conversation records per source (40 original records). Each row contains one RGB image and one question-answer pair. Original question and answer text is preserved verbatim. It is illustrative and is not a random sample, benchmark split, or representative estimate of task distribution. Images are embedded in Parquet with the Hugging Face `Image` feature.```pythonfrom datasets import load_datasetdataset = load_dataset("leeibo/TraceSpatial-Trace", "preview", split="train")sample = dataset[0]image = sample["image"]question = sample["question"]answer = sample["answer"]```The preview configuration is separate from the full dataset statistics above.## Preview fields| Field | Meaning || --- | --- || `image` | RGB image, displayed with the Hugging Face Image feature || `question` | Original human question, unchanged || `answer` | Corresponding original assistant answer, unchanged || `type` | Original trajectory type; null when absent || `source` | Source label derived from the metadata filename || `task` | Derived task: `2d_trace`, `3d_trace`, or `2d_to_3d`; null when ambiguous || `id` | Original conversation record ID; repeated across QA pairs || `qa_index` | Zero-based QA pair index within the original record || `record_index` | Zero-based source record position in this preview selection; distinguishes repeated original IDs |Original IDs are not necessarily unique. The tuple (`source`, `record_index`, `qa_index`) identifies a preview row. The original ordered conversation can be reconstructed by grouping on (`source`, `record_index`) and sorting by `qa_index`. No earlier turns are appended to the displayed question.`task` is derived per QA pair by checking the wording of the question against the number of coordinates in each answer waypoint. It is distinct from the original `type` field. Ambiguous cases remain null. A 3D task label describes a depth-augmented answer and does not imply that a depth image is included.### Original type valuesThe following counts cover all original conversation records. Missing values are stored as null and are not inferred from questions or source names.| Source | Type | Records || --- | --- | ---: || AgiBot | end_effector | 274,380 || AgiBot | object | 51,466 || CA1M | not provided (null) | 338,419 || DROID | object | 58,386 || DROID | end_effector | 46,794 || RoboTwin | end_effector | 107,035 || RoboTwin | object | 39,552 || ScanNet | not provided (null) | 151,790 |## Coordinate conventionsAnswers use `(x, y)` or `(x, y, d)` tuples. The input filenames suggest a 0–1000 normalization convention; the exact conversion, depth unit, and coordinate frame still need author confirmation. Do not interpret these tuples as metric Cartesian XYZ coordinates without that information.## Intended use and limitationsIntended for research on visual trajectory prediction and spatial reasoning from RGB inputs and language instructions. No held-out evaluation split has been established by this preparation. Multiple conversations may share an image; any future split should account for shared images and source episodes/scenes to avoid leakage.## License and attributionPending author-provided release license and source-specific attribution/reuse terms. No license is assigned by this draft.## CitationPending author-provided paper or project citation.1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611 unmodified linelanguage:- enpretty_name: TraceSpatial-Tracetask_categories:- visual-question-answeringtags:- robotics- spatial-reasoning- trajectory- arxiv:2512.13660configs:- config_name: previewdefault: truedata_files:- split: trainpath: data/*/*.parquet- config_name: agibotdata_files:- split: trainpath: data/agibot/*.parquet- config_name: ca1mdata_files:- split: trainpath: data/ca1m/*.parquet- config_name: droiddata_files:- split: trainpath: data/droid/*.parquet- config_name: robotwindata_files:- split: trainpath: data/robotwin/*.parquet- config_name: scannetdata_files:- split: trainpath: data/scannet/*.parquet---# TraceSpatial-Trace**RGB images and trajectory question–answer pairs from [RoboTracer](https://zhoues.github.io/RoboTracer/).**[Project](https://zhoues.github.io/RoboTracer/) · [Paper](https://arxiv.org/pdf/2512.13660) · [Code](https://github.com/Zhoues/RoboTracer) · [TraceSpatial-Bench](https://huggingface.co/datasets/JingkunAn/TraceSpatial-Bench)This is a **preview** containing 104 QA rows from 40 original records. Full local-corpus counts are shown below; those are not the size of this preview.## OverviewTraceSpatial-Trace is the trajectory-focused RGB + QA release associated with RoboTracer. It supports research on predicting object and end-effector motion from images and language. Each displayed row contains an RGB image, a question, and its original answer.The broader TraceSpatial collection described by the project contains approximately 30 million QA pairs. **This repository packages the supplied tracing subset: 3,623,880 QA pairs.** It is distinct from the full collection and from TraceSpatial-Bench, the evaluation dataset. [Project overview](https://zhoues.github.io/RoboTracer/)The paper's data pipeline combines planned object motion in reconstructed CA-1M/ScanNet scenes, traces extracted from DROID/AgiBot manipulation recordings, and RoboTwin simulation. Its three tracing tasks predict image-plane waypoints, predict waypoints with depth, or add depth to supplied 2D waypoints. See the paper's dataset section and tracing appendices for the generation and filtering procedures. [Paper](https://arxiv.org/html/2512.13660)This release contains RGB images and QA text. It does not distribute depth maps, camera calibration, precomputed spatial features, videos, robot actions, or the broader collection's reasoning annotations. Depth values appearing in answers are retained.## Corpus statisticsCounts below come from a complete audit of the five supplied annotation files. “Record” means an original conversation, “QA pair” means one human message and its following assistant answer. Several records can refer to the same image.| Source | Original records | QA pairs | Unique referenced RGB images || --- | ---: | ---: | ---: || AgiBot | 325,846 | 977,538 | 325,846 || CA-1M | 338,419 | 1,015,257 | 20,643 || DROID | 105,180 | 105,180 | 20,409 || RoboTwin | 146,587 | 1,070,535 | 146,587 || ScanNet | 151,790 | 455,370 | 3,730 || **Total** | **1,067,822** | **3,623,880** | **517,215** |The extracted image directory has 604,660 files. Of these, 87,445 are not referenced by the supplied QA; the conversion only embeds referenced images. All references resolve after adapting 102,228 DROID references from colon-containing timestamps to the underscore filenames present on disk. Original IDs and QA strings are preserved.## Tasks and coordinate conventions| `task` | Input in addition to RGB | Answer format || --- | --- | --- || `2d_trace` | Task instruction | `[(u1, v1), ...]` || `3d_trace` | Task instruction | `[(u1, v1, d1), ...]` || `2d_to_3d` | Task instruction and 2D waypoints | `[(u1, v1, d1), ...]` |The paper specifies normalized image-plane coordinates **u, v in [0, 1000]**, with **d in meters**. The three-component representation is **(image coordinate, image coordinate, depth)**, not Cartesian XYZ. Recovering metric XYZ requires camera intrinsics, which are not included here. The converter preserves values and does not re-normalize, clamp, or reproject them. [Trace representation](https://arxiv.org/html/2512.13660)`task` is a derived convenience label: the converter checks question wording against answer tuple dimensionality. Ambiguous cases receive null rather than a guessed label. It is not an original annotation field.## Dataset Viewer fields| Field | Description || --- | --- || `image` | Original encoded RGB image, embedded as a Hugging Face `Image` feature || `question` | Original human message, unchanged || `answer` | Its following assistant message, unchanged || `type` | Original `object` or `end_effector` annotation; null if absent || `source` | `agibot`, `ca1m`, `droid`, `robotwin`, or `scannet` || `task` | Derived task label described above || `id` | Original conversation ID; not guaranteed unique || `qa_index` | Zero-based question–answer position within the original conversation || `record_index` | Zero-based record position in its source annotation file |The tuple `(source, record_index, qa_index)` uniquely identifies a converted row. Group by `(source, record_index)` and sort by `qa_index` to reconstruct the original conversation. The displayed question does not have earlier turns appended; retain the grouped conversation for applications that require dialogue context.Missing `type` values are preserved. CA-1M and ScanNet do not provide this field in the supplied files, even though the paper describes their tracing pipeline as object-centric.| Source | `end_effector` records | `object` records | Missing `type` || --- | ---: | ---: | ---: || AgiBot | 274,380 | 51,466 | 0 || CA-1M | 0 | 0 | 338,419 || DROID | 46,794 | 58,386 | 0 || RoboTwin | 107,035 | 39,552 | 0 || ScanNet | 0 | 0 | 151,790 |## Loading```pythonfrom datasets import load_datasetdata = load_dataset("leeibo/TraceSpatial-Trace","preview",split="train",streaming=True,)example = next(iter(data))print(example["source"], example["type"], example["task"])print(example["question"])print(example["answer"])example["image"].save("example.png")```Use your authenticated HF account while this repository is private. Available configurations are listed in the Viewer/configuration metadata. The conversion scripts produce source-specific configurations and an `all` configuration for a full conversion; limited runs produce a `preview` configuration. The initial uploaded preview has 104 QA rows from the first eight records of each source and is illustrative, not randomly sampled.`train` is a packaging split, not evidence of an official train/test partition. For evaluation, avoid splitting related images or episodes across partitions. No evaluation results are claimed for this release.## Reproducible conversion and uploadThe [`scripts/`](scripts/) directory contains a multi-process JSON-to-Parquet converter, a resumable concurrent uploader, pinned environment files, and a Chinese [usage guide](scripts/USAGE.md).The converter streams JSON, preserves original image bytes and QA strings, writes bounded row groups, and checkpoints complete shards. It creates a manifest with per-file SHA-256 hashes, row counts, source statistics, and task-label counts. Original files are never modified. Shards may contain repeated image bytes because each row is independently usable; Parquet compression and dictionary encoding reduce repeated storage within row groups.## Provenance and acknowledgmentThis release is associated with the [RoboTracer project](https://zhoues.github.io/RoboTracer/). We acknowledge the source datasets and assets listed by its [official repository](https://github.com/Zhoues/RoboTracer): AgiBot World, CA-1M, DROID, RoboTwin 2.0, and ScanNet. The scripts in this repository package the supplied annotations for HF; they do not reproduce the upstream simulation and annotation-generation pipelines.## LicenseThe release-specific dataset license has not yet been supplied by the maintainer. No dataset license is inferred from the project website or code repository. Source data remain subject to their applicable original terms; this card does not grant additional rights.## CitationPlease cite the RoboTracer paper when using this data. The project page uses the earlier title, “RoboTracer: Mastering Spatial Trace with Reasoning in Vision-Language Models for Robotics.” The current arXiv v4 has the updated title below; both refer to arXiv:2512.13660. [Version history](https://arxiv.org/abs/2512.13660)```bibtex@misc{zhou2025robotracer,title={Towards Spatial Trace with Reasoning in Vision-Language Models for Robotics},author={Enshen Zhou and Yibo Li and Jingkun An and Jiayuan Zhang and Shanyu Rong and Mengzhen Liu and Yi Han and Yuheng Ji and Huajie Tan and Jiawei He and Pengwei Wang and Zhongyuan Wang and Cheng Chi and Lu Sheng and Shanghang Zhang},year={2025},eprint={2512.13660},archivePrefix={arXiv},primaryClass={cs.RO},url={https://arxiv.org/abs/2512.13660}}```
123version https://git-lfs.github.com/spec/v1oid sha256:b504664fb02346ea60d8e7103e20745f1eed95f16014c75f2248d5c91934ebecsize 611490123version https://git-lfs.github.com/spec/v1oid sha256:546bb460b50daf2da6a3ed4b6e09e62f5b9203892cd47b4853edd8bb3ad47c60size 559892123version https://git-lfs.github.com/spec/v1oid sha256:489645abd661b8e80237517dd5c4be1c1302501b721e2b3ab841fe204b9dc46dsize 574754123version https://git-lfs.github.com/spec/v1oid sha256:89c487e1c31a8f1405a48db1c54a6e6c1c31317a4e5d14521e1b8ffd3eae3231size 609072123version https://git-lfs.github.com/spec/v1oid sha256:a37ab591fe9c04d5c607dbf49a7d7c92f73fa66f2477d69f56c755154fba9c52size 589750123version https://git-lfs.github.com/spec/v1oid sha256:ed00007235302b3e4debba8370301f7dfbcae9200c96f33d15aafca0e18edda1size 576782123version https://git-lfs.github.com/spec/v1oid sha256:f0400e65e797760e88e3cd5df064ee0c85dfc8d628a2501d19dbc4fe84d2732bsize 563306123version https://git-lfs.github.com/spec/v1oid sha256:bdf495c60441ccd3d626596d29cf3ac6f02531d86a6277fba6f229dded8df5fcsize 562845123version https://git-lfs.github.com/spec/v1oid sha256:92e705f6d6f3f6f8e7f5447adc37813a2648a40044e1459c4c039ce7f257e553size 497899123version https://git-lfs.github.com/spec/v1oid sha256:32d64408a8fb01734e9cf78cac6e8c607a8ca4b22175151bb1ccb584a53eacacsize 515405123version https://git-lfs.github.com/spec/v1oid sha256:34c8278efb35a28ff7e8f4f1a4648f652fca3674878039cc254070176180ec58size 567207123version https://git-lfs.github.com/spec/v1oid sha256:8813c6b13ac3c6332ff563bc047545c5c47eeb0d7b2f466848ee22aa27b77ed0size 688916123version https://git-lfs.github.com/spec/v1oid sha256:311d9c6bb515f289c36cb5d9e6b43dae0adc7b89bf50833ecbf0606d4138d2c6size 744897123version https://git-lfs.github.com/spec/v1oid sha256:e38cb25e9931c80f3fae49615918b475f3016c2a821f37ad28fa85cd7140eca6size 725168123version https://git-lfs.github.com/spec/v1oid sha256:8a3ff075b792215493054963d8799e42da65a3b8a559b13fd82b5aec5de1850csize 737428123version https://git-lfs.github.com/spec/v1oid sha256:793851099c2fe6d809827ab37b6f18802c3d25f9acadaf81ee80de8cab1d3a8esize 266840123version https://git-lfs.github.com/spec/v1oid sha256:852b1766484fc442c7011bd6482ca9a972d4a2ddd6ce74855811e3303851b012size 266626123version https://git-lfs.github.com/spec/v1oid sha256:40e006ac76b1a3b7f3f6f08526160f57a1f2593cf8f5ddb060a3ae564a9a7f6fsize 135143123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192{
"version": 1,
"complete": true,
"limited": true,
"sources": [
"agibot",
"ca1m",
"droid",
"robotwin",
"scannet"
],
"records": 40,
"qa_rows": 104,
"files": [
{
"path": "data/agibot/train-00000.parquet",
"rows": 6,
"bytes": 611490,
"sha256": "b504664fb02346ea60d8e7103e20745f1eed95f16014c75f2248d5c91934ebec"
},
{
"path": "data/agibot/train-00001.parquet",
"rows": 6,
"bytes": 559892,
"sha256": "546bb460b50daf2da6a3ed4b6e09e62f5b9203892cd47b4853edd8bb3ad47c60"
},
{
"path": "data/agibot/train-00002.parquet",
"rows": 6,
"bytes": 574754,
"sha256": "489645abd661b8e80237517dd5c4be1c1302501b721e2b3ab841fe204b9dc46d"
},
{
"path": "data/agibot/train-00003.parquet",
"rows": 6,
"bytes": 609072,
"sha256": "89c487e1c31a8f1405a48db1c54a6e6c1c31317a4e5d14521e1b8ffd3eae3231"
},
{
"path": "data/ca1m/train-00000.parquet",
"rows": 6,
"bytes": 589750,
"sha256": "a37ab591fe9c04d5c607dbf49a7d7c92f73fa66f2477d69f56c755154fba9c52"
},
{
"path": "data/ca1m/train-00001.parquet",
"rows": 6,
"bytes": 576782,
"sha256": "ed00007235302b3e4debba8370301f7dfbcae9200c96f33d15aafca0e18edda1"
},
{
"path": "data/ca1m/train-00002.parquet",
"rows": 6,
"bytes": 563306,
"sha256": "f0400e65e797760e88e3cd5df064ee0c85dfc8d628a2501d19dbc4fe84d2732b"
},
{
"path": "data/ca1m/train-00003.parquet",
"rows": 6,
"bytes": 562845,
"sha256": "bdf495c60441ccd3d626596d29cf3ac6f02531d86a6277fba6f229dded8df5fc"
},
{
"path": "data/droid/train-00000.parquet",
"rows": 5,
"bytes": 497899,
"sha256": "92e705f6d6f3f6f8e7f5447adc37813a2648a40044e1459c4c039ce7f257e553"
},
{
"path": "data/droid/train-00001.parquet",
"rows": 3,
"bytes": 515405,
"sha256": "32d64408a8fb01734e9cf78cac6e8c607a8ca4b22175151bb1ccb584a53eacac"
},
{
"path": "data/robotwin/train-00000.parquet",
"rows": 6,
"bytes": 567207,
"sha256": "34c8278efb35a28ff7e8f4f1a4648f652fca3674878039cc254070176180ec58"
},
{
"path": "data/robotwin/train-00001.parquet",
"rows": 6,
"bytes": 688916,
"sha256": "8813c6b13ac3c6332ff563bc047545c5c47eeb0d7b2f466848ee22aa27b77ed0"
},
{
"path": "data/robotwin/train-00002.parquet",
"rows": 6,
"bytes": 744897,
"sha256": "311d9c6bb515f289c36cb5d9e6b43dae0adc7b89bf50833ecbf0606d4138d2c6"
},
{
"path": "data/robotwin/train-00003.parquet",
"rows": 3,
"bytes": 725168,
"sha256": "e38cb25e9931c80f3fae49615918b475f3016c2a821f37ad28fa85cd7140eca6"
},
{
"path": "data/robotwin/train-00004.parquet",
"rows": 3,
"bytes": 737428,
"sha256": "8a3ff075b792215493054963d8799e42da65a3b8a559b13fd82b5aec5de1850c"
},
{
"path": "data/scannet/train-00000.parquet",
"rows": 9,
"bytes": 266840,
"sha256": "793851099c2fe6d809827ab37b6f18802c3d25f9acadaf81ee80de8cab1d3a8e"
},
{
"path": "data/scannet/train-00001.parquet",
"rows": 9,
"bytes": 266626,
"sha256": "852b1766484fc442c7011bd6482ca9a972d4a2ddd6ce74855811e3303851b012"
},
{
"path": "data/scannet/train-00002.parquet",
"rows": 6,
"bytes": 135143,
"sha256": "40e006ac76b1a3b7f3f6f08526160f57a1f2593cf8f5ddb060a3ae564a9a7f6f"
}
],
"source_statistics": {
"agibot": {
"next_record": 8,
"qa_rows": 24,
"mapped_image_records": 0,
"task_counts": {
"3d_trace": 8,
"2d_trace": 8,
"2d_to_3d": 8
},
"type_counts": {
"end_effector": 8
}
},
"ca1m": {
"next_record": 8,
"qa_rows": 24,
"mapped_image_records": 0,
"task_counts": {
"2d_trace": 8,
"3d_trace": 8,
"2d_to_3d": 8
},
"type_counts": {
"(missing)": 8
}
},
"droid": {
"next_record": 8,
"qa_rows": 8,
"mapped_image_records": 8,
"task_counts": {
"2d_to_3d": 4,
"3d_trace": 2,
"2d_trace": 2
},
"type_counts": {
"object": 4,
"end_effector": 4
}
},
"robotwin": {
"next_record": 8,
"qa_rows": 24,
"mapped_image_records": 0,
"task_counts": {
"2d_trace": 8,
"3d_trace": 8,
"2d_to_3d": 8
},
"type_counts": {
"end_effector": 8
}
},
"scannet": {
"next_record": 8,
"qa_rows": 24,
"mapped_image_records": 0,
"task_counts": {
"2d_trace": 9,
"2d_to_3d": 7,
"3d_trace": 8
},
"type_counts": {
"(missing)": 8
}
}
}
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122# TraceSpatial-Trace
**RGB images and trajectory question–answer pairs from [RoboTracer](https://zhoues.github.io/RoboTracer/).**
[Project](https://zhoues.github.io/RoboTracer/) · [Paper](https://arxiv.org/pdf/2512.13660) · [Code](https://github.com/Zhoues/RoboTracer) · [TraceSpatial-Bench](https://huggingface.co/datasets/JingkunAn/TraceSpatial-Bench)
@@STATUS@@
## Overview
TraceSpatial-Trace is the trajectory-focused RGB + QA release associated with RoboTracer. It supports research on predicting object and end-effector motion from images and language. Each displayed row contains an RGB image, a question, and its original answer.
The broader TraceSpatial collection described by the project contains approximately 30 million QA pairs. **This repository packages the supplied tracing subset: 3,623,880 QA pairs.** It is distinct from the full collection and from TraceSpatial-Bench, the evaluation dataset. [Project overview](https://zhoues.github.io/RoboTracer/)
The paper's data pipeline combines planned object motion in reconstructed CA-1M/ScanNet scenes, traces extracted from DROID/AgiBot manipulation recordings, and RoboTwin simulation. Its three tracing tasks predict image-plane waypoints, predict waypoints with depth, or add depth to supplied 2D waypoints. See the paper's dataset section and tracing appendices for the generation and filtering procedures. [Paper](https://arxiv.org/html/2512.13660)
This release contains RGB images and QA text. It does not distribute depth maps, camera calibration, precomputed spatial features, videos, robot actions, or the broader collection's reasoning annotations. Depth values appearing in answers are retained.
## Corpus statistics
Counts below come from a complete audit of the five supplied annotation files. “Record” means an original conversation, “QA pair” means one human message and its following assistant answer. Several records can refer to the same image.
| Source | Original records | QA pairs | Unique referenced RGB images |
| --- | ---: | ---: | ---: |
| AgiBot | 325,846 | 977,538 | 325,846 |
| CA-1M | 338,419 | 1,015,257 | 20,643 |
| DROID | 105,180 | 105,180 | 20,409 |
| RoboTwin | 146,587 | 1,070,535 | 146,587 |
| ScanNet | 151,790 | 455,370 | 3,730 |
| **Total** | **1,067,822** | **3,623,880** | **517,215** |
The extracted image directory has 604,660 files. Of these, 87,445 are not referenced by the supplied QA; the conversion only embeds referenced images. All references resolve after adapting 102,228 DROID references from colon-containing timestamps to the underscore filenames present on disk. Original IDs and QA strings are preserved.
## Tasks and coordinate conventions
| `task` | Input in addition to RGB | Answer format |
| --- | --- | --- |
| `2d_trace` | Task instruction | `[(u1, v1), ...]` |
| `3d_trace` | Task instruction | `[(u1, v1, d1), ...]` |
| `2d_to_3d` | Task instruction and 2D waypoints | `[(u1, v1, d1), ...]` |
The paper specifies normalized image-plane coordinates **u, v in [0, 1000]**, with **d in meters**. The three-component representation is **(image coordinate, image coordinate, depth)**, not Cartesian XYZ. Recovering metric XYZ requires camera intrinsics, which are not included here. The converter preserves values and does not re-normalize, clamp, or reproject them. [Trace representation](https://arxiv.org/html/2512.13660)
`task` is a derived convenience label: the converter checks question wording against answer tuple dimensionality. Ambiguous cases receive null rather than a guessed label. It is not an original annotation field.
## Dataset Viewer fields
| Field | Description |
| --- | --- |
| `image` | Original encoded RGB image, embedded as a Hugging Face `Image` feature |
| `question` | Original human message, unchanged |
| `answer` | Its following assistant message, unchanged |
| `type` | Original `object` or `end_effector` annotation; null if absent |
| `source` | `agibot`, `ca1m`, `droid`, `robotwin`, or `scannet` |
| `task` | Derived task label described above |
| `id` | Original conversation ID; not guaranteed unique |
| `qa_index` | Zero-based question–answer position within the original conversation |
| `record_index` | Zero-based record position in its source annotation file |
The tuple `(source, record_index, qa_index)` uniquely identifies a converted row. Group by `(source, record_index)` and sort by `qa_index` to reconstruct the original conversation. The displayed question does not have earlier turns appended; retain the grouped conversation for applications that require dialogue context.
Missing `type` values are preserved. CA-1M and ScanNet do not provide this field in the supplied files, even though the paper describes their tracing pipeline as object-centric.
| Source | `end_effector` records | `object` records | Missing `type` |
| --- | ---: | ---: | ---: |
| AgiBot | 274,380 | 51,466 | 0 |
| CA-1M | 0 | 0 | 338,419 |
| DROID | 46,794 | 58,386 | 0 |
| RoboTwin | 107,035 | 39,552 | 0 |
| ScanNet | 0 | 0 | 151,790 |
## Loading
```python
from datasets import load_dataset
data = load_dataset(
"leeibo/TraceSpatial-Trace",
"@@CONFIG@@",
split="train",
streaming=True,
)
example = next(iter(data))
print(example["source"], example["type"], example["task"])
print(example["question"])
print(example["answer"])
example["image"].save("example.png")
```
Use your authenticated HF account while this repository is private. Available configurations are listed in the Viewer/configuration metadata. The conversion scripts produce source-specific configurations and an `all` configuration for a full conversion; limited runs produce a `preview` configuration. The initial uploaded preview has 104 QA rows from the first eight records of each source and is illustrative, not randomly sampled.
`train` is a packaging split, not evidence of an official train/test partition. For evaluation, avoid splitting related images or episodes across partitions. No evaluation results are claimed for this release.
## Reproducible conversion and upload
The [`scripts/`](scripts/) directory contains a multi-process JSON-to-Parquet converter, a resumable concurrent uploader, pinned environment files, and a Chinese [usage guide](scripts/USAGE.md).
The converter streams JSON, preserves original image bytes and QA strings, writes bounded row groups, and checkpoints complete shards. It creates a manifest with per-file SHA-256 hashes, row counts, source statistics, and task-label counts. Original files are never modified. Shards may contain repeated image bytes because each row is independently usable; Parquet compression and dictionary encoding reduce repeated storage within row groups.
## Provenance and acknowledgment
This release is associated with the [RoboTracer project](https://zhoues.github.io/RoboTracer/). We acknowledge the source datasets and assets listed by its [official repository](https://github.com/Zhoues/RoboTracer): AgiBot World, CA-1M, DROID, RoboTwin 2.0, and ScanNet. The scripts in this repository package the supplied annotations for HF; they do not reproduce the upstream simulation and annotation-generation pipelines.
## License
The release-specific dataset license has not yet been supplied by the maintainer. No dataset license is inferred from the project website or code repository. Source data remain subject to their applicable original terms; this card does not grant additional rights.
## Citation
Please cite the RoboTracer paper when using this data. The project page uses the earlier title, “RoboTracer: Mastering Spatial Trace with Reasoning in Vision-Language Models for Robotics.” The current arXiv v4 has the updated title below; both refer to arXiv:2512.13660. [Version history](https://arxiv.org/abs/2512.13660)
```bibtex
@misc{zhou2025robotracer,
title={Towards Spatial Trace with Reasoning in Vision-Language Models for Robotics},
author={Enshen Zhou and Yibo Li and Jingkun An and Jiayuan Zhang and Shanyu Rong and Mengzhen Liu and Yi Han and Yuheng Ji and Huajie Tan and Jiawei He and Pengwei Wang and Zhongyuan Wang and Cheng Chi and Lu Sheng and Shanghang Zhang},
year={2025},
eprint={2512.13660},
archivePrefix={arXiv},
primaryClass={cs.RO},
url={https://arxiv.org/abs/2512.13660}
}
```123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108# TraceSpatial-Trace 转换与上传
这套脚本把已有 RGB + QA 数据转换为 HF Dataset Viewer 可直接浏览的 Parquet。它不是 RoboTracer 上游数据生成或训练代码。
## 环境
本机已安装环境 `tracespatial-hf`。在 Miniforge Prompt 中执行:
```powershellconda activate tracespatial-hfcd C:\Users\lee\Desktop\TraceSpatial-release-work\release\scripts```
其他机器在本目录运行:
```powershellconda env create -f environment.ymlconda activate tracespatial-hf```
已有 Python 3.11 环境也可用 `python -m pip install -r requirements.txt`。不需要 CUDA/GPU。
## 小样本验证
```powershellpython convert_dataset.py --input "C:\Users\lee\Desktop\TraceSpatial-Trace\TraceSpatial-Trace" --output "C:\Users\lee\Desktop\TraceSpatial-preview-build" --workers 5 --limit-records 8 --verify-images```
每个来源取前 8 条原始记录,然后拆出全部 QA。`preview` 仅是演示子集,不是统计随机样本或测试集。
## 全量多进程转换
```powershellpython convert_dataset.py --input "C:\Users\lee\Desktop\TraceSpatial-Trace\TraceSpatial-Trace" --output "C:\Users\lee\Desktop\TraceSpatial-full-release" --workers 5 --shard-mib 512 --row-group-mib 32```
- 原始 `images/` 和 `metadata/` 不修改。只读取被 QA 引用的 RGB 图像。- 一个来源一个进程,本数据包最多 5 个并发进程。增加到 8 不会超过 5 个来源的并行度。- 每行独立包含 RGB、问题、答案、type、source、task、id、qa_index、record_index。- `record_index` 是原始 JSON 数组中的位置。重复 id 不去重,也不丢失问答。- 保留原始图像字节,不重编码;保留原始 QA 字符串;缺失 type 留 null。- 严格检查单图引用、配对角色与文本类型;遇到缺图或格式错误会报错,不静默跳过。- `--verify-images` 可额外对所有引用图像解码校验,代价是更长运行时间。- 512 MiB 指近似未压缩内容阈值,实际 Parquet 大小取决于压缩;分片在整条原始记录结束后切分,单条超大记录可能超过阈值。- 每个 row group 约 32 MiB,最多 128 行,单张图片上限 64 MiB。Arrow 的编码缓冲会额外占内存,建议从 3–5 个进程开始。- 每行嵌入图像,逻辑内容量会因重复图像超过原始包;字典编码与 Zstd 减少行组内重复。不要把 189.6 GB 原始大小当作发布文件大小。
## 中断与续跑
原命令再次执行即可。每个完整分片写入 `.state/<source>.json` 后才算完成;已完成分片会校验 SHA-256 并跳过,不完整分片重新写入。恢复时仍需流式跳过 JSON 前面的记录。
保持原始图片不变。恢复身份会检查 JSON 路径、大小、mtime、脚本哈希和转换参数,但不会给 50 多万张原始图片逐一建立内容快照。原图或元数据、转换参数、代码发生变化时,应使用新的输出目录。改变 `--workers` 不改变数据,可以用于调整并发。
`.state/conversion.log` 保存来源级进度;终端显示逐分片进度。Windows 后台启动示例:
```powershellStart-Process -FilePath "$env:CONDA_PREFIX\python.exe" -ArgumentList @('convert_dataset.py', '--input', '"C:\Users\lee\Desktop\TraceSpatial-Trace\TraceSpatial-Trace"', '--output', '"C:\Users\lee\Desktop\TraceSpatial-full-release"', '--workers', '5') -WorkingDirectory (Get-Location).Path -WindowStyle Hidden -RedirectStandardOutput '..\conversion.stdout.log' -RedirectStandardError '..\conversion.stderr.log'```
只在没有其他转换进程使用同一输出目录时启动;脚本还会通过文件锁阻止并发写入。
## 上传
先登录,不要将 token 写入脚本:
```powershellhf auth loginhf auth whoami```
先校验文件和展示计划(无网络写入):
```powershellpython upload_dataset.py --folder "C:\Users\lee\Desktop\TraceSpatial-full-release" --repo-id leeibo/TraceSpatial-Trace --workers 4```
正式上传:
```powershellpython upload_dataset.py --folder "C:\Users\lee\Desktop\TraceSpatial-full-release" --repo-id leeibo/TraceSpatial-Trace --workers 4 --execute```
默认使用当前 `upload_folder` + `hf_xet` 的并发、分批提交与续传实现。`--workers` 默认控制本地 SHA-256 并行验证;现代上传路径的网络并发由 SDK/Xet 管理。必须安装 requirements 中的 hf-xet。
如需明确控制 SDK 上传 worker 数,可以额外指定 `--legacy-workers`:它使用当前仍可用但上游已弃用的 `upload_large_folder(num_workers=...)`。默认不采用该兼容模式。
重复上传命令可恢复未完成上传,不要启动多个上传进程。`.state/upload.log` 保存状态,HF 的缓存用于恢复。不会删除远端文件;不会更改现有仓库的公开/私有状态;不存在的仓库以私有方式创建。上传前需要完整 manifest,并校验全部分片;上传后检查远端大小以及可用的 LFS SHA-256。
**注意:当 SDK 分批提交时,中途失败可能已提交部分文件。完成并通过末尾验证后才算整次上传成功。** 此时再重新运行即可。脚本不会自动付费升级存储或切换仓库可见性。
## 输出结构
```textrelease/ README.md manifest.json data/agibot/train-00000.parquet data/ca1m/... data/droid/... data/robotwin/... data/scannet/... scripts/ .state/ # 本地检查点与日志,不上传```
README 由 `README.template.md` 加上实际转换规模和 HF configs 生成。完整转换提供 `all` 和五个来源配置;小样本转换提供 `preview` 和各来源配置。
全量完成不等于立即公开。许可证仍需维护者确定。私有仓库的 Viewer 能否显示取决于 HF 账户能力;原始上传和已授权用户的下载不等同于在线 Viewer 支持。123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297"""Stream original JSON into image-embedded QA Parquet, one process per source."""import argparseimport astfrom collections import Counterfrom concurrent.futures import ProcessPoolExecutor, as_completedimport hashlibimport ioimport jsonimport loggingimport multiprocessingimport osfrom pathlib import Pathimport reimport shutilimport sys
import ijsonimport pyarrow as paimport pyarrow.parquet as pqfrom datasets import Features, Image, Valuefrom filelock import FileLockfrom PIL import Image as PILImageimport yaml
VERSION = 1FIELDS = Features({'image': Image(), 'question': Value('string'), 'answer': Value('string'), 'type': Value('string'), 'source': Value('string'), 'task': Value('string'), 'id': Value('string'), 'qa_index': Value('int32'), 'record_index': Value('int64')})SCHEMA = FIELDS.arrow_schema
def sha256(path): h = hashlib.sha256() with Path(path).open('rb') as f: for block in iter(lambda: f.read(8 * 1024 * 1024), b''): h.update(block) return h.hexdigest()
def save_json(path, value): path = Path(path) tmp = path.with_suffix(path.suffix + '.tmp') tmp.write_text(json.dumps(value, ensure_ascii=False, indent=2), encoding='utf-8') os.replace(tmp, path)
def infer_task(question, answer): """Conservative derived label; never rewrite or execute answer text.""" if len(answer) > 100000: return None try: points = ast.literal_eval(answer) if not isinstance(points, (list, tuple)) or not points: return None if any(not isinstance(p, (list, tuple)) or len(p) not in (2, 3) for p in points): return None dims = {len(p) for p in points} if len(dims) != 1 or any(not isinstance(v, (int, float)) or isinstance(v, bool) for p in points for v in p): return None except (ValueError, SyntaxError, TypeError, RecursionError): return None q = re.sub(r'\b([23])\s+d\b', r'\1d', question.lower()) if re.search(r'\blift(?:ing)?\b', q) and '2d' in q and '3d' in q and dims == {3}: return '2d_to_3d' if dims == {2} and '2d' in q: return '2d_trace' if dims == {3} and '3d' in q and '2d' not in q: return '3d_trace' return None
def resolve_image(root, name): # Input release uses flat image names. Do not accept traversal or absolute paths. if not isinstance(name, str) or '/' in name or '\\' in name or name in ('', '.', '..'): raise ValueError(f'Expected flat image filename: {name!r}') candidates = [name] if ':' not in name else [name.replace(':', '_')] for candidate in candidates: path = (root / candidate).resolve() if path.parent == root and path.is_file(): return path raise FileNotFoundError(f'RGB image missing: {name}')
def convert_source(job): source, metadata, images, out, opts = job metadata, images, out = Path(metadata), Path(images), Path(out) pa.set_cpu_count(1) # prevent each process spawning another CPU-sized thread pool dest = out / 'data' / source dest.mkdir(parents=True, exist_ok=True) state_path = out / '.state' / f'{source}.json' stat = metadata.stat() identity = {'version': VERSION, 'script_sha256': sha256(__file__), 'metadata': str(metadata), 'size': stat.st_size, 'mtime_ns': stat.st_mtime_ns, 'images': str(images), 'options': opts} if state_path.exists(): state = json.loads(state_path.read_text(encoding='utf-8')) if state['identity'] != identity: raise RuntimeError(f'{source}: input/options/code changed; use a new output directory') for item in state['files']: path = out / item['path'] if not path.is_file() or path.stat().st_size != item['bytes'] or sha256(path) != item['sha256']: raise RuntimeError(f'{source}: completed shard changed: {path}') if state['complete']: print(f'{source}: resume verified, already complete', flush=True) return state else: state = {'identity': identity, 'source': source, 'complete': False, 'next_record': 0, 'qa_rows': 0, 'mapped_image_records': 0, 'task_counts': {}, 'type_counts': {}, 'files': []} save_json(state_path, state) writer = None pending, pending_size, shard_size, shard_rows = [], 0, 0, 0 tasks, types = Counter(state['task_counts']), Counter(state['type_counts']) processed, total_rows = state['next_record'], state['qa_rows'] mapped = state['mapped_image_records'] target = opts['shard_mib'] * 1024**2 group_target = opts['row_group_mib'] * 1024**2 shard_path = None tmp = None
def flush_group(): nonlocal pending, pending_size, writer, shard_path, tmp if not pending: return if writer is None: shard_path = dest / f'train-{len(state["files"]):05d}.parquet' tmp = shard_path.with_suffix('.parquet.incomplete') writer = pq.ParquetWriter(tmp, SCHEMA, compression='zstd', compression_level=3, use_dictionary=True, dictionary_pagesize_limit=16*1024**2) writer.write_table(pa.Table.from_pylist(pending, schema=SCHEMA), row_group_size=len(pending)) pending, pending_size = [], 0
def finish_shard(): nonlocal writer, shard_rows, shard_size flush_group() if writer is None: return writer.close() writer = None assert pq.ParquetFile(tmp).metadata.num_rows == shard_rows os.replace(tmp, shard_path) state['files'].append({'path': shard_path.relative_to(out).as_posix(), 'rows': shard_rows, 'bytes': shard_path.stat().st_size, 'sha256': sha256(shard_path)}) state.update(next_record=processed, qa_rows=total_rows, mapped_image_records=mapped, task_counts=dict(tasks), type_counts=dict(types)) save_json(state_path, state) print(f'{source}: {processed:,} records / {total_rows:,} QA; committed {shard_path.name}', flush=True) shard_rows, shard_size = 0, 0
try: with metadata.open('rb') as fp: for record_index, record in enumerate(ijson.items(fp, 'item')): if opts['limit_records'] and record_index >= opts['limit_records']: break if record_index < state['next_record']: continue refs = record.get('image') conv = record.get('conversations') if not isinstance(refs, list) or len(refs) != 1: raise ValueError(f'{source}[{record_index}]: expected exactly one RGB reference') if not isinstance(conv, list) or not conv or len(conv) % 2: raise ValueError(f'{source}[{record_index}]: invalid conversation length') path = resolve_image(images, refs[0]) blob = path.read_bytes() if len(blob) > 64 * 1024**2: raise ValueError(f'Image exceeds 64 MiB memory guard: {path}') if opts['verify_images']: with PILImage.open(io.BytesIO(blob)) as im: im.verify() mapped += path.name != refs[0] kind = record.get('type') if kind is not None and not isinstance(kind, str): raise ValueError(f'{source}[{record_index}]: non-string type') if not isinstance(record.get('id'), str): raise ValueError(f'{source}[{record_index}]: non-string id') types[kind if kind is not None else '(missing)'] += 1 for offset in range(0, len(conv), 2): q, a = conv[offset:offset+2] if q.get('from') != 'human' or a.get('from') != 'gpt': raise ValueError(f'{source}[{record_index}]: nonalternating roles') question, answer = q['value'], a['value'] if not isinstance(question, str) or not isinstance(answer, str): raise ValueError('QA text must be strings') task = infer_task(question, answer) tasks[task or '(unknown)'] += 1 row = {'image': {'bytes': blob, 'path': path.name}, 'question': question, 'answer': answer, 'type': kind, 'source': source, 'task': task, 'id': record['id'], 'qa_index': offset//2, 'record_index': record_index} size = len(blob) + len(question.encode('utf-8')) + len(answer.encode('utf-8')) + 256 if pending and (pending_size + size > group_target or len(pending) >= 128): flush_group() pending.append(row) pending_size += size shard_size += size shard_rows += 1 total_rows += 1 processed = record_index + 1 # Checkpoint only at whole-record boundaries, preserving conversation groups. if shard_size >= target: finish_shard() finish_shard() state.update(complete=True, next_record=processed, qa_rows=total_rows, mapped_image_records=mapped, task_counts=dict(tasks), type_counts=dict(types)) save_json(state_path, state) return state except BaseException: if writer is not None: writer.close() raise
def write_card(out, manifest): template = Path(__file__).with_name('README.template.md').read_text(encoding='utf-8') configs = [] if manifest['limited']: configs.append({'config_name': 'preview', 'default': True, 'data_files': [{'split': 'train', 'path': 'data/*/*.parquet'}]}) else: configs.append({'config_name': 'all', 'default': True, 'data_files': [{'split': 'train', 'path': 'data/*/*.parquet'}]}) for source in manifest['sources']: configs.append({'config_name': source, 'data_files': [{'split': 'train', 'path': f'data/{source}/*.parquet'}]}) metadata = {'language': ['en'], 'pretty_name': 'TraceSpatial-Trace', 'task_categories': ['visual-question-answering'], 'tags': ['robotics', 'spatial-reasoning', 'trajectory', 'arxiv:2512.13660'], 'configs': configs} if manifest['limited']: status = f"This is a **preview** containing {manifest['qa_rows']:,} QA rows from {manifest['records']:,} original records. Full local-corpus counts are shown below; those are not the size of this preview." else: status = f"This conversion contains **{manifest['qa_rows']:,} QA rows** from **{manifest['records']:,} original records** across {len(manifest['sources'])} sources." text = template.replace('@@STATUS@@', status).replace('@@CONFIG@@', 'preview' if manifest['limited'] else 'all') (out/'README.md').write_text('---\n'+yaml.safe_dump(metadata, sort_keys=False)+'---\n\n'+text, encoding='utf-8')
def main(): p = argparse.ArgumentParser(description=__doc__) p.add_argument('--input', type=Path, required=True, help='Directory containing images/ and metadata/') p.add_argument('--output', type=Path, required=True, help='New release directory; repeat to resume') p.add_argument('--workers', type=int, default=min(5, os.cpu_count() or 1)) p.add_argument('--shard-mib', type=int, default=512, help='Approximate uncompressed bytes; finish whole record before splitting') p.add_argument('--row-group-mib', type=int, default=32) p.add_argument('--limit-records', type=int, default=0, help='Per-source record limit; 0 means all') p.add_argument('--verify-images', action='store_true', help='Decode/verify every referenced image; slower') args = p.parse_args() if min(args.workers, args.shard_mib, args.row_group_mib) < 1 or args.limit_records < 0: p.error('worker/size arguments must be positive and limit nonnegative') root, out = args.input.resolve(), args.output.resolve() if out == root or root in out.parents: p.error('Output must be separate from the input dataset') files = sorted((root/'metadata').glob('*.json')) if not files or not (root/'images').is_dir(): p.error('Input needs metadata/*.json and images/') sources = [f.name.split('_')[0] for f in files] if len(sources) != len(set(sources)): p.error('Multiple metadata files share a source label') out.mkdir(parents=True, exist_ok=True) (out/'.state').mkdir(exist_ok=True) logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', handlers=[logging.StreamHandler(), logging.FileHandler(out/'.state'/'conversion.log', encoding='utf-8')]) opts = {k: getattr(args, k) for k in ('shard_mib','row_group_mib','limit_records','verify_images')} with FileLock(out/'.state'/'convert.lock', timeout=0): plan = {'sources': sources, 'input': str(root), 'options': opts, 'script_sha256':sha256(__file__)} plan_path = out/'.state'/'plan.json' if plan_path.exists() and json.loads(plan_path.read_text(encoding='utf-8')) != plan: raise RuntimeError('Output belongs to another conversion; use a fresh directory') save_json(plan_path, plan) jobs = [(s, str(f), str((root/'images').resolve()), str(out), opts) for s,f in zip(sources,files)] results = {} with ProcessPoolExecutor(max_workers=min(args.workers,len(jobs)), mp_context=multiprocessing.get_context('spawn')) as pool: futures = {pool.submit(convert_source,j):j[0] for j in jobs} for future in as_completed(futures): source = futures[future] try: results[source] = future.result() logging.info('%s complete: %s QA rows', source, results[source]['qa_rows']) except BaseException: for f in futures: f.cancel() logging.exception('%s failed; completed shards remain resumable', source) raise results = {s:results[s] for s in sorted(results)} manifest = {'version':VERSION, 'complete':True, 'limited':bool(args.limit_records), 'sources':list(results), 'records':sum(r['next_record'] for r in results.values()), 'qa_rows':sum(r['qa_rows'] for r in results.values()), 'files':[item for r in results.values() for item in r['files']], 'source_statistics': {s:{k:r[k] for k in ('next_record','qa_rows','mapped_image_records','task_counts','type_counts')} for s,r in results.items()}} write_card(out,manifest) script_dest = out/'scripts' script_dest.mkdir(exist_ok=True) for f in Path(__file__).parent.iterdir(): if f.is_file() and f.suffix in ('.py','.md','.txt','.yml') and f.resolve() != (script_dest/f.name).resolve(): shutil.copy2(f,script_dest/f.name) save_json(out/'manifest.json', manifest) # publish only after all sources succeed logging.info('COMPLETE: %s QA rows, %s shards',manifest['qa_rows'],len(manifest['files']))
if __name__ == '__main__': multiprocessing.freeze_support() main()12345678name: tracespatial-hfchannels: - conda-forgedependencies: - python=3.11 - pip - pip: - -r requirements.txt12345678huggingface_hub==1.32.0datasets==5.0.1pyarrow==25.0.1Pillow==12.3.0ijson==3.5.1PyYAML==6.0.3filelock==4.0.1
hf-xet==1.6.012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273"""Integration checks: real-source fidelity and recovery after a missing-image failure."""import jsonimport osfrom pathlib import Pathimport subprocessimport sysimport tempfileimport unittest
import pyarrow.parquet as pqfrom PIL import Imagefrom convert_dataset import infer_task, sha256
SCRIPT = Path(__file__).with_name('convert_dataset.py')
class PipelineTests(unittest.TestCase): def test_task_labels_and_ambiguity(self): self.assertEqual(infer_task('Predict 2D waypoints', '[(1, 2)]'), '2d_trace') self.assertEqual(infer_task('Predict 3D waypoints', '[(1, 2, 0.4)]'), '3d_trace') self.assertEqual(infer_task('Lift the 2 D waypoints to 3 D', '[(1, 2, 0.4)]'), '2d_to_3d') self.assertIsNone(infer_task('Predict 2D waypoints', '[(1, 2, 3)]')) self.assertIsNone(infer_task('Predict 3D waypoints', '__import__("os").getcwd()')) self.assertIsNone(infer_task('Predict 3D waypoints', '[("a", 2, 3)]'))
def test_checkpoint_resume_after_missing_image(self): with tempfile.TemporaryDirectory(prefix='tracespatial-test-') as directory: base = Path(directory) root, output = base/'input', base/'output' (root/'images').mkdir(parents=True) (root/'metadata').mkdir() image1 = root/'images'/'frame_01.png' image2 = root/'images'/'frame_02.png' Image.frombytes('RGB',(700,700),os.urandom(700*700*3)).save(image1) records = [] for n in (1,2): records.append({'id':'duplicate-id','image':[f'frame:0{n}.png'], 'conversations':[{'from':'human','value':'Predict 2D waypoints'}, {'from':'gpt','value':'[(10, 20), (30, 40)]'}]}) (root/'metadata'/'droid_test.json').write_text(json.dumps(records),encoding='utf-8') command = [sys.executable,str(SCRIPT),'--input',str(root),'--output',str(output), '--workers','2','--shard-mib','1','--row-group-mib','1'] failed = subprocess.run(command,capture_output=True,text=True) self.assertNotEqual(failed.returncode,0) self.assertIn('RGB image missing',failed.stderr) self.assertFalse((output/'manifest.json').exists()) state = json.loads((output/'.state'/'droid.json').read_text()) self.assertEqual(state['next_record'],1) first = output/state['files'][0]['path'] original_sha, original_mtime = sha256(first), first.stat().st_mtime_ns image2.write_bytes(image1.read_bytes()) resumed = subprocess.run(command,capture_output=True,text=True) self.assertEqual(resumed.returncode,0,resumed.stderr) self.assertEqual(sha256(first),original_sha) self.assertEqual(first.stat().st_mtime_ns,original_mtime) manifest = json.loads((output/'manifest.json').read_text()) self.assertEqual(manifest['qa_rows'],2) rows = [row for item in manifest['files'] for row in pq.read_table(output/item['path']).to_pylist()] self.assertEqual([r['record_index'] for r in rows],[0,1]) self.assertEqual([r['id'] for r in rows],['duplicate-id','duplicate-id']) self.assertTrue(all(r['type'] is None for r in rows)) self.assertEqual(manifest['source_statistics']['droid']['mapped_image_records'],2) uploader = Path(__file__).with_name('upload_dataset.py') plan = subprocess.run([sys.executable,str(uploader),'--folder',str(output)],capture_output=True,text=True) self.assertEqual(plan.returncode,0,plan.stderr) with first.open('ab') as f: f.write(b'corruption') bad = subprocess.run([sys.executable,str(uploader),'--folder',str(output)],capture_output=True,text=True) self.assertNotEqual(bad.returncode,0) self.assertIn('checksum mismatch',bad.stderr)
if __name__ == '__main__': unittest.main(verbosity=2)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889"""Manifest-validated Hugging Face upload with SDK-managed concurrency and resume."""
import argparse
from concurrent.futures import ThreadPoolExecutor
import json
import logging
import os
from pathlib import Path
from filelock import FileLock
from huggingface_hub import HfApi
from huggingface_hub.errors import RepositoryNotFoundError
from convert_dataset import sha256, save_json
def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument('--folder', type=Path, required=True)
p.add_argument('--repo-id', default='leeibo/TraceSpatial-Trace')
p.add_argument('--workers', type=int, default=4, help='Checksum workers; also upload workers when --legacy-workers is used')
p.add_argument('--execute', action='store_true', help='Without this flag, only validate and show upload plan')
p.add_argument('--legacy-workers', action='store_true', help='Use resumable upload_large_folder for explicit worker control (deprecated upstream)')
args = p.parse_args()
if args.workers < 1: p.error('--workers must be positive')
root = args.folder.resolve()
manifest_path = root/'manifest.json'
if not manifest_path.is_file(): p.error('Conversion manifest.json missing; finish conversion first')
manifest = json.loads(manifest_path.read_text(encoding='utf-8'))
if not manifest.get('complete'): p.error('Conversion not complete')
(root/'.state').mkdir(exist_ok=True)
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s',
handlers=[logging.StreamHandler(), logging.FileHandler(root/'.state'/'upload.log', encoding='utf-8')])
with FileLock(root/'.state'/'upload.lock', timeout=0), FileLock(root/'.state'/'convert.lock', timeout=0):
def validate(item):
path = (root/item['path']).resolve()
if root not in path.parents or not path.is_file():
raise RuntimeError(f'Invalid/missing shard path: {item["path"]}')
if path.stat().st_size != item['bytes'] or sha256(path) != item['sha256']:
raise RuntimeError(f'Shard checksum mismatch: {item["path"]}')
with ThreadPoolExecutor(max_workers=args.workers) as pool:
list(pool.map(validate, manifest['files']))
tracked = {x['path'] for x in manifest['files']}
actual = {f.relative_to(root).as_posix() for f in root.glob('data/**/*.parquet')}
if tracked != actual:
raise RuntimeError('Untracked or missing data shards; use a clean output directory')
if not (root/'README.md').is_file(): raise RuntimeError('README.md missing')
ancillary = [p.relative_to(root).as_posix() for pattern in ('scripts/*.py','scripts/*.md','scripts/*.txt','scripts/*.yml','assets/*') for p in root.glob(pattern) if p.is_file()]
allow = sorted(tracked) + ['README.md','manifest.json'] + ancillary
logging.info('Plan: %s files, %.3f GiB in data shards, %s QA rows -> %s',len(allow),sum(f['bytes'] for f in manifest['files'])/1024**3,manifest['qa_rows'],args.repo_id)
if not args.execute:
logging.info('Dry run complete; add --execute to upload. No network writes performed.')
return
# Bind SDK resume cache to one destination. Never print or embed the token.
binding = root/'.state'/'upload-target.json'
target = {'repo_id':args.repo_id, 'repo_type':'dataset'}
if binding.exists() and json.loads(binding.read_text(encoding='utf-8')) != target:
raise RuntimeError('This folder upload cache belongs to another repo; use a fresh staging folder')
api = HfApi()
logging.info('Authenticated as %s',api.whoami()['name'])
try:
info = api.dataset_info(args.repo_id)
logging.info('Existing repository visibility: %s', 'private' if info.private else 'public')
except RepositoryNotFoundError:
api.create_repo(args.repo_id, repo_type='dataset', private=True, exist_ok=True)
save_json(binding,target)
if args.legacy_workers:
# Explicitly requested compatibility mode; no concurrent committing processes.
api.upload_large_folder(repo_id=args.repo_id, repo_type='dataset', folder_path=root,
num_workers=args.workers, allow_patterns=allow, print_report_every=30)
else:
from huggingface_hub.utils._runtime import is_xet_available
if not is_xet_available():
raise RuntimeError("Install hf-xet from requirements.txt for resumable multi-commit upload")
# Current SDK: internally concurrent, resumable, automatically splits commits.
api.upload_folder(repo_id=args.repo_id, repo_type='dataset', folder_path=root,
allow_patterns=allow, commit_message='Publish TraceSpatial RGB and QA Parquet release')
remote = {f.path:f for f in api.list_repo_tree(args.repo_id,repo_type='dataset',recursive=True) if hasattr(f,'size')}
for item in manifest['files']:
f = remote.get(item['path'])
if f is None or f.size != item['bytes']:
raise RuntimeError(f'Remote size mismatch: {item["path"]}')
lfs = getattr(f,'lfs',None)
remote_sha = getattr(lfs,'sha256',None)
if remote_sha and remote_sha != item['sha256']:
raise RuntimeError(f'Remote SHA-256 mismatch: {item["path"]}')
logging.info('Upload verified: https://huggingface.co/datasets/%s',args.repo_id)
if __name__ == '__main__':
main()README.md+109-57
data/agibot/train-00000.parquetAdded+3
data/agibot/train-00001.parquetAdded+3
data/agibot/train-00002.parquetAdded+3
data/agibot/train-00003.parquetAdded+3
data/ca1m/train-00000.parquetAdded+3
data/ca1m/train-00001.parquetAdded+3
data/ca1m/train-00002.parquetAdded+3
data/ca1m/train-00003.parquetAdded+3
data/droid/train-00000.parquetAdded+3
data/droid/train-00001.parquetAdded+3
data/robotwin/train-00000.parquetAdded+3
data/robotwin/train-00001.parquetAdded+3
data/robotwin/train-00002.parquetAdded+3
data/robotwin/train-00003.parquetAdded+3
data/robotwin/train-00004.parquetAdded+3
data/scannet/train-00000.parquetAdded+3
data/scannet/train-00001.parquetAdded+3
data/scannet/train-00002.parquetAdded+3
manifest.jsonAdded+192
scripts/README.template.mdAdded+122
scripts/USAGE.mdAdded+108
scripts/convert_dataset.pyAdded+297
scripts/environment.ymlAdded+8
scripts/requirements.txtAdded+8
scripts/test_pipeline.pyAdded+73
scripts/upload_dataset.pyAdded+89