Skip to content

aetherAI/stain-mixup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stain Mix-up

This repository provide the core idea of Stain Mix-Up: Domanin Generalization for Histopathology Images as an image augmentation technique.

To address the issue of unseen color domain generalization in histopathological images, the stain mix-up generate a pseudo stain matrix by interpolating stain matrices between soruce and target domain. Hence, images augmented by reverting the source image concentration and the interploated stain matrix can increase variability of training data without shape/detail distortion, and thus increasing model robustness.

Publication

Chang, J.-R., Wu, M.-S., Yu, W.-H., Chen, C.-C., Yang, C.-K., Lin, Y.-Y., & Yeh, C.-Y. (2021). Stain mix-up: Unsupervised domain generalization for histopathology images. Medical Image Computing and Computer Assisted Intervention – MICCAI 2021, 117–126. https://doi.org/10.1007/978-3-030-87199-4_11

License

Copyright (C) 2021 aetherAI Co., Ltd. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).

Examples

Examples of the source domain and the target domain Example of source image to convert Augmented results

Installation

To install the package, users can simply clone the repository and pip install it.

$ git clone https://github.com/aetherAI/stain-mixup.git
$ cd stain_mixup
$ pip install .

NOTE The spams might have other dependencies.

sudo apt install liblapack-dev libblas-dev

Usage

  1. Get stain matrix. You can derive your stain matrix by different methods such as Vahadane or Macenko.
from stain_mixup.utils import get_stain_matrix


stain_matrix = get_stain_matrix(image)

Note: Larger/more images will generate a more stable stain matrix. We strongly recommend users to generate a stable stain matrix by refering to official spams.

  1. Convert image from the source domain to target domain.
from stain_mixup.augment import stain_mixup

...

augmented_image = stain_mixup(
    image,
    source_stain_matrix,
    target_stain_matrix,
)

Contributors

Jia-Ren Chang
Min-Shen Wu
Wei-Hsiang Yu
Chi-Chung Chen
Che-Ming Wu

About

The repository provide augment function of "Stain mix-up: Unsupervised domain generalization for histopathology images"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages