COCO dataset library.
Project description
coco-lib
COCO dataset library. 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-lib is available on PyPI:
pip install coco-lib
Usage
Creating a dataset (Object Detection)
>>> from coco_lib.common import Info, Image, License
>>> from coco_lib.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=None,
... coco_url=None,
... date_captured=datetime.now()
... ),
... ...
... ]
>>> categories = [ # Describe the categories
... ObjectDetectionCategory(
... id=0,
... name='pedestrian',
... supercategory='person'
... ),
... ...
... ]
>>> annotations = [ # Describe the annotations
... ObjectDetectionAnnotation(
... id=0,
... image_id=0,
... category_id=0,
... segmentation=None,
... 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_lib.objectdetection import ObjectDetectionDataset
>>> dataset = ObjectDetectionDataset.load('test_dataset.json') # Load the dataset
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coco-lib-0.1.0.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coco-lib-0.1.0.tar.gz.
File metadata
- Download URL: coco-lib-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.5 Linux/5.11.0-40-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
889bf1bb3391127667524fec1f0d3caabfa713aa10106df091cf2b3c070afabd
|
|
| MD5 |
e70fbd306004dadd87fdb436ced465e0
|
|
| BLAKE2b-256 |
648e73471b7b816d27b5edc89e9cecb1cec0c37f926a3d8ec63e223a8668a8c2
|
File details
Details for the file coco_lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: coco_lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.5 Linux/5.11.0-40-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a089a2264f3c58a9480ec36ac09da1ef737b7c226ffe34766338a9e0806b007
|
|
| MD5 |
a4f58801937a499f9169003f80b53e99
|
|
| BLAKE2b-256 |
19dcbf33abb3c51d1ed293bdc6845ba4c209a74e32618c52a7f0e8f25e357f44
|