Skip to main content

No project description provided

Project description

COCO ML Toolbox

COCO ML Toolbox is a command-line interface (CLI) tool for managing COCO (Common Objects in Context) dataset files. This toolbox provides functionalities to split, merge, and crop COCO datasets, making it easier to manipulate and prepare datasets for machine learning tasks.

Features

  • Split a COCO dataset into training and testing datasets with a specified ratio.
  • Merge multiple COCO dataset files into a single file.
  • Crop images based on annotations in a COCO dataset.

Streamlit App

You can use our streamlit app here.

Installation

cocomltools requires python >= 3.9.8

Install python package

The easiest way to install the package is using pip

pip install cocomltools

You can also clone the source code and install dependencies using poetry:

git clone https://github.com/Ghallabi/coco-ml-toolbox.git
cd coco-ml-toolbox
pip install poetry
poetry install

Usage

We provide a CLI that comes with three main commands: split, merge, and crop. Below are the details on how to use each command.

Split

Splits a COCO dataset into training and testing datasets.

cocoml split --coco-path /path/to/coco.json --output-dir /path/to/output --ratio 0.2 --mode random
  • --coco-path: Path to the COCO file (JSON).
  • --output-dir: (Optional) Path to save the split COCO files. Defaults to the directory of the input COCO file.
  • --ratio: (Optional) Split ratio. Defaults to 0.2.
  • --mode: (Optional) Split mode. Options are random and strat. Defaults to random.

Merge

Merges multiple COCO dataset files into a single file.

cocoml merge --coco-paths /path/to/coco1.json,/path/to/coco2.json --output-dir /path/to/output
  • --coco-paths: Comma-separated paths to the COCO files (JSON).
  • --output-dir: (Optional) Path to save the merged COCO file. Defaults to the directory of the first input COCO file.

Crop

Crops images based on annotations in a COCO dataset.

cocoml crop --coco-path /path/to/coco.json --images-dir /path/to/images --output-dir /path/to/cropped_images --num-workers MAX_WORKERS
  • --coco-path: Path to the COCO file (JSON).
  • --images-dir: Path to the directory containing the COCO image files.
  • --output-dir: (Optional) Path to save the cropped images. Defaults to a "cropped" directory within the parent directory of the images.
  • --num-workers: to speed up the cropping process.

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

cocomltools-0.1.8.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cocomltools-0.1.8-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file cocomltools-0.1.8.tar.gz.

File metadata

  • Download URL: cocomltools-0.1.8.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Darwin/23.4.0

File hashes

Hashes for cocomltools-0.1.8.tar.gz
Algorithm Hash digest
SHA256 9ee0ebcdd5a376e59eb7a3f974c1c4e7db2dd50276ec4caa90b69a3ae57b4f88
MD5 8253312f2a45e87470b03521d86085e9
BLAKE2b-256 c961a178991623a448ac40595722dccf03a682a8c6a5de442a585c258451ccb7

See more details on using hashes here.

File details

Details for the file cocomltools-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: cocomltools-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Darwin/23.4.0

File hashes

Hashes for cocomltools-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cc57f3c80e4ac53bd3f79597956a299171a65eb2a2b518370156584f096f0404
MD5 d81cef3cbdf57b8ed904d85277944445
BLAKE2b-256 0a6175cb1d0f596b056c7c28052ed6b771bacc16356c27e1511683fb7d5ff815

See more details on using hashes here.

Supported by

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