Code Monkey home page Code Monkey logo

keras-openslidegenerator's Introduction

OpenSlideGenerator for Keras

What's this?

This data generator enables training DNN (e.g., convnets) with very large images such as pathological slides with polygonal region annotation. It generates many randomly cropped image patches from any images that OpenSlide can handle.

It also provides several data augmentation features (see below).

Features

  • random cropping from polygonal regions
  • multiple sampling options (based on area / label / slide)
  • box-blurring with random kernel size
  • H&E-stain augmentation (Tellez et al., 2018)
  • scale augmentation (+-20%)

Dependency

  • Keras
  • OpenCV3
  • tripy
  • OpenSlide (can be installed by pip install openslide-python)
  • scikit-image

Usage example

Usage of OpenSlideGenerator is very similar to that of official ImageDataGenerator, except for that you should prepare custom input file that contains the names of slide images, polygonal regions in them and their labels. Please see the demo files and sample scripts for the detailed usage.

You can try training of convnet for trivial discrimination task (sand vs. sky in desert images) as follows.

# prepare input slide (tiled tif) from jpg
$ cd test_slides
$ for i in 1 2 3 4; do ./convert_to_tiled_tif.sh desert${i}.jpg desert${i}.tif; done

# run example script
$ cd ..
$ python train_example.py

ToDo

  • Add annotation visualization script
  • Write detailed manual

keras-openslidegenerator's People

Contributors

quolc 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.