Skip to main content

A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows.

Project description

Datamint logo

Datamint Python API

Build Status Python 3.10+

Datamint turns medical imaging ML work. Dataset management, annotation, training, and deployment into a few lines of Python, with built-in support for DICOM/NIfTI/PNG, PyTorch Lightning trainers, and MLflow tracking.

Common use cases: 🩻 Segmentation · 🏷️ Classification · 📦 Detection

Datamint handles the full journey from raw files to a deployed model:

flowchart LR
    Files(["📁 Your Files"])

    subgraph s1 [1 · Ingest]
        Resource(["📦 Resource"])
    end

    subgraph s2 [2 · Organize & Annotate]
        direction TB
        Project(["🗂️ Project"])
        Annotations(["🏷️ Annotations"])
        Project -.->|annotate| Annotations
    end

    subgraph s3 [3 · Train]
        direction LR
        Dataset(["🧮 Dataset"])
        Trainer(["🧠 Trainer"])
        Model(["📈 Model"])
        Dataset -->|train| Trainer -->|register| Model
    end

    subgraph s4 [4 · Deploy & Predict]
        direction LR
        DeployJob(["🚀 Deploy Job"])
        Inference(["🔮 Inference"])
        DeployJob -->|predict| Inference
    end

    Files -->|upload| Resource
    Resource -->|organize| Project
    Project -->|load| Dataset
    Model -->|deploy| DeployJob

    classDef ingestNode fill:#ffffff,stroke:#1f6feb,stroke-width:2px,color:#0b2b4c
    classDef organizeNode fill:#ffffff,stroke:#1a7f37,stroke-width:2px,color:#0b3a1c
    classDef mlNode fill:#ffffff,stroke:#8250df,stroke-width:2px,color:#2c1a4d
    classDef deployNode fill:#ffffff,stroke:#d1720f,stroke-width:2px,color:#4d2b00
    classDef fileNode fill:#f6f8fa,stroke:#57606a,stroke-width:2px,color:#24292f

    class Files fileNode
    class Resource ingestNode
    class Project,Annotations organizeNode
    class Dataset,Trainer,Model mlNode
    class DeployJob,Inference deployNode

    style s1 fill:#dceeff,stroke:#1f6feb,stroke-width:2px,color:#0b2b4c
    style s2 fill:#dbf5df,stroke:#1a7f37,stroke-width:2px,color:#0b3a1c
    style s3 fill:#ecdcff,stroke:#8250df,stroke-width:2px,color:#2c1a4d
    style s4 fill:#ffe8c7,stroke:#d1720f,stroke-width:2px,color:#4d2b00

📋 Table of Contents

🎬 See it in action

Create a project, split the data, train, and deploy, all through the API:

Datamint pipeline demo

🚀 Features

  • Dataset Management: Download, upload, and manage medical imaging datasets using intuitive object-based APIs or CLI tools
  • Annotation Tools: Create, upload, and manage annotations (segmentations, labels, measurements) with ease
  • Experiment Tracking: Seamless support for experiment management via MLflow integration
  • One-line Trainers: Train segmentation, classification, and detection models with built-in PyTorch Lightning trainers, skipping the dataset class, training loop, and logging setup
  • DICOM Support: Native handling of DICOM files, including powerful anonymization capabilities during upload to protect patient privacy
  • Multi-format Support: Robust support for a wide range of medical imaging formats: PNG, JPEG, NIfTI (NIfTI/NRRD), DICOMs and more

⚡ Quick Start

1. Install

pip install -U datamint

Using a virtual environment (recommended)

We recommend that you install Datamint in a dedicated virtual environment, to avoid conflicting with your system packages. For instance, create the enviroment once with python3 -m venv datamint-env and then activate it whenever you need it with:

  1. Create the environment (one-time setup):

    python3 -m venv datamint-env
    
  2. Activate the environment (run whenever you need it):

    Platform Command
    Linux/macOS source datamint-env/bin/activate
    Windows CMD datamint-env\Scripts\activate.bat
    Windows PowerShell datamint-env\Scripts\Activate.ps1
  3. Install the package:

    pip install datamint
    

2. Configure your API key

datamint config

Follow the prompts (ask your administrator if you don't have a key yet). Environment variable and programmatic options are in the Setup API Key guide.

3. Scaffold a project — the fastest way to start

datamint init

This is the recommended on-ramp: it asks for a project name and task type (segmentation, classification, or detection), then generates a ready-to-run, numbered set of scripts (01_upload_data.py06_deploy.py) — upload data, train, and deploy by running them in order.

4. ...or write it yourself

from datamint import Api
from datamint.lightning import UNetPPTrainer

api = Api()
api.projects.create(name="my-project", exists_ok=True)

trainer = UNetPPTrainer(project="my-project")
results = trainer.fit()

📚 Documentation

Difficulty levels:

  • Beginner no ML knowledge needed
  • Intermediateassumes SDK familiarity, introduces ML/dataset concepts
  • Advanced full training pipelines, custom models, 3D data, multi-step workflows.
Resource Level Description
🚀 Getting Started Beginner Step-by-step setup and basic usage
📖 API Reference Intermediate Complete API documentation
🔥 PyTorch Integration Intermediate ML workflow integration
🧠 Trainer Guide Intermediate Built-in trainers, trainer lifecycle, and custom model integration
🛠️ Command Line Tools Beginner Full reference for datamint upload, datamint init, and datamint config
🔒 SSL Troubleshooting Fixing SSLCertVerificationError
📓 Notebooks Beginner Intermediate Advanced Numbered, runnable tutorials. Start at 01_getting_started and work through annotations, datasets, experiment tracking, deployment, and a full end-to-end example

🆘 Support

Full Documentation
GitHub Issues

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

datamint-2.18.1.tar.gz (293.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datamint-2.18.1-py3-none-any.whl (382.1 kB view details)

Uploaded Python 3

File details

Details for the file datamint-2.18.1.tar.gz.

File metadata

  • Download URL: datamint-2.18.1.tar.gz
  • Upload date:
  • Size: 293.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datamint-2.18.1.tar.gz
Algorithm Hash digest
SHA256 57b525662cb4f79b03dd5bbc2bb07f278d86c66a1b8c63f46198db11d502b81f
MD5 4a5c72405c89ace0b240b6c0cd1a6b77
BLAKE2b-256 04f16336e735da6e7fb9d6c93987a95a50e22758f98b1a92b4e6dc739a4d0431

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamint-2.18.1.tar.gz:

Publisher: release_pypi.yaml on SonanceAI/datamint-python-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datamint-2.18.1-py3-none-any.whl.

File metadata

  • Download URL: datamint-2.18.1-py3-none-any.whl
  • Upload date:
  • Size: 382.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datamint-2.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32cadd5a1219d3419ac19ae89218fbe95dce09c6c846c21a5a23299c160de707
MD5 89a1a11e3589e0859b5450bfa528508b
BLAKE2b-256 1c8f83c6e35da1cd7051d872283adf8a0aa367efd16bb8299fe4c84c214fd188

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamint-2.18.1-py3-none-any.whl:

Publisher: release_pypi.yaml on SonanceAI/datamint-python-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page