Skip to main content

Slice images using annotation files.

Project description

image-object-slicer

Slice objects from images using annotation files. Convert an object detection dataset to an image classification one. To annotate the images to be used with this tool, we recommend openvinotoolkit/cvat.

This is a fork of gitlab.com/straighter/pascalvoc-to-image.

Installation

Download the latest stable wheel file from the releases page and run:

sudo pip3 install ./image_object_slicer-*-py3-none-any.whl

Or install the latest development version from the git repository:

git clone https://www.github.com/natanjunges/image-object-slicer.git
cd image-object-slicer
sudo pip3 install ./

Usage

Different formats of annotation files are supported:

Annotation format Command line option
MS COCO Object Detection coco
CVAT for images cvatimages
Datumaro datumaro
KITTI kitti
LabelMe labelme
Pascal VOC pascalvoc

Using the script is pretty simple, since it only has three required parameters:

usage: image-object-slicer [-h] [-v] [-f {pascalvoc,coco,cvatimages,datumaro,kitti,labelme}] [-p PADDING] [-w WORKERS] annotations images save

Slice objects from images using annotation files

positional arguments:
  annotations           A path to the directory with the annotation files
  images                A path to the directory with the input images
  save                  A path to the directory to save the image slices to

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -f {pascalvoc,coco,cvatimages,datumaro,kitti,labelme}, --format {pascalvoc,coco,cvatimages,datumaro,kitti,labelme}
                        The format of the annotation files (default is pascalvoc)
  -p PADDING, --padding PADDING
                        The amount of padding (in pixels) to add to each image slice
  -w WORKERS, --workers WORKERS
                        The number of parallel workers to run (default is cpu count)

Building

To build the wheel file, you need deb:python3.10-venv and pip:build:

sudo apt install python3.10-venv
sudo pip3 install build

Build the wheel file with:

python3 -m build --wheel

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

image_object_slicer-1.8.1.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

image_object_slicer-1.8.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file image_object_slicer-1.8.1.tar.gz.

File metadata

  • Download URL: image_object_slicer-1.8.1.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for image_object_slicer-1.8.1.tar.gz
Algorithm Hash digest
SHA256 ce40928a859d6c4c09dad1502cc0fb6187e57a5ea71a2a98dba0d8c413990ee9
MD5 2df6b98673580a68855e4eabd55f5323
BLAKE2b-256 20c34d1348d7c8e5baeee71a4e166854c387e803284e37cf7fecf9b40e5846d6

See more details on using hashes here.

File details

Details for the file image_object_slicer-1.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for image_object_slicer-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd9e37dd40abc84784730bfc7d7a030c2eb794b03a289407542de9fb5445cbaf
MD5 4c7b5671585a21a80d3c21b3cc3207b1
BLAKE2b-256 6ff6d43922ee3222f07bbc0dbf88507eafa86bcf504763c300beb40c066d9e48

See more details on using hashes here.

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