Skip to main content

coco-loader

COCO dataset loader. Provides serializable native Python bindings for several COCO dataset formats.

Supported bindings and their corresponding modules:

  • Object Detection: objectdetection
  • Keypoint Detection: keypointdetection
  • Panoptic Segmentation: panopticsegmentation
  • Image Captioning: imagecaptioning

Installation

coco-loader is available on PyPI:

pip install coco-loader

Usage

Creating a dataset (Object Detection)

>>> from coco_loader.common import Info, Image, License
>>> from coco_loader.objectdetection import ObjectDetectionAnnotation, \
...                                      ObjectDetectionCategory, \
...                                      ObjectDetectionDataset
>>> from datetime import datetime
>>> info = Info(  # Describe the dataset
...    year=datetime.now().year,
...    version='1.0',
...    description='This is a test dataset',
...    contributor='Test',
...    url='https://test',
...    date_created=datetime.now()
... )
>>> mit_license = License(  # Set the license
...     id=0,
...     name='MIT',
...     url='https://opensource.org/licenses/MIT'
... )
>>> images = [  # Describe the images
...     Image(
...         id=0,
...         width=640, height=480,
...         file_name='test.jpg',
...         license=mit_license.id,
...         flickr_url='',
...         coco_url='',
...         date_captured=datetime.now()
...     ),
...     ...
... ]
>>> categories = [  # Describe the categories
...     ObjectDetectionCategory(
...         id=0,
...         name='pedestrian',
...         supercategory=''
...     ),
...     ...
... ]
>>> annotations = [  # Describe the annotations
...     ObjectDetectionAnnotation(
...         id=0,
...         image_id=0,
...         category_id=0,
...         segmentation=[],
...         area=800.0,
...         bbox=[300.0, 100.0, 20.0, 40.0],
...         is_crowd=0
...     ),
...     ...
... ]
>>> dataset = ObjectDetectionDataset(  # Create the dataset
...     info=info,
...     images=images,
...     licenses=[mit_license],
...     categories=categories,
...     annotations=annotations
... )
>>> dataset.save('test_dataset.json', indent=2)  # Save the dataset

Loading a dataset

>>> from coco_loader.objectdetection import ObjectDetectionDataset
>>> dataset = ObjectDetectionDataset.load('test_dataset.json')  # Load the dataset

Release files for coco-loader 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coco-loader 0.1.1
File Size Uploaded
coco_loader-0.1.1.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coco-loader 0.1.1
File Interpreter ABI Platform
coco_loader-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / coco_loader-0.1.1.tar.gz

Download URL coco_loader-0.1.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e6ac195d29e54c9ffa5d9e639a8dbf8e7ccf07631f79e59e78835263013f8db5
BLAKE2b-256 checksum
How to use checksums
cb6f19cc2a77d7e44ee01e52ec139a1a1e5e2a47e919d4394546875d752f1da5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.9.14 Darwin/21.2.0

Release files / coco_loader-0.1.1-py3-none-any.whl

Download URL coco_loader-0.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d04df8bb3fad8747ec98e145632adb5af7f2cd16f2548f200634bf2e8f0991f1
BLAKE2b-256 checksum
How to use checksums
7ceffb31d03ff7912576bf4944d35524868ef3cf831d94053ad9b2185c94e78c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.9.14 Darwin/21.2.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page