plakakia
πλακάκια: fast image tiling for computer vision datasets
plakakia splits images, hyperspectral cubes and any N-D array into (overlapping) tiles along the axes you choose, and carries their labels along: bounding boxes in YOLO, Pascal VOC or COCO format, or segmentation masks. Satellite and drone GeoTIFFs stay georeferenced, tile by tile. Use it to train and run models on large images (aerial, satellite, microscopy, inspection) at full resolution.
- Fast: vectorised NumPy tiling and box assignment, plus a multiprocess pipeline.
- Small: four dependencies (
numpy,opencv-python-headless,pyyaml,tqdm). - Any data: grayscale, RGB(A), 16-bit, multispectral and hyperspectral cubes
(
.npy, HDF5, TIFF, GeoTIFF), channels-first or last, tiled along any axes. - Typed and tested: strict mypy, full test suite on Linux, macOS and Windows.
Installation
uv add plakakia # or: pip install plakakia
Requires Python 3.10+.
Quick start
Tile an array (online)
import cv2
from plakakia import tile_image
image = cv2.imread("scene.jpg")
tiles, coords = tile_image(image, tile_size=640, step_size=480, cover_edges=True)
# tiles: (N, 640, 640, 3) array
# coords: (N, 4) array of (x1, y1, x2, y2), so tiles[i] == image[y1:y2, x1:x2]
With boxes:
from plakakia import assign_boxes_to_tiles, clip_boxes_to_tile, read_yolo
ann = read_yolo("scene.txt", image_size=image.shape[:2])
assignment = assign_boxes_to_tiles(ann.boxes, coords, min_visibility=0.6) # (tiles, boxes) bool
for t in range(len(tiles)):
idx = assignment[t].nonzero()[0]
boxes, labels = clip_boxes_to_tile(ann.boxes[idx], coords[t]), ann.labels[idx]
Tile a dataset (offline)
plakakia --config config.yaml
input_dir_images: data/images
input_dir_annotations: data/labels
input_format_annotations: yolo # yolo | pascal_voc | coco | segmentation | none
output_format_annotations: yolo # yolo | pascal_voc
tile_size: 640
step_size: 480
cover_edges: true
num_workers: -1 # all cores
See examples/config.yaml for every option and the
CLI documentation for details. Or use it from
Python:
from plakakia import TilingConfig, run
results = run(TilingConfig.from_yaml("config.yaml"))
Hyperspectral and satellite data
import numpy as np
from plakakia import tile_array
cube = np.load("scene.npy", mmap_mode="r") # (bands, H, W), read lazily
tiles, starts = tile_array(cube, (256, 256, 32), (192, 192, 16), axes=(1, 2, 0))
# tiles: (T, 32, 256, 256) spatial x spectral windows; starts: (y, x, band) per tile
georeference: true # each GeoTIFF tile keeps its CRS and its own transform
axes: [1, 2] # rasterio arrays are (bands, height, width)
bands: [3, 2, 1, 7] # pick bands before tiling
band_axis: 0
max_nodata_fraction: 0.5 # skip tiles that are mostly outside the swath
uv add "plakakia[hyperspectral,geo]" # h5py + tifffile, rasterio
See the hyperspectral & geospatial guide.
Demo app
uv run --extra demo streamlit run demo/app.py
Features
| Input data | JPEG/PNG/..., .npy (memory-mapped), HDF5, multi-band TIFF, GeoTIFF |
| Axes | any axes, per-axis tile size and stride, rectangular tiles |
| Geospatial | per-tile CRS and transform, nodata filtering, band selection |
| Input labels | YOLO (boxes and polygons), Pascal VOC, COCO, masks, or none |
| Output labels | YOLO, Pascal VOC, PNG mask tiles |
| Overlap | any step_size ≤ or > tile_size |
| Edge handling | cover_edges adds border-aligned tiles; pad_image pads first |
| Partial boxes | min_visibility keeps and clips partially visible boxes |
| Deduplication | clear_duplicates keeps the fewest tiles that still contain every box |
| Background tiles | save_empty_tiles |
Benchmarks
Measured with benchmarks/bench_pipeline.py
(100 synthetic 1024×1024 JPEG images, 20 boxes each, tile 256, step 128, 4-core VM):
| 1 worker | 4 workers | |
|---|---|---|
| Offline pipeline (images/s) | 24 | 66 |
The pipeline is bound by JPEG decoding and encoding (about 80% of the run time).
tile_image on a 4096×4096 RGB image with 961 overlapping tiles takes about 48 ms.
Results from earlier versions on public datasets (AMD Ryzen 5 PRO 6650U, 6 cores):
| Dataset | Format | Images | tile / step | Tiles | Time |
|---|---|---|---|---|---|
| Solar Panels v2 | jpg/COCO | 112 | 150 / 50 | 3,075 | 1.1 s |
| Traffic Signs | jpg/YOLO | 741 | 300 / 200 | 1,695 | 2.8 s |
| Hard Hat Workers v2 | jpg/YOLO | 5,269 | 100 / 50 | 21,678 | 6.9 s |
| MS COCO subset | jpg/YOLO | 121,408 | 200 / 150 | 177,039 | 3 min 4 s |
Roadmap
- YOLO, Pascal VOC, COCO and segmentation inputs
- Partially visible boxes (
min_visibility) - Full image coverage (
cover_edges) - COCO output
- Rectangular tiles
- Hyperspectral / multispectral inputs (
.npy, HDF5, TIFF) tiled along any axes - Georeferenced GeoTIFF tiles
- Stitching predictions back to full-image coordinates (with NMS)
Contributing
Contributions are welcome. See CONTRIBUTING.md for the uv-based development setup.
License
Metadata
Release files for plakakia 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plakakia-1.0.0.tar.gz | 47.3 kB | Without provenance | Details for plakakia-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plakakia-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for plakakia-1.0.0-py3-none-any.whl |
Total release size: 86.9 kB
Release files / plakakia-1.0.0.tar.gz
| Download URL | plakakia-1.0.0.tar.gz |
|---|---|
| Size | 47.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b88ea4df5acf6d4d3ef421f9acece761f2c57704bbec1624bff03f25e239136d
|
|
BLAKE2b-256 checksum How to use checksums |
dbc4dedca340fb5c62ff91f53e1603221643c4fed413dd5ee9facb4434dc5d1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / plakakia-1.0.0-py3-none-any.whl
| Download URL | plakakia-1.0.0-py3-none-any.whl |
|---|---|
| Size | 39.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a522c2a3fc1d81ad895f6a017ab4d1dd8bea46d9fbcd6f85c1289add60a7730
|
|
BLAKE2b-256 checksum How to use checksums |
1e09357dc35cfa9cfe048f19b5272ead71cbe31f41730a607187e8bd8c2238a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for plakakia 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.