Coder Social home page Coder Social logo

malabhri / pathology-he-auto-augment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from diagnijmegen/pathology-he-auto-augment

0.0 0.0 0.0 7.65 MB

H&E tailored Randaugment: automatic data augmentation policy selection for H&E-stained histopathology.

License: Apache License 2.0

Python 100.00%

pathology-he-auto-augment's Introduction

Updated

This repository includes the implementation of a method proposed in "Tailoring automated data augmentation to H&E-stained histopathology" accepted to MIDL 2021.

Abstract

Convolutional neural networks (CNN) are sensitive to domain shifts, which can result in poor generalization. In medical imaging, data acquisition conditions differ among institutions, which leads to variations in image properties and thus domain shift. Stain variation in histopathological slides is a prominent example. Data augmentation is one way to make CNNs robust to varying forms of domain shift but requires extensive hyperparameter tuning. Due to the large search space, this is cumbersome and often leads to suboptimal generalization performance. In this work, we focus on automated and computationally efficient data augmentation policy selection for histopathological slides. Building upon the RandAugment framework, we introduce several domain-specific modifications relevant to histopathological images, increasing generalizability. We test these modifications on H&E-stained histopathology slides from Camelyon17 dataset. Our proposed framework outper-forms the state-of-the-art manually engineered data augmentation strategy, achieving an area under the ROC curve of 0.964 compared to 0.958, respectively.

Methodology

Check the paper for methodology.

Code instructions

To run the code:

launch_experiment.py dataset_dir output_dir experiment_tag trial_tag n_epochs batch_size lr randaugment rand_m rand_n ra_type v1_type v2_type t1_type t2_type

To use the modified version of randaugment standalone you can apply the distort_image_with_randaugment function to each image in the training batch, providing following arguments magnitude (m), number of sequentially applied transforms (n or num_layers), type of a transform set (ra_type= 'Default') for transforms used in this paper.

distort_image_with_randaugment(image, m, n, ra_type)

Practical matters & clarifications

We explored following ranges of magnitudes, while tuning the RandAugment to H&E stained histopathology, (also Table 1 in the paper):

transform type magnitude range transform type magnitude range
‘identity’ - ‘shear x’ [-0.9, 0.9]
‘contrast’ [0.0, 5.5] ‘shear y’ [-0.9, 0.9]
‘brightness’ [0.0, 5.5] ‘HED shift’ [-0.9, 0.9]
‘sharpness’ [0.0, 5.5] ‘HSV shift’ [-0.9, 0.9]
‘rotation’ [-90.0, 90.0] ‘autocontrast’ -
‘translate x’ [-30.0, 30.0] ‘color’ [0.0, 5.5]
‘translate y’ [-30.0, 30.0] ‘equalize’ -

Discretized into 30 points as suggested in RandAugment code. For the final search of optimal magnitude we used the following ranges:

transform type magnitude range transform type magnitude range
‘identity’ - ‘shear x’ [-0.45, 0.45]
‘contrast’ [0.28, 2.8] ‘shear y’ [-0.45, 0.45]
‘brightness’ [0.28, 2.8] ‘HED shift’ [-0.45, 0.45]
‘sharpness’ [0.28, 2.8] ‘HSV shift’ [-0.45, 0.45]
‘rotation’ [-45.0, 45.0] ‘autocontrast’ -
‘translate x’ [-15.0, 15.0] ‘color’ [0.28, 2.8]
‘translate y’ [-15.0, 15.0] ‘equalize’ -

You can obtain these ranges py plugging values of magnitudes m from 1 to 15 into distort_image_with_randaugment function. We noticed that ranges with values of m above 15 can result in strong distortion of the histopatholological image for some transforms (i.e. brightness with m>15 results in structures in the image dissapearing), in final search we only used m={1:15}. For Camelyon17 we selected m=5, n=3.

Bear in mind that these ranges only make sense if you use same transform functions as used in this code (hsv and hed from our library and PIL for the rest).

Notes

In case of any questions, please contact: [email protected]

Publication

If you find this work useful, cite as:

@InProceedings{faryna21,
  title = 	 {Tailoring automated data augmentation to H&E-stained histopathology},
  author =       {Faryna, Khrystyna and van der Laak, Jeroen and Litjens, Geert},
  booktitle = 	 {Proceedings of the Fourth Conference on Medical Imaging with Deep Learning},
  pages = 	 {168--178},
  year = 	 {2021},
  editor = 	 {Heinrich, Mattias and Dou, Qi and de Bruijne, Marleen and Lellmann, Jan and Schläfer, Alexander and Ernst, Floris},
  volume = 	 {143},
  series = 	 {Proceedings of Machine Learning Research},
  month = 	 {07--09 Jul},
  publisher =    {PMLR},
  pdf = 	 {https://proceedings.mlr.press/v143/faryna21a/faryna21a.pdf},
  url = 	 {https://proceedings.mlr.press/v143/faryna21a.html},

}

pathology-he-auto-augment's People

Contributors

khrystynafaryna avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.