Skip to main content

Converting bounding box annotations to popular formats like a breeze.

Reason this release was yanked:

Type checking wasn't compatible with python < 3.10

Project description

bboxconverter

Python versions Total downloads Monthly downloads
Python versions

Introduction

What is a bounding box?

Bounding boxes are a crucial component of object detection algorithms, which are used to identify and classify objects within an image or video. A bounding box is a rectangle that surrounds an object of interest in the image, and is typically represented by a set of coordinates that define the box's position and size. These boxes can be used to locate and extract objects from an image, and can also provide important information about the size, shape, and orientation of the objects

Various types and format

When you work with bounding box you have severals things to consider.

The bounding box could be stored in different types like:

  • Top-Left Bottom-Right (TLBR), (x_min, y_min, x_max, y_max)
  • Top-Left Width Height (TLWH), (x_min, y_min, width, height)
  • Center Width Height (CWH), (x_center, y_center, width, height)

Which are popular among different formats like :

  • COCO (Common Objects in Context)
  • Pascal_voc (Visual Object Classes)
  • YOLO (You Only Look Once)

Furthermore, the bounding box could be stored in different file formats like:

  • csv
  • xml
  • json
  • manifest
  • parquet
  • pickle

Installation

pip install bboxconverter

or

git clone https://github.com/ODAncona/bboxconverter.git
cd bboxconverter
poetry install

See the installation guide for more informations.

Usecase

The goal of this library is to seamlessly convert bounding box format using easy syntax.

It should be a breeze like...

import bboxconverter as bc

# Input file path
input_path = './examples/example.csv'

# Output file path
output_path = './examples/output/example.json'

# Mapping between the input file and the bboxconverter format
bbox_map = dict(
    class_name='class',
    file_path='name',
    x_min='top_left_x',
    y_min='top_left_y',
    width='w',
    height='h',
    image_width='img_size_x',
    image_height='img_size_y',
)

# Read the input file
parser = bc.read_csv(input_path, mapping=bbox_map)

# Export the file to the desired format
parser.export(output_path=output_path, format='coco')
parser.export(output_path=output_path, format='voc')
parser.export(output_path=output_path, format='yolo')

Documentation

API Reference

How to guide

Tutorials

Explanation

Contributing

Contributions are welcome! Please read the contributing guidelines first.

License

This project is licensed under the GPLV3 License - see the LICENSE file for details.

Acknowledgments

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

bboxconverter-0.1.3.tar.gz (24.1 kB view hashes)

Uploaded Source

Built Distribution

bboxconverter-0.1.3-py3-none-any.whl (27.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page