Metadata-Version: 2.3
Name: darts-devkit
Version: 1.0.0
Summary: devkit for DARTS database
License: MIT License
         
         Copyright (c) 2026 darts
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Programming Language :: Python :: 3
Requires-Dist: tqdm>=4.67.3
Requires-Dist: pillow>=12.2.0
Requires-Dist: numpy>=2.4.4
Requires-Dist: pydantic>=2.12.5
Requires-Dist: sphinx>=8.2.3 ; extra == 'docs'
Requires-Dist: sphinxcontrib-mermaid>=2.0.0 ; extra == 'docs'
Requires-Dist: sphinx-immaterial>=0.13.9 ; extra == 'docs'
Requires-Dist: pyquaternion>=0.9.9 ; extra == 'polygon-overlap-evaluator'
Requires-Dist: scipy>=1.17.1 ; extra == 'polygon-overlap-evaluator'
Requires-Dist: shapely>=2.1.2 ; extra == 'polygon-overlap-evaluator'
Requires-Dist: rerun-sdk>=0.31.1 ; extra == 'rerun-visualizer'
Requires-Dist: matplotlib>=3.10.8 ; extra == 'rerun-visualizer'
Requires-Python: >=3.14
Provides-Extra: docs
Provides-Extra: polygon-overlap-evaluator
Provides-Extra: rerun-visualizer
Description-Content-Type: text/markdown

# DARTS-devkit

A development toolkit for working with the **DARTS dataset**, providing utilities for dataset access, evaluation, and visualization of annotations.
To download run ```pip install darts-devkit```.
## Overview

- [Features](#features)
- [Local development](#local-development)

## Features

Below are presented simple examples for some features of the DARTS-devkit. For more examples download source code and build documentation.
### Dataset traversal
```
    from darts_devkit import DARTS

    darts=DARTS("dataset_root_path", "dataset_version")
    scenes = darts.scene.all()
    for scene in scenes:
        sample = darts.sample.get(scene.first_sample_token)
        for ann_token in sample.anns:
            print(darts.sample_annotation.get(ann_token))
```
### Dataset evaluation
```
uv pip install darts_devkit[polygon_overlap_evaluator]
```
```
    import json
    import darts_devkit.evaluation as ev
    from darts_devkit import DARTS, EvaluateRegistry
    from darts_devkit.evaluation.evaluation_models import DARTSAnnotations
    from darts_devkit.evaluation.polygon_overlap_evaluator import PolygonOverlapEvaluationConfig, ClassThresholdConfig

    ev.register_polygon_overlap_evaluator()
    evaluator = EvaluateRegistry().get("PolygonOverlapEvaluator")()
    darts=DARTS("dataset_root_path", "dataset_version")
    config = PolygonOverlapEvaluationConfig(class_thresholds=[ClassThresholdConfig(class_name="multi_track_vehicle.car",  iou_threshold=0.5)], 
                                                             num_score_thresholds=10, pr_curve_density=0.05, pr_rounding=6, min_gt_lidar_points=0)

    with open('annotations.json', 'r') as file:
        annotations = DARTSAnnotations(**json.load(file))

    results = evaluator.evaluate(darts, annotations, config)
    print(results)
```

### Dataset visualization
```
uv pip install darts_devkit[rerun_visualizer]
```
```
    from darts_devkit import DARTS, VisualizeRegistry
    import darts_devkit.visualization as ve

    darts=DARTS("dataset_root_path", "dataset_version")

    ve.register_rerun_visualizer()
    visualizer_cls = VisualizeRegistry.get("RerunVisualizer")
    visualizer = visualizer_cls()
    visualizer.visualize(darts, "scene_token")
```
## Local development

### First installation

```
# One time install of 'uv'
curl -LsSf https://astral.sh/uv/install.sh | sh

cd darts-devkit
uv sync --all-extras
```

### Run examples

```
# Editable for development - changes in package reflected instantly
uv run main.py
# Non-Editable - can delete src/darts_devkit but code will still work
uv pip install .[dev,docs]
source .venv/bin/activate
python main.py
```

### Quality check

```
make format
make check
```

### Unit tests check
```
make test
```

### Building documentation

```
make docs
```