Skip to main content
Cornucopia logo

The cornucopia package provides a generic framework for preprocessing, augmentation, and domain randomization; along with an abundance of specific layers, mostly targeted at (medical) imaging. cornucopia is written using a PyTorch backend, and therefore runs on the CPU or GPU.

Cornucopia is intended to be used on the GPU for on-line augmentation. A quick benchmark of affine and elastic augmentation shows that while cornucopia is slower than TorchIO on the CPU (~ 3s vs 1s), it is greatly accelerated on the GPU (~ 50ms).

Since gradients are not expected to backpropagate through its layers, it can theoretically be used within any dataloader pipeline, independent of the downstream learning framework (pytorch, tensorflow, jax, ...).

Installation

Dependencies

  • pytorch >= 1.8
  • numpy
  • nibabel
  • torch-interpol
  • torch-distmap

Pip (release)

pip install cornucopia

Pip (dev)

pip install cornucopia@git+https://github.com/balbasty/cornucopia

Documentation

Read the documentation and in particular:

Other augmentation packages

There are other great, and much more mature, augmentation packages out-there (although few run on the GPU). Here's a non-exhaustive list:

Contributions

If you find this project useful and wish to contribute, please reach out!

Metadata

Release files for cornucopia 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cornucopia 0.5.1
File Size Uploaded
cornucopia-0.5.1.tar.gz 143.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cornucopia 0.5.1
File Interpreter ABI Platform
cornucopia-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 309.8 kB

Release files / cornucopia-0.5.1.tar.gz

Download URL cornucopia-0.5.1.tar.gz
Size 143.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ce3394515139282a4c62bf06b022973ea19d7b864d5cdd923c424ec0525b443b
BLAKE2b-256 checksum
How to use checksums
fbdda849af26ba217009bada4a6d1fcf7bd7fd2724207195e418d2628e44e200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cornucopia-0.5.1-py3-none-any.whl

Download URL cornucopia-0.5.1-py3-none-any.whl
Size 166.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6491250a3ae11a1da25d25bbd80fd91d7fb27026fba312daca055cb1611d04a3
BLAKE2b-256 checksum
How to use checksums
43a0e7d64cb4d9659703daebabf2bd27e91662286fee23962c06a21ea20ba070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page