robot-data-audit 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robot_data_audit-0.2.0/LICENSE +21 -0
- robot_data_audit-0.2.0/PKG-INFO +207 -0
- robot_data_audit-0.2.0/README.md +178 -0
- robot_data_audit-0.2.0/pyproject.toml +50 -0
- robot_data_audit-0.2.0/rda/__init__.py +3 -0
- robot_data_audit-0.2.0/rda/audit/__init__.py +14 -0
- robot_data_audit-0.2.0/rda/audit/dataset_audit.py +75 -0
- robot_data_audit-0.2.0/rda/audit/episode_audit.py +175 -0
- robot_data_audit-0.2.0/rda/audit/rules.py +92 -0
- robot_data_audit-0.2.0/rda/calibration/__init__.py +37 -0
- robot_data_audit-0.2.0/rda/calibration/normalization.py +126 -0
- robot_data_audit-0.2.0/rda/calibration/portable.py +89 -0
- robot_data_audit-0.2.0/rda/calibration/reference.py +97 -0
- robot_data_audit-0.2.0/rda/calibration/scorer.py +256 -0
- robot_data_audit-0.2.0/rda/cli/__init__.py +5 -0
- robot_data_audit-0.2.0/rda/cli/main.py +349 -0
- robot_data_audit-0.2.0/rda/io/__init__.py +6 -0
- robot_data_audit-0.2.0/rda/io/lerobot_loader.py +144 -0
- robot_data_audit-0.2.0/rda/io/schema.py +77 -0
- robot_data_audit-0.2.0/rda/metrics/__init__.py +150 -0
- robot_data_audit-0.2.0/rda/metrics/base.py +259 -0
- robot_data_audit-0.2.0/rda/metrics/distribution.py +296 -0
- robot_data_audit-0.2.0/rda/metrics/integrity.py +281 -0
- robot_data_audit-0.2.0/rda/metrics/motion.py +585 -0
- robot_data_audit-0.2.0/rda/metrics/temporal.py +355 -0
- robot_data_audit-0.2.0/rda/report/__init__.py +50 -0
- robot_data_audit-0.2.0/rda/report/aggregation.py +365 -0
- robot_data_audit-0.2.0/rda/report/json_report.py +801 -0
- robot_data_audit-0.2.0/rda/report/summary.py +265 -0
- robot_data_audit-0.2.0/rda/report/top_issues.py +313 -0
- robot_data_audit-0.2.0/robot_data_audit.egg-info/PKG-INFO +207 -0
- robot_data_audit-0.2.0/robot_data_audit.egg-info/SOURCES.txt +41 -0
- robot_data_audit-0.2.0/robot_data_audit.egg-info/dependency_links.txt +1 -0
- robot_data_audit-0.2.0/robot_data_audit.egg-info/entry_points.txt +2 -0
- robot_data_audit-0.2.0/robot_data_audit.egg-info/requires.txt +14 -0
- robot_data_audit-0.2.0/robot_data_audit.egg-info/top_level.txt +1 -0
- robot_data_audit-0.2.0/setup.cfg +4 -0
- robot_data_audit-0.2.0/tests/test_audit.py +146 -0
- robot_data_audit-0.2.0/tests/test_calibration.py +724 -0
- robot_data_audit-0.2.0/tests/test_metrics.py +95 -0
- robot_data_audit-0.2.0/tests/test_p0_metrics.py +784 -0
- robot_data_audit-0.2.0/tests/test_p1_metrics.py +409 -0
- robot_data_audit-0.2.0/tests/test_phase4_report.py +665 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Niu Su Technology
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: robot-data-audit
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Robot Data Audit (RDA) - Quality auditing tool for robot datasets
|
|
5
|
+
Author-email: Niu Su Tech <dev@niusutech.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Requires-Dist: numpy>=1.24
|
|
19
|
+
Requires-Dist: lerobot>=0.6
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
24
|
+
Provides-Extra: ui
|
|
25
|
+
Requires-Dist: streamlit>=1.30.0; extra == "ui"
|
|
26
|
+
Requires-Dist: plotly>=5.18.0; extra == "ui"
|
|
27
|
+
Requires-Dist: pandas>=2.0; extra == "ui"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Robot Data Audit (RDA)
|
|
31
|
+
|
|
32
|
+
Quality auditing tool for robot datasets. RDA provides comprehensive metrics for
|
|
33
|
+
evaluating the integrity, temporal consistency, motion quality, and distribution
|
|
34
|
+
coverage of robot trajectory datasets.
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **Integrity Metrics**: Missing frames, NaN values, schema validation
|
|
39
|
+
- **Temporal Metrics**: Timestamp consistency, sensor sync, jitter analysis
|
|
40
|
+
- **Motion Metrics**: Joint limits, velocity profiles, discontinuities, idle detection
|
|
41
|
+
- **Distribution Metrics**: Distribution statistics, coverage analysis
|
|
42
|
+
- **Three-tier classification**: PASS / REVIEW / EXCLUDE
|
|
43
|
+
- **CLI-first design**: Easy to integrate into data pipelines
|
|
44
|
+
- **Streamlit UI** (coming in v0.2.0): Interactive dashboard for exploring results
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
### From PyPI
|
|
49
|
+
|
|
50
|
+
> **Note:** PyPI publishing is planned for the v0.2.0 release.
|
|
51
|
+
> Until then, install from source as described below.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Coming soon — PyPI package name: robot-data-assurance
|
|
55
|
+
# pip install robot-data-assurance
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### From source (development)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone <repository-url>
|
|
62
|
+
cd robot-data-audit
|
|
63
|
+
pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### With UI support (v0.2.0+)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install -e ".[ui]"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
### 1. Audit a dataset
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
rda audit /path/to/lerobot/dataset
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This will run all 12 RDA metrics against every episode in the dataset and print a
|
|
81
|
+
text summary to the console. A JSON report is automatically saved to
|
|
82
|
+
`<dataset_path>/rda_report.json`.
|
|
83
|
+
|
|
84
|
+
### 2. Use example datasets
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# See examples and usage tips
|
|
88
|
+
rda example
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3. Customize output
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Save report to a specific path
|
|
95
|
+
rda audit /path/to/dataset --output my_report.json
|
|
96
|
+
|
|
97
|
+
# Output JSON to stdout (for piping)
|
|
98
|
+
rda audit /path/to/dataset --format json
|
|
99
|
+
|
|
100
|
+
# Verbose mode with platform info
|
|
101
|
+
rda audit /path/to/dataset --platform so101 -v
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Preview the UI (coming soon)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
rda audit /path/to/dataset --ui
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## CLI Reference
|
|
111
|
+
|
|
112
|
+
### `rda audit`
|
|
113
|
+
|
|
114
|
+
Audit a LeRobot dataset at the given PATH.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
rda audit [OPTIONS] PATH
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Option | Description |
|
|
121
|
+
|--------|-------------|
|
|
122
|
+
| `-o, --output FILE` | Path to save the JSON audit report. Defaults to `<path>/rda_report.json`. |
|
|
123
|
+
| `--format [json\|text]` | Output format for the audit report. Default: `text`. |
|
|
124
|
+
| `--platform TEXT` | Robot platform name (e.g. `so101`, `droid`). Used for Tier 3 platform-specific metrics. |
|
|
125
|
+
| `--ui` | Launch the Streamlit web UI after the audit completes. *(v0.2.0 preview)* |
|
|
126
|
+
| `-v, --verbose` | Enable verbose output. |
|
|
127
|
+
| `-V, --version` | Show version and exit. |
|
|
128
|
+
| `-h, --help` | Show help message and exit. |
|
|
129
|
+
|
|
130
|
+
### `rda example`
|
|
131
|
+
|
|
132
|
+
Show example usage and sample dataset paths.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
rda example
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Exit Codes
|
|
139
|
+
|
|
140
|
+
| Code | Meaning |
|
|
141
|
+
|------|---------|
|
|
142
|
+
| `0` | Audit completed successfully, no EXCLUDE verdicts |
|
|
143
|
+
| `1` | Error (invalid path, dataset loading failed, etc.) |
|
|
144
|
+
| `2` | Audit completed successfully, at least one EXCLUDE verdict |
|
|
145
|
+
|
|
146
|
+
## Project Structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
rda/
|
|
150
|
+
├── cli/ # Click CLI entry points
|
|
151
|
+
├── io/ # Data loading and schema definitions
|
|
152
|
+
├── metrics/ # Audit metric implementations (12 metrics total)
|
|
153
|
+
├── audit/ # Dataset and episode-level audit orchestration
|
|
154
|
+
└── report/ # Report generation and summary
|
|
155
|
+
|
|
156
|
+
docs/ # API documentation and design specs
|
|
157
|
+
examples/ # Example scripts
|
|
158
|
+
├── basic_audit.py # Core workflow demo (synthetic data ready)
|
|
159
|
+
└── custom_metrics.py # How to write custom audit metrics
|
|
160
|
+
tests/ # 155 unit tests
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Documentation
|
|
164
|
+
|
|
165
|
+
- **[API Reference](docs/API.md)** — Full Python API documentation
|
|
166
|
+
- **[MVP Product Spec](docs/MVP_PRODUCT_SPEC.md)** — Product requirements (v0.2.0)
|
|
167
|
+
- **[Technical Design](TECHNICAL_DESIGN.md)** — Architecture and design decisions
|
|
168
|
+
- **[Project Charter](PROJECT_CHARTER.md)** — Mission, goals, and scope
|
|
169
|
+
- **[Roadmap](ROADMAP.md)** — Release plan and milestones
|
|
170
|
+
- **[Changelog](CHANGELOG.md)** — Version history
|
|
171
|
+
|
|
172
|
+
## Python API Quick Start
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from rda.audit.dataset_audit import DatasetAuditor
|
|
176
|
+
from rda.io.lerobot_loader import iter_episodes, load_lerobot_dataset
|
|
177
|
+
from rda.report import generate_dataset_report
|
|
178
|
+
|
|
179
|
+
dataset_info = load_lerobot_dataset("/path/to/dataset")
|
|
180
|
+
auditor = DatasetAuditor()
|
|
181
|
+
result = auditor.audit_dataset(dataset_info, iter_episodes("/path/to/dataset"))
|
|
182
|
+
|
|
183
|
+
report = generate_dataset_report(result)
|
|
184
|
+
print(f"DHI: {report['quality']['dhi']} / 100")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
See [docs/API.md](docs/API.md) for the complete API reference, or
|
|
188
|
+
[examples/](examples/) for runnable scripts.
|
|
189
|
+
|
|
190
|
+
## Development
|
|
191
|
+
|
|
192
|
+
### Running tests
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
pytest
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Linting
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pip install -e ".[dev]"
|
|
202
|
+
ruff check rda/
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Robot Data Audit (RDA)
|
|
2
|
+
|
|
3
|
+
Quality auditing tool for robot datasets. RDA provides comprehensive metrics for
|
|
4
|
+
evaluating the integrity, temporal consistency, motion quality, and distribution
|
|
5
|
+
coverage of robot trajectory datasets.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Integrity Metrics**: Missing frames, NaN values, schema validation
|
|
10
|
+
- **Temporal Metrics**: Timestamp consistency, sensor sync, jitter analysis
|
|
11
|
+
- **Motion Metrics**: Joint limits, velocity profiles, discontinuities, idle detection
|
|
12
|
+
- **Distribution Metrics**: Distribution statistics, coverage analysis
|
|
13
|
+
- **Three-tier classification**: PASS / REVIEW / EXCLUDE
|
|
14
|
+
- **CLI-first design**: Easy to integrate into data pipelines
|
|
15
|
+
- **Streamlit UI** (coming in v0.2.0): Interactive dashboard for exploring results
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### From PyPI
|
|
20
|
+
|
|
21
|
+
> **Note:** PyPI publishing is planned for the v0.2.0 release.
|
|
22
|
+
> Until then, install from source as described below.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Coming soon — PyPI package name: robot-data-assurance
|
|
26
|
+
# pip install robot-data-assurance
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### From source (development)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone <repository-url>
|
|
33
|
+
cd robot-data-audit
|
|
34
|
+
pip install -e .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### With UI support (v0.2.0+)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install -e ".[ui]"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
### 1. Audit a dataset
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
rda audit /path/to/lerobot/dataset
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This will run all 12 RDA metrics against every episode in the dataset and print a
|
|
52
|
+
text summary to the console. A JSON report is automatically saved to
|
|
53
|
+
`<dataset_path>/rda_report.json`.
|
|
54
|
+
|
|
55
|
+
### 2. Use example datasets
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# See examples and usage tips
|
|
59
|
+
rda example
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Customize output
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Save report to a specific path
|
|
66
|
+
rda audit /path/to/dataset --output my_report.json
|
|
67
|
+
|
|
68
|
+
# Output JSON to stdout (for piping)
|
|
69
|
+
rda audit /path/to/dataset --format json
|
|
70
|
+
|
|
71
|
+
# Verbose mode with platform info
|
|
72
|
+
rda audit /path/to/dataset --platform so101 -v
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 4. Preview the UI (coming soon)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
rda audit /path/to/dataset --ui
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## CLI Reference
|
|
82
|
+
|
|
83
|
+
### `rda audit`
|
|
84
|
+
|
|
85
|
+
Audit a LeRobot dataset at the given PATH.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
rda audit [OPTIONS] PATH
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
| Option | Description |
|
|
92
|
+
|--------|-------------|
|
|
93
|
+
| `-o, --output FILE` | Path to save the JSON audit report. Defaults to `<path>/rda_report.json`. |
|
|
94
|
+
| `--format [json\|text]` | Output format for the audit report. Default: `text`. |
|
|
95
|
+
| `--platform TEXT` | Robot platform name (e.g. `so101`, `droid`). Used for Tier 3 platform-specific metrics. |
|
|
96
|
+
| `--ui` | Launch the Streamlit web UI after the audit completes. *(v0.2.0 preview)* |
|
|
97
|
+
| `-v, --verbose` | Enable verbose output. |
|
|
98
|
+
| `-V, --version` | Show version and exit. |
|
|
99
|
+
| `-h, --help` | Show help message and exit. |
|
|
100
|
+
|
|
101
|
+
### `rda example`
|
|
102
|
+
|
|
103
|
+
Show example usage and sample dataset paths.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
rda example
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Exit Codes
|
|
110
|
+
|
|
111
|
+
| Code | Meaning |
|
|
112
|
+
|------|---------|
|
|
113
|
+
| `0` | Audit completed successfully, no EXCLUDE verdicts |
|
|
114
|
+
| `1` | Error (invalid path, dataset loading failed, etc.) |
|
|
115
|
+
| `2` | Audit completed successfully, at least one EXCLUDE verdict |
|
|
116
|
+
|
|
117
|
+
## Project Structure
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
rda/
|
|
121
|
+
├── cli/ # Click CLI entry points
|
|
122
|
+
├── io/ # Data loading and schema definitions
|
|
123
|
+
├── metrics/ # Audit metric implementations (12 metrics total)
|
|
124
|
+
├── audit/ # Dataset and episode-level audit orchestration
|
|
125
|
+
└── report/ # Report generation and summary
|
|
126
|
+
|
|
127
|
+
docs/ # API documentation and design specs
|
|
128
|
+
examples/ # Example scripts
|
|
129
|
+
├── basic_audit.py # Core workflow demo (synthetic data ready)
|
|
130
|
+
└── custom_metrics.py # How to write custom audit metrics
|
|
131
|
+
tests/ # 155 unit tests
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Documentation
|
|
135
|
+
|
|
136
|
+
- **[API Reference](docs/API.md)** — Full Python API documentation
|
|
137
|
+
- **[MVP Product Spec](docs/MVP_PRODUCT_SPEC.md)** — Product requirements (v0.2.0)
|
|
138
|
+
- **[Technical Design](TECHNICAL_DESIGN.md)** — Architecture and design decisions
|
|
139
|
+
- **[Project Charter](PROJECT_CHARTER.md)** — Mission, goals, and scope
|
|
140
|
+
- **[Roadmap](ROADMAP.md)** — Release plan and milestones
|
|
141
|
+
- **[Changelog](CHANGELOG.md)** — Version history
|
|
142
|
+
|
|
143
|
+
## Python API Quick Start
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from rda.audit.dataset_audit import DatasetAuditor
|
|
147
|
+
from rda.io.lerobot_loader import iter_episodes, load_lerobot_dataset
|
|
148
|
+
from rda.report import generate_dataset_report
|
|
149
|
+
|
|
150
|
+
dataset_info = load_lerobot_dataset("/path/to/dataset")
|
|
151
|
+
auditor = DatasetAuditor()
|
|
152
|
+
result = auditor.audit_dataset(dataset_info, iter_episodes("/path/to/dataset"))
|
|
153
|
+
|
|
154
|
+
report = generate_dataset_report(result)
|
|
155
|
+
print(f"DHI: {report['quality']['dhi']} / 100")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See [docs/API.md](docs/API.md) for the complete API reference, or
|
|
159
|
+
[examples/](examples/) for runnable scripts.
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
### Running tests
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pytest
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Linting
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
pip install -e ".[dev]"
|
|
173
|
+
ruff check rda/
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "robot-data-audit"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Robot Data Audit (RDA) - Quality auditing tool for robot datasets"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Niu Su Tech", email = "dev@niusutech.com" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"click>=8.0",
|
|
25
|
+
"pydantic>=2.0",
|
|
26
|
+
"numpy>=1.24",
|
|
27
|
+
"lerobot>=0.6",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = [
|
|
32
|
+
"pytest>=7.0",
|
|
33
|
+
"pytest-cov>=4.0",
|
|
34
|
+
"ruff>=0.1",
|
|
35
|
+
]
|
|
36
|
+
ui = [
|
|
37
|
+
"streamlit>=1.30.0",
|
|
38
|
+
"plotly>=5.18.0",
|
|
39
|
+
"pandas>=2.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
rda = "rda.cli.main:cli"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["."]
|
|
47
|
+
include = ["rda*"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Audit orchestration for RDA."""
|
|
2
|
+
|
|
3
|
+
from rda.audit.rules import AuditVerdict, classify_episode
|
|
4
|
+
from rda.audit.episode_audit import EpisodeAuditor, EpisodeAuditResult
|
|
5
|
+
from rda.audit.dataset_audit import DatasetAuditor, DatasetAuditResult
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"AuditVerdict",
|
|
9
|
+
"classify_episode",
|
|
10
|
+
"EpisodeAuditor",
|
|
11
|
+
"EpisodeAuditResult",
|
|
12
|
+
"DatasetAuditor",
|
|
13
|
+
"DatasetAuditResult",
|
|
14
|
+
]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Dataset-level audit logic."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from typing import Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from rda.audit.episode_audit import EpisodeAuditResult, EpisodeAuditor
|
|
8
|
+
from rda.audit.rules import AuditVerdict
|
|
9
|
+
from rda.io.schema import DatasetInfo
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class DatasetAuditResult:
|
|
14
|
+
"""Result of auditing an entire dataset.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
dataset_info: Metadata about the dataset.
|
|
18
|
+
episodes: Mapping from episode index to EpisodeAuditResult.
|
|
19
|
+
verdict_counts: Summary count of each verdict across all episodes.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
dataset_info: DatasetInfo
|
|
23
|
+
episodes: Dict[int, EpisodeAuditResult] = field(default_factory=dict)
|
|
24
|
+
verdict_counts: Dict[AuditVerdict, int] = field(default_factory=dict)
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def num_episodes(self) -> int:
|
|
28
|
+
return len(self.episodes)
|
|
29
|
+
|
|
30
|
+
def compute_verdict_counts(self) -> Dict[AuditVerdict, int]:
|
|
31
|
+
"""Recount verdict tallies from the episode results."""
|
|
32
|
+
counts = {v: 0 for v in AuditVerdict}
|
|
33
|
+
for ep_result in self.episodes.values():
|
|
34
|
+
counts[ep_result.verdict] += 1
|
|
35
|
+
self.verdict_counts = counts
|
|
36
|
+
return counts
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class DatasetAuditor:
|
|
40
|
+
"""Orchestrates the full audit of a dataset, episode by episode."""
|
|
41
|
+
|
|
42
|
+
def __init__(
|
|
43
|
+
self,
|
|
44
|
+
episode_auditor: Optional[EpisodeAuditor] = None,
|
|
45
|
+
) -> None:
|
|
46
|
+
"""Initialize the dataset auditor.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
episode_auditor: EpisodeAuditor instance to use for each episode.
|
|
50
|
+
If None, a default EpisodeAuditor with all metrics is created.
|
|
51
|
+
"""
|
|
52
|
+
self.episode_auditor = episode_auditor or EpisodeAuditor()
|
|
53
|
+
|
|
54
|
+
def audit_dataset(
|
|
55
|
+
self,
|
|
56
|
+
dataset_info: DatasetInfo,
|
|
57
|
+
episode_iter,
|
|
58
|
+
) -> DatasetAuditResult:
|
|
59
|
+
"""Audit all episodes in the dataset.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
dataset_info: Dataset metadata.
|
|
63
|
+
episode_iter: Iterator yielding EpisodeData objects.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
DatasetAuditResult with per-episode results and summary counts.
|
|
67
|
+
"""
|
|
68
|
+
result = DatasetAuditResult(dataset_info=dataset_info)
|
|
69
|
+
|
|
70
|
+
for episode in episode_iter:
|
|
71
|
+
ep_result = self.episode_auditor.audit(episode)
|
|
72
|
+
result.episodes[episode.episode_index] = ep_result
|
|
73
|
+
|
|
74
|
+
result.compute_verdict_counts()
|
|
75
|
+
return result
|