Skin Lesion Classification: Transformation-based approach to CNNs
Installing / Getting started
A minimal setup you need to get running.
- NVIDIA GPU
- python 3
Sonnet and TensorFlow
Virtual Environment (Recommended)
The following commands are assuming several locations which may be different for your system. virtualenvwrapper
sudo -H pip install virtualenvwrapper mkvirtualenv --python=/usr/bin/python3 isic_cnn git clone https://github.gatech.edu/clehman31/isic_cnn.git cd isic_cnn workon isic_cnn pip install [where ever you stored your TensorFlow and Sonnet .whl files] pip install -R requirements.txt
We modified the ISIC-archive by creating square crops registered on the legion in the images in order to remove large colored stickers and normalize the scale. Any images where the legion was smaller than 100px X 100px were not used. This resulted in ~6000 images.
First, download the data and generate the TFRecords using isic_input.py. This will build random 80/20 split for training/testing images, it does not care about distribution of labels. Be sure to indicate the where the images are located and what you want the TFRecords to be named.
IMAGE_SHAPE = [220, 220, 3] NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN = 4540 NUM_EXAMPLES_PER_EPOCH_FOR_TEST = 1136 PATH_TO_IMAGES = 'isic_cnn_data' TRAIN_NAME = 'isic_train' TEST_NAME = 'isic_test'
Training & Evaluation
Though it is not necessary to edit the hyperparameters they are listed below.
BATCH_SIZE = 10 EVAL_SIZE = 1136 NUM_CLASSES = 2 CHECKPOINT_DIR = '/tmp/experiments/tf/isic_cnn/' CHECKPOINT_INTERVAL = 100 MAX_STEPS = 2000 REPORT_INTERVAL = 1 RGB_REDUCE_LEARNING_RATE_INTERVAL = 1000 FFT_REDUCE_LEARNING_RATE_INTERVAL = 1000 HSV_REDUCE_LEARNING_RATE_INTERVAL = 1000 RGB_LEARNING_RATE = 1e-2 FFT_LEARNING_RATE = 1e-2 HSV_LEARNING_RATE = 1e-2 LEARNING_RATE_MULTIPLIER = 0.95 NUM_GPU = 2
To evaluate only just comment out the train function.
def main(argv = None): train(MAX_STEPS, REPORT_INTERVAL, with_test=True) evaluate()