Layer-wise AlexNet fine-tuning.
alex_net = AlexNet(dataset.num_classes, 'res/alexnet-caffemodel.npy')
alex_net.fit(X_train, X_val, y_train, y_val, freeze=True, epochs=1000, lr=0.001)
when freeze=True
layer-wise fine-tuning is performed (see: 1, 2).
Use the following dataset structure: data/class_{0,..,K}/image_{0,..,N}.jpg
.
Run:
$ python fine_tune.py
If the converted (source: caffe-tensorflow) caffemodel (source: BVLC)
is not in res/
, it will be downloaded from
here.
$ python -V
Python 2.7.10
$ python -c 'import tensorflow as tf; print(tf.__version__)'
1.8.0
Original caffemodel and prototxt: [https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet]
Caffe-tensorflow conversion project: [https://github.com/ethereon/caffe-tensorflow]
Evaluation dataset: [https://www.kaggle.com/c/dogs-vs-cats]