Skip to main content

MedicalMultitaskModeling

MedicalMultitaskModeling (M3) enables training foundational medical imaging models using multi-task learning.

The software is provided on "AS IS" basis, i.e. it comes without any warranty, express or implied including (without limitations) any warranty of merchantability and warranty of fitness for a particular purpose.

Please note that this software is licensed under the LICENSE FOR SCIENTIFIC NON-COMMERCIAL RESEARCH PURPOSES, see license.md.

Installation

pip install medicalmultitaskmodeling m3-sdk
# Extra dependency groups recommended for development:
pip install "medicalmultitaskmodeling[interactive,testing]" m3-sdk

Verify system dependencies and installation:

import cv2; import torch; assert torch.cuda.is_available()
from mmm.interactive import *
from mmm.api.M3Model import M3Model

See pyproject.toml for all available extras.

This project depends on m3-sdk.

Usage and available models

For pure inference based on a pre-trained model (downloaded automatically), import it as follows:

from mmm.api.M3Model import M3Model, M3_MODELS

from mmm.api.M3Model import DEFAULT_MODEL  # default UMedPT weights
from mmm.api.M3Model import TC_NOPANDA  # default Tissue Concepts weights 
from mmm.api.M3Model import UNICORN_ENCODER  # First Place UNICORN challenge
from mmm.api.M3Model import WSC_MTL_TINY  # default Whole Slide Concepts weights
# Load the selected model
model = M3Model(M3_MODELS[UNICORN_ENCODER])
# The individual components can be accessed through keys
print(model.keys())

import torch; import torch.nn as nn
with torch.inference_mode():
    feature_pyramid: list[torch.Tensor] = model["encoder"](torch.rand(1, 3, 224, 224).to(model.device))
    hidden_vector = nn.Flatten(1)(model["squeezer"](feature_pyramid)[1])

Citation

If you use this project, please cite our work:

@article{SchaeferOvercoming2024,
    title = {Overcoming data scarcity in biomedical imaging with a foundational multi-task model},
    journal = {Nature Computational Science},
    issn = {2662-8457},
    doi = {10.1038/s43588-024-00662-z},
    author = {Schäfer, Raphael and Nicke, Till and Höfener, Henning and Lange, Annkristin and Merhof, Dorit and Feuerhake, Friedrich and Schulz, Volkmar and Lotz, Johannes and Kiessling, Fabian},
    year = {2024},
}

@article{nicke2025tissue,
  title={Tissue concepts: Supervised foundation models in computational pathology},
  author={Nicke, Till and Sch{\"a}fer, Jan Raphael and H{\"o}fener, Henning and Feuerhake, Friedrich and Merhof, Dorit and Kie{\ss}ling, Fabian and Lotz, Johannes},
  journal={Computers in biology and medicine},
  volume={186},
  pages={109621},
  year={2025},
  publisher={Elsevier}
}

Metadata

Release files for MedicalMultitaskModeling 1.6.3

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

Built distribution (wheel)

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

Release files / medicalmultitaskmodeling-1.6.3-py3-none-any.whl

Download URL medicalmultitaskmodeling-1.6.3-py3-none-any.whl
Size 875.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2691adc482d2917e85c9b72c19be364d16edebbf56d4cb6925cbc57c7f41448c
BLAKE2b-256 checksum
How to use checksums
70912fdf9bf6e1dbe4e64b49e9186578ac1f4d917eb1b51df838f9bb7299a8b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Release history Release notifications | RSS feed

This release

1.6.3 This release

1 release file

1.6.1

1 release file

1.0.4

2 release files

1.0.3

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