Code Monkey home page Code Monkey logo

unet-tensorflow-keras's Introduction

Unet-tensorflow-keras

A concise code for training and evaluating Unet using tensorflow+keras

A simple practice of the mixture usage of tensorflow and keras for the segmentation task. Sometime using Keras to manage the training is not flexiable. But we still want to utilize the convenience of Keras to build the model. Using Keras to build the model is super easy and fully compatible with Tensorflow.

I use the Unet architecture and modify its unsampling part to automatically adjust the feature map width and height when merge (concat) with previous layers. In this way, we do not need to compute the specific input size to fit the model but take an arbitrary size.

UPDATE, Oct 2017:

  • Take the image loader out of keras package to prevent the unpaird image/mask bug
  • Use Tensorflow.contrib.keras
  • Improve usability
  • Python 3 supported

UPDATE, July 2017:

  • Change the code to fit Tensorflow > 1.0
  • Adding a loader file to use Keras generator to load image and mask with automatic augmentation
  • Adding a VIS module to manage the evaluation metric.
  • Adding opt.py to support easier use

Usage

  • See loader.py to organize your train/test data hierarchy

  • Set necessary hpyerparameters and run train.py

    python train.py --data_path ./datasets/your_dataset_folder/ --checkpoint_path ./checkpoints/unet_example/
  • Visualize the train loss, dice score, learning rate, output mask, and first layer convolutional kernels per iteration in tensorboard

    tensorboard --logdir=train_log/
    
  • When checkpoints are saved, you can use eval.py to test an input image with an arbitrary size.

  • Evaluate your model

    python eval.py --data_path ./datasets/your_dataset_folder/ --load_from_checkpoint ./checkpoints/unet_example/model-0 --batch_size 1

unet-tensorflow-keras's People

Contributors

zizhaozhang avatar

Watchers

James Cloos 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.