Thanks to visit codestin.com
Credit goes to github.com

Skip to content

innat/medic-ai

Repository files navigation

Palestine

Static Badge Static Badge Static Badge Static Badge

Medic-AI is a Keras based library designed for medical 2D and 3D image analysis using machine learning techniques. Its core strengths include:

  • Backend Agnostic: Compatible with tensorflow, torch, and jax.
  • User-Friendly API: High-level interface for transformations and model creation of both 2D and 3D.
  • Scalable Execution: Supports training and inference on single/multi-GPU and TPU-VM setups.
  • Essential Components: Includes standard medical specific metrics and losses, such as Dice. Support GradCAM for segmentation and classification on both 2D and 3D input.
  • Optimized 3D Inference: Offers an efficient sliding-window method and callback for volumetric data.

πŸ“‹ Table of Contents

  1. Installation
  2. Features
  3. Guides
  4. Documentation
  5. Acknowledgements
  6. Citation

πŸ›  Installation

PyPI version:

!pip install medicai

Installing from source GitHub: (recommended)

!pip install git+https://github.com/innat/medic-ai.git

Quick Overview

For details end-to-end training workflow, please check the guide section.

from medicai.models import SwinUNETR, UNet
from medicai.models import SwinTiny, SwinTinyV2
from medicai.models import SwinBackbone, SwinBackboneV2

# Build 3D model.
model = SwinUNETR(
    encoder_name='swin_tiny_v2', input_shape=(96,96,96,1)
)
model = UNet(
    encoder_name='densenet121', input_shape=(96,96,96,1)
)

# Build 2D model.
model = SwinUNETR(
    encoder_name='swin_tiny_v2', input_shape=(96,96,1)
)
model = UNet(
    encoder_name='densenet121', input_shape=(96,96,1)
)
# Build with pre-built encoder.
encoder = SwinTiny(
    input_shape=(96,96,96,1),
    patch_size=2, 
    downsampling_strategy='swin_unetr_like'
)
model = SwinUNETR(encoder=encoder)

# Build with custom encoder.
custom_encoder = SwinBackboneV2(
    input_shape=(64, 128, 128, 1),
    embed_dim=48,
    window_size=8,
    patch_size=2,
    downsampling_strategy='swin_unetr_like'
)
model = SwinUNETR(encoder=custom_encoder)

πŸ“Š Features

Available Models : The following table lists the currently supported models along with their supported input modalities, primary tasks, and underlying architecture type. The model inputs can be either 3D (depth Γ— height Γ— width Γ— channel) or 2D (height Γ— width Γ— channel).

Model Supported Modalities Primary Task Architecture Type
DenseNet 2D, 3D Classification CNN
ResNet-V1,V2 2D, 3D Classification CNN
ResNeXt 2D, 3D Classification CNN
SE-ResNet 2D, 3D Classification CNN
SE-ResNeXt 2D, 3D Classification CNN
Xception 2D, 3D Classification CNN
EfficientNet-V1,V2 2D, 3D Classification CNN
ConvNeXt-V1,V2 2D, 3D Classification CNN
ViT 2D, 3D Classification Transformer
MiT 2D, 3D Classification Transformer
Swin Transformer-V1,V2 2D, 3D Classification Transformer
UNet 2D, 3D Segmentation CNN
UNet++ 2D, 3D Segmentation CNN
AttentionUNet 2D, 3D Segmentation CNN
DeepLabV3Plus 2D, 3D Segmentation CNN
UPerNet 2D, 3D Segmentation CNN
UNETR 2D, 3D Segmentation Transformer
UNETR++ 2D, 3D Segmentation Transformer
SwinUNETR 2D, 3D Segmentation Transformer
SwinUNETR-V2 2D, 3D Segmentation Transformer
TransUNet 2D, 3D Segmentation Transformer
SegFormer 2D, 3D Segmentation Transformer

Available Transformation: The following preprocessing and transformation methods are supported for volumetric data. The following layers are implemented with TensorFlow operations. It can be used in the tf.data API or a Python data generator and is fully compatible with multiple backends, tf, torch, jax in training and inference, supporting both GPUs and TPUs.

CropForeground
NormalizeIntensity
Orientation
RandCropByPosNegLabel
RandFlip
RandRotate90
RandRotate
RandCutOut
RandShiftIntensity
RandSpatialCrop
Resize
ScaleIntensityRange
Spacing

πŸ’‘ Guides

Segmentation: Available guides for 3D segmentation task.

Task GitHub Kaggle View
Covid-19
BTCV n/a
BraTS n/a
Spleen

Classification: Available guides for 3D classification task.

Task (Classification) GitHub Kaggle
Covid-19

Classification: Available guides for 2D classification task.

Task (Classification) GitHub Kaggle
MedMNIST [BloodMNIST]

Segmentation: Available guides for 2D segmentation task.

Task (Segmentation) GitHub Kaggle
ISIC-2017

πŸ“š Documentation

To learn more about model, transformation, and training, please visit official documentation: medicai/docs

🀝 Contributing

Please check the contribution guide here.

πŸ™ Acknowledgements

This project is greatly inspired by MONAI.

πŸ“ Citation

If you use medicai in your research or educational purposes, please cite it using the metadata from our CITATION.cff file.