Rust Library Overview
Panlabel can be used as a Rust library in addition to the CLI. This allows you to integrate annotation format conversion, validation, and analysis directly into your applications.Installation
Add Panlabel to yourCargo.toml:
cargo add:
Library vs CLI
The library provides programmatic access to all CLI functionality:- CLI: Best for one-off conversions, validation, and analysis
- Library: Best for integrating into Rust applications, batch processing, custom workflows
Quick Start
Here’s a simple example of reading a COCO dataset, validating it, and converting to YOLO:Core Modules
Panlabel’s library is organized into several key modules:Intermediate Representation
Core data types for representing annotation datasets
Format I/O
Read and write annotation formats
Validation
Dataset validation and error reporting
Conversion
Conversion reporting and lossiness analysis
Diff
Compare two datasets semantically
Stats
Analyze dataset statistics and quality metrics
Sample
Create dataset subsets with sampling
Documentation
Full API documentation is available on docs.rs:Error Handling
All I/O and conversion operations returnResult<T, PanlabelError>. The error type provides detailed context:
Next Steps
- Learn about the Intermediate Representation types
- Explore Format I/O functions for reading and writing
- Understand Validation to ensure data quality
- Use Conversion reporting to track lossiness
- Compare datasets with Diff
- Analyze datasets with Stats
- Create subsets with Sample