Skip to main content

Multitask learning for medical data

Project description

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
# Extra dependency groups recommended for development:
pip install "medicalmultitaskmodeling[interactive,testing]"

Verify system dependencies and installation:

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

See pyproject.toml for all available extras.

Usage

For pure inference based on the pre-trained model (downloads automatically):

from mmm.api.M3Model import M3Model, M3_MODELS, DEFAULT_MODEL
model = M3Model(M3_MODELS[DEFAULT_MODEL])

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])

Using the UNICORN 1st place solution

This project achieved first place in the first foundation model benchmark, UNICORN! To download and use the model:

from mmm.api.M3Model import M3Model, MMM_MODELS, UNICORN_ENCODER
model = M3Model(MMM_MODELS[UNICORN_ENCODER], device_identifier="cuda:0")

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{nicke2024tissue,
  title={Tissue Concepts: supervised foundation models in computational pathology},
  author={Nicke, Till and Schaefer, Jan Raphael and Hoefener, Henning and Feuerhake, Friedrich and Merhof, Dorit and Kiessling, Fabian and Lotz, Johannes},
  journal={arXiv preprint arXiv:2409.03519},
  doi = {10.48550/arXiv.2409.03519},
  year={2024}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

medicalmultitaskmodeling-1.6.1-py3-none-any.whl (875.5 kB view details)

Uploaded Python 3

File details

Details for the file medicalmultitaskmodeling-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: medicalmultitaskmodeling-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 875.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for medicalmultitaskmodeling-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c42cf0549d3745623c0c8ac1fb9ae67cee1966bba523182761dcb2b3ccb619ef
MD5 82fdcdd11c25f897f0b7164f39c2816b
BLAKE2b-256 4da7fdbe159ce99d6d9eef9cde78d797e6a78ef0679af572dcb46afb664109ba

See more details on using hashes here.

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