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
Install the latest stable version from PyPI with:
sudo pip3 install image-object-slicer
Or 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 |
Open Images | openimages |
Pascal VOC | pascalvoc |
WIDER Face | widerface |
YOLO | yolo |
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,openimages,widerface,yolo}] [-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,openimages,widerface,yolo}, --format {pascalvoc,coco,cvatimages,datumaro,kitti,labelme,openimages,widerface,yolo}
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
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
Built Distribution
File details
Details for the file image_object_slicer-1.12.1.tar.gz
.
File metadata
- Download URL: image_object_slicer-1.12.1.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f904e903ca18cfdfd1a565bf8d92bc0a46427efa4ec1c6ff13d4ec613418a2d |
|
MD5 | acb6553ac750ceca68317b32d00b9efd |
|
BLAKE2b-256 | 73e8f0e160b3352e3a21ad232a79f6f565c1468b67e51299fd303c4202174fd5 |
File details
Details for the file image_object_slicer-1.12.1-py3-none-any.whl
.
File metadata
- Download URL: image_object_slicer-1.12.1-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb60fcaf45cfe65e3ed519733da3327c6ac20dc2209e8188a5c02be065f044be |
|
MD5 | d5c4375068880f98d84b7ed12c28d03a |
|
BLAKE2b-256 | ab045dcbb6fae1bb00abcaf75cdf5d94b32ce9e2ee7f8062ee76cd7f2f55074d |