Giter Club home page Giter Club logo

cfl's Introduction

CFL

Constrained focal loss for the segmentation of anthrax spore

DeepLab-v3+ Semantic Segmentation with constrained focal loss in TensorFlow

This repo implement DeepLabv3+ with constrained focal loss in TensorFlow for semantic image segmentation on the anthrax spore dataset. The implementation is largely based on rishizek's DeepLab v3+ implemantation

Setup

Please install latest version of TensorFlow and use Python 3.

dataset

we use our anthrax spore dataset(https://drive.google.com/open?id=1-Cjy4tkhgBxTip2B_3esqw8xWkzofcZX) to train deeplab v3+ model using constrained focal loss. in anthrax spore dataset: -training set: 400 images -testing set: 200 images There are two classes in each image——background and anthrax spore.

loss

We implement the proposed constrained focal loss in constrained_focal_loss_impl.py.

Training

For training model, you first need to convert original data to the TensorFlow TFRecord format. This enables to accelerate training seep.

python create_pascal_tf_record.py --data_dir DATA_DIR \
                                  --image_data_dir IMAGE_DATA_DIR \
                                  --label_data_dir LABEL_DATA_DIR 

Once you created TFrecord for PASCAL VOC training and validation deta, you can start training model as follow:

python train.py --model_dir MODEL_DIR --pre_trained_model PRE_TRAINED_MODEL

Here, --pre_trained_model contains the pre-trained Resnet model, whereas --model_dir contains the trained DeepLabv3 checkpoints. If --model_dir contains the valid checkpoints, the model is trained from the specified checkpoint in --model_dir.

You can see other options with the following command:

python train.py --help

Evaluation

To evaluate how model perform, one can use the following command:

python evaluate.py --help

Inference

To apply semantic segmentation to your images, one can use the following commands:

python inference.py --data_dir DATA_DIR --infer_data_list INFER_DATA_LIST --model_dir MODEL_DIR 

TODO:

Pull requests are welcome.

  • Freeze batch normalization during training
  • Multi-GPU support
  • Channels first support (Apparently large performance boost on GPU)
  • Model pretrained on MS-COCO
  • Unit test

Acknowledgment

This repo borrows code heavily from

first commit

cfl's People

Contributors

ydfkaf avatar

Stargazers

 avatar

Forkers

quangnguyentang

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.