yarrow is a python package to parse, manipulate and serialize data following the yarrow data schema. This format is oriented around computer vision data and is heavily inspired by the COCO dataset format and was initially developed and used in Michelin projects.
The full description can be found here with the rules on how to fill different fields.
pip install yarrowformat
make setup
source .venv/bin/activate
You can find multiple examples in the examples directory and the package API in the documentation (still WIP). Here are a few examples.
import json
from yarrow import YarrowDataset
# say you have a yarrow file at path
file_path = "path/to/file.yarrow.json"
yar_set = YarrowDataset.parse_file(file_path)
# You now have a YarrowDataset !
# Add annotations
annot = Annotation(...) # see documentation for parameters
yar_set.add_annotation(annot)
# now save it somewhere else
with open("path/to/other/file.yarrow.json", "w") as fp:
json.dump(yar_set.pydantic().model_dump(exclude_none=True), fp, default=str)