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.2.tar.gz (297.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.2-py3-none-any.whl (386.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datamint-2.18.2.tar.gz
  • Upload date:
  • Size: 297.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.2.tar.gz
Algorithm Hash digest
SHA256 d113cc7b4016dba9f23e3549d4d32510a964e4cd42639c1a578ebb9db90875db
MD5 36b66652bcc4bf4c6c87275e54679667
BLAKE2b-256 850ccf8ed4600e6c7a6ad1242c913327f63c6c4424ee7b638a294a1544573a70

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamint-2.18.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: datamint-2.18.2-py3-none-any.whl
  • Upload date:
  • Size: 386.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c29c2d84f61cb75518f25f5a5b65b68fafcd05c42f8993d3021f260c35abccfd
MD5 733469178d90df694ef5961a90f496f3
BLAKE2b-256 9d6aed8b83774542cb4d18f2cd68760d9a4ff8fcfdbe6021843ffcddf56966b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamint-2.18.2-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