Spaces:
Sleeping
Sleeping
File size: 1,343 Bytes
47cb9bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | """
export_coco.py — CLI entrypoint for the COCO JSON export stage.
Usage:
uv run python scripts/export_coco.py
uv run python scripts/export_coco.py --labeled-dir data/labeled --output data/labeled/coco_export.json
"""
from __future__ import annotations
import logging
from pathlib import Path
import click
from dotenv import load_dotenv
load_dotenv()
from autolabel.export import run_export
from autolabel.config import settings
from autolabel.utils import setup_logging
@click.command()
@click.option(
"--labeled-dir",
default=str(settings.labeled_dir),
show_default=True,
type=click.Path(exists=True, file_okay=False, path_type=Path),
help="Directory containing accepted-annotation JSON files.",
)
@click.option(
"--output",
default=str(settings.labeled_dir / "coco_export.json"),
show_default=True,
type=click.Path(path_type=Path),
help="Output path for the COCO JSON file.",
)
@click.option("--verbose", "-v", is_flag=True, default=False, help="Debug logging.")
def main(labeled_dir: Path, output: Path, verbose: bool) -> None:
"""Export accepted annotations from LABELED_DIR to COCO JSON format."""
setup_logging(logging.DEBUG if verbose else logging.INFO)
run_export(labeled_dir=labeled_dir, output_path=output, cfg=settings)
if __name__ == "__main__":
main()
|