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.
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.
Put pretrained AlexNet model to: data/imagenet_models/alex.caffemodel
(download it from here)
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
-
OpenCV's Python interface
-
Caffe as deep learning framework. Compile Caffe with its Python interface.
-
VisualDL for metrics scalars(such as AP, Accuracy, etc) visualization during training.
-
sklearn, a python package, here for metrics calculation.
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)
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
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:
As the contest mainly rank by AP, this repo provides a competative baseline with 0.586 AP, can rank top4.