An ORM built to simplify working with datasets in COCO format.
Project description
coco_orm
coco_orm is an ORM built to simplify working with datasets in COCO format.
Examples
Create a new annotations file and fill it with data in COCO format:
from coco_orm import CocoDataset
from coco_orm.models import Image, Category, Annotation
# create an annotations.json file containing COCO dataset annotations.
coco_dataset = CocoDataset(".../dataset/annotations.json")
# create a new image
image = Image(id=1, file_name="01.jpg", width=320, height=320)
coco_dataset.images.append(image)
# create a new category
category = Category(id=1, name="cat")
coco_dataset.categories.append(category)
# create a new annotation
annotation = Annotation(image_id=1, category_id=1, bbox=[260, 177, 231, 199])
coco_dataset.annotations.append(annotation)
# save to the .json file
coco_dataset.save()
Apply filters to the COCO dataset collections
from coco_orm import CocoDataset
from coco_orm.filters import ImageFilters
# read annotations file
coco_dataset = CocoDataset(".../dataset/annotations.json")
# filter an image collection by ids
image_filters = (ImageFilters().ids([1, 3]))
coco_dataset.images.filter(image_filters, inplace=True)
# save filtered dataset to the separate file
coco_dataset.save(".../dataset/filtered_annotations.json")
Further info
Created by a team of Computer Vision enjoyers of Igor Sikorsky Kyiv Polytechnic Institute.
Support Ukraine - Stop the War
Since 20 February 2014 Ukraine has been facing Russian military aggression that has left over 14 000 people killed and over 30 000 injured. Your support is crucial as it helps Ukrainian people to stand against Russian aggression.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coco_orm-1.0.1.tar.gz
(19.0 kB
view details)
Built Distribution
coco_orm-1.0.1-py3-none-any.whl
(29.2 kB
view details)
File details
Details for the file coco_orm-1.0.1.tar.gz
.
File metadata
- Download URL: coco_orm-1.0.1.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b5fdc6e7817c7afe9cad32f4cc3ba9b7fd66142a945a678a34da9538e522d7b |
|
MD5 | 778233f7fd51911e3c452f581dbcf990 |
|
BLAKE2b-256 | a06bd67631d742b446700cbda18a71b1b2100f7bc1f1453b526bdac87cc5a4a5 |
Provenance
File details
Details for the file coco_orm-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: coco_orm-1.0.1-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a96682e71d15f94b4957aca25206f8086eb9c1ee52d7202fc5b3dc00b2df9d35 |
|
MD5 | 48806945978c0d5f0a29378e1d007c39 |
|
BLAKE2b-256 | 86ae29f5297fae2cd58d4fee9d5df4d30a5184092bfd0383cbcaf611709d0ec8 |