Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pyplatypus

Computer vision for medical imaging — the engine behind the platypus R package.

0.2.0a1 — an alpha. This replaces the 2022 TensorFlow package with a PyTorch one. The API will still move and the R surface does not exist yet, so pin the exact version if you build on it.

Everything on PyPI so far is a pre-release, so pip install pyplatypus resolves to this one. pip install pyplatypus==0.1.0rc2 gets the old TensorFlow package.

What works today

Semantic segmentation in 2D, end to end:

  • One spec, two ways in. Build it from arguments or load it from YAML — both produce the same object, so nothing downstream can tell which you used.
  • Four architectures: U-Net, U-Net++, Res-U-Net, LinkNet, each composable with separable convolutions, spatial dropout, learned or interpolated upsampling, deep supervision and configurable block width.
  • Nine losses (IoU, Dice, CCE, CCE-Dice, Focal, Tversky, Focal-Tversky, Combo, Lovász) and three metrics, all reducing over every axis except batch and channel — so they already work on volumes.
  • Tiling that goes both ways: cut a large image into a grid instead of shrinking it, and get a full-size mask back.
  • Many models from one file, with a comparison table at the end.

3D, object detection, ensembling and pretrained backbones are deliberately out of scope for v0.1. The spec and the model builder already handle volumes; the data pipeline is where 3D stops.

Try it

uv venv --python 3.11 .venv
uv pip install --python .venv/bin/python -e ".[dev]"
.venv/bin/python -m pytest
from pyplatypus import Engine, from_yaml

engine = Engine(from_yaml("examples/data_science_bowl.yaml"))
engine.fit(verbose=True)

for row in engine.evaluate():
    print(row)

masks = engine.predict(engine.best_model("dice"), split="test")

examples/data_science_bowl.yaml trains a U-Net and a LinkNet on the 2018 Data Science Bowl and prints a comparison. On a GTX 1070 that is about 11 seconds per epoch at 160×160.

Requirements

Python ≥ 3.10, and torch ≥ 2.7.

If your GPU is a GTX 10-series (Pascal) or older, install the pascal extra:

pip install "pyplatypus[pascal]"

torch 2.8 and later ship CUDA 13 builds, and CUDA 13 dropped the Maxwell, Pascal and Volta generations outright - no driver update brings them back. The last torch built against CUDA 12 is 2.7.x, which the extra pins. On anything from Turing (RTX 20-series) onwards, ignore this.

Licence

MIT.

Release files for pyplatypus 0.2.0a1

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

Source distribution (sdist)

Source distribution for pyplatypus 0.2.0a1
File Size Uploaded
pyplatypus-0.2.0a1.tar.gz 62.1 kB Details

Built distribution (wheel)

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

Total release size: 110.4 kB

Release files / pyplatypus-0.2.0a1.tar.gz

Download URL pyplatypus-0.2.0a1.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
30a44a1ab0bebfc23dafe175c9a12995d2920bd8ad78cd4901ceecb5d279aa03
BLAKE2b-256 checksum
How to use checksums
b45e90269cfcc7083962b8cedbab3405d3a2ed682a5fefb3d802bb2e81357812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / pyplatypus-0.2.0a1-py3-none-any.whl

Download URL pyplatypus-0.2.0a1-py3-none-any.whl
Size 48.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f21e6598f27800c42fc955cc2c4a92525fc22ccc3795a5102693866ac796320
BLAKE2b-256 checksum
How to use checksums
72a95063a1f411265c38f4bdb4e303c741769d036f261e5b49c3ee5268f1edd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log
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