geococo.coco_manager

Functions

load_dataset(json_path)

Dumps the contents of json_path as a string, interprets it as a CocoDataset model

create_dataset(description, contributor[, version, ...])

Instances and returns a new CocoDataset model with given kwargs.

save_dataset(dataset, json_path)

JSON-encodes an instance of CocoDataset and saves it to json_path.

Module Contents

geococo.coco_manager.load_dataset(json_path)[source]

Dumps the contents of json_path as a string, interprets it as a CocoDataset model and returns it.

Parameters:

json_path (pathlib.Path) – path to the JSON file containing the json-encoded COCO dataset

Returns:

An instance of CocoDataset with loaded Image- and Annotation objects from json_path

Return type:

geococo.coco_models.CocoDataset

geococo.coco_manager.create_dataset(description, contributor, version=str(Version(major=0)), date_created=datetime.now())[source]

Instances and returns a new CocoDataset model with given kwargs.

Parameters:
  • description (str) – Description of your COCO dataset

  • contributor (str) – Main contributors of your COCO dataset, its images and its annotations

  • version (str) – Initial SemVer version (defaults to 0.0.0)

  • date_created (datetime.datetime) – Date when dataset was initially created, defaults to datetime.now()

Returns:

An instance of CocoDataset without Image- and Annotation objects

Return type:

geococo.coco_models.CocoDataset

geococo.coco_manager.save_dataset(dataset, json_path)[source]

JSON-encodes an instance of CocoDataset and saves it to json_path.

Parameters:
Return type:

None