A Python tool to validate OpenLabel JSON files against the official ASAM OpenLabel schema.
- Schema Validation: Validates against the official ASAM OpenLabel V1.0.0 schema
- Batch Processing: Validate multiple files with progress indication
- Directory Scanning: Scan directories for JSON files (with recursive option)
- Caching: Automatic schema caching with configurable expiry
- Error Reporting: Clear validation error messages
- Error Handling: Graceful handling of network and file system issues
- Progress Tracking: Visual progress bars for batch operations
# Clone the repository
git clone git@github.com:dxc-technology/openlabel-validator.git
cd openlabel-validator
# Install dependencies
pip install -r requirements.txt# Install directly from source
pip install git+ssh://git@github.com/dxc-technology/openlabel-validator.git
# Or install in development mode
git clone git@github.com:dxc-technology/openlabel-validator.git
cd openlabel-validator
pip install -e .- Python 3.7 or higher
- pip package manager
# Windows
python -m pip install -r requirements.txt
# macOS with Homebrew Python
python3 -m pip install -r requirements.txt
# Linux/Ubuntu
python3 -m pip install -r requirements.txtpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt# Validate a single file
python validate_openlabel.py data.json
# Validate multiple files (with progress bar)
python validate_openlabel.py data1.json data2.json data3.json
# Validate all JSON files in a directory
python validate_openlabel.py --folder /path/to/json/files
# Validate JSON files recursively in subdirectories
python validate_openlabel.py --folder /path/to/json/files --recursive
# Check version
python validate_openlabel.py --version# Use custom schema URL
python validate_openlabel.py --schema-url https://custom-schema.com/schema.json data.json
# Specify custom cache directory
python validate_openlabel.py --cache-dir /path/to/cache data.json
# Bypass SSL verification (use with caution)
python validate_openlabel.py --bypass-ssl data.json
# Set cache expiry (in days)
python validate_openlabel.py --cache-expiry-days 30 data.json
# Combine folder scanning with specific files
python validate_openlabel.py --folder /data/jsons file1.json file2.json
# Use folder scanning with other options
python validate_openlabel.py --folder /data --recursive --bypass-sslHere's a minimal example of a valid OpenLabel JSON file:
{
"openlabel": {
"metadata": {
"schema_version": "1.0.0"
},
"coordinate_systems": {
"base": {
"type": "geo",
"parent": ""
}
},
"streams": {},
"frames": {},
"frame_intervals": [],
"objects": {},
"relations": {},
"tags": {},
"actions": {}
}
}data.json is valid according to the OpenLabel schema
data.json failed validation:
• 'openlabel' is a required property
• Additional property 'invalid_field' is not allowed
Validating files: 100%|██████████| 3/3 [00:01<00:00, 2.5file/s]
Validation Summary:
Valid files: 2
Invalid files: 1
Invalid files:
data3.json:
• 'metadata' is a required property at openlabel
Found 5 JSON files in /path/to/data
Validating files: 100%|██████████| 5/5 [00:02<00:00, 2.1file/s]
Validation Summary:
Valid files: 4
Invalid files: 1
If you encounter SSL certificate errors:
# Temporary workaround (use with caution)
python validate_openlabel.py --bypass-ssl data.json- Check your internet connection
- Verify firewall settings allow HTTPS traffic
- Try using a different schema URL with
--schema-url
- Ensure the JSON file exists and is readable
- Check file permissions
- Verify the file path is correct
# Clear cache by specifying a new cache directory
python validate_openlabel.py --cache-dir /tmp/new-cache data.json
# Or delete the existing cache directory
rm -rf ~/.cache/openlabel-validatorpython -m pytest tests/# Type checking
mypy validate_openlabel.py
# Linting
flake8 validate_openlabel.py- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
OpenLabel Validator was originally developed by LUXOFT, A DXC TECHNOLOGY COMPANY as part of the pre-competitive research initiative “just better DATA – Efficient and High-Precision Data Generation for AI Applications in Autonomous Driving.” It was initiated by the “VDA-Leitinitiative” (VDA lead initiative autonomous and connected driving). The jbDATA project was funded by the Federal Ministry for Economic Affairs and Energy (BMWE). The authors would like to thank the funding body.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This validator uses the official ASAM OpenLabel schema:
- Version: 1.0.0
- URL: https://openlabel.asam.net/V1-0-0/schema/openlabel_json_schema.json
- Specification: ASAM OpenLABEL Standard
For more information about the OpenLabel format, visit the official ASAM documentation.