Git Product home page Git Product logo

skin_lesion_classification's Introduction

Skin Lesion Classification with AlexNet

Brief Description

This repo use AlexNet for skin lesion image classification, serves as a baseline model. The images are from ISBI2016_ISIC_Part3, an image classification contest, to distinguish benign and malignant images.

Image Details

PNG format images. 900 for train and validation. 379 for test.

In my experiments, 70% of 900 (i.e. 630) are randomly chosen for training, the remaining 30% (270) for validation. And the 370 for final test.

Steps for practise

0. Pretrained model

Put pretrained AlexNet model to: data/imagenet_models/alex.caffemodel (download it from here)

1. Dataset

Download dataset and extract them to data/isic2016/images/*.jpg. Also, prepare train.txt, val.txt and test.txt under data/isic2016/splits/ folder.

I use python interface to create lmdb database files:

# remember to modify folder path in this file first!
python tools/create_lmdb.py

Note that the default transformation is: (1) resize image to 256 x 256 (2) histogram equalization in applied on center region of resize image. Then you will see data/isic2016/*_lmdb folders.

Also, make a mean file:

bash tools/make_binaryproto.sh

2. Dependencies

  1. OpenCV's Python interface

  2. Caffe as deep learning framework. Compile Caffe with its Python interface.

  3. VisualDL for metrics scalars(such as AP, Accuracy, etc) visualization during training.

  4. sklearn, a python package, here for metrics calculation.

  5. Weighted Softmax Cross Entropy Loss

3. Training and Evaluation

The folder models/{dataset}/{network}/{lab_scheme} serves as a specific folder to contain prototxt files(train.pt, test.pt, solver.pt)

Begin training

./experiments/scripts/solve_isic.sh isic2016 alex lab5

This script will do training with validation after each epoch.

Visualization

visualDL --logdir ./experiments/vdl_logs/isic2016_alex_lab5 --port 8095

Now visit http://localhost:8093 to see realtime plot of received scalars (ACC, AUC, AP, SE, SP, loss, etc)

e.g.

Evaluation To evaluate on test dataset, please prepare the trained model, either train it yourself, or download my trained model via BaiduDisk.

Evaluate:

# remember to modify caffemodel file path before using your own model.
python tools/cls_infer_isic.py 

4. Result

With AlexNet's lab5 (models/isic2016/alex/lab5), I use these:

resize: 256 x 256
histogram equalization on 50~205 region of resize image
randomly mirror during training
weighted loss weight(2.3 on malignant, 1.0 on begine)
learing rate step: 2000
batch size: train(21), val(54)
base learing rate: 0.001
optimization method: SGD, momentum=0.9 wecay=0.0005
number of iteration: 2000 (~70 training epochs)

Metrics that I obtain:

ACC=0.834, AUC=0.834, AP=0.586, SE=0.500, SP=0.910

And the ranklist during that contest(from here) is:

ISIC RANKLIST

As the contest mainly rank by AP, this repo provides a competative baseline with 0.586 AP, can rank top4.

skin_lesion_classification's People

Contributors

zchrissirhcz avatar

Watchers

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