/cnn_finetune

Fine-tune CNN in Keras

Primary LanguagePython

Fine-tune Convolutional Neural Network in Keras with ImageNet Pretrained Models

The reason to create this repo is that there are not many online resources that provide sample codes for performing fine-tuning, and that there is not a centralized place where we can easily download ImageNet pretrained models for common ConvNet architectures such as VGG, Inception, ResNet, and DenseNet.

See this for a comprehensive treatment of fine-tuning Deep Learning Models in Keras

Usage

|VGG-16|

model = vgg16_model(img_rows, img_cols, channel, nb_classes, freeze)

|VGG-19|

model = vgg19_model(img_rows, img_cols, channel, nb_classes)

|Inception-V3|

model = inception_v3_model(img_rows, img_cols, channel, nb_classes)

|Inception-V4|

model = inception_v4_model(img_rows, img_cols, channel, nb_classes, dropout_keep_prob=0.2)

|ResNet-50/ResNet-101/ResNet-152|

model = resnet50_model(img_rows, img_cols, channel, nb_classes)

|DenseNet-121/DenseNet-161/DenseNet-169|

model = densenet121_model(img_rows, img_cols, color_type=channel, num_classes=nb_classes)

ImageNet Pretrained Models

Network Theano Tensorflow
VGG-16 model (553 MB) model (553 MB)
VGG-19 model (575 MB) model (575 MB)
GoogLeNet (Inception-V1) model (54 MB) -
Inception-V3 model (95 MB) model (95 MB)
Inception-V4 model (172 MB) model (172 MB)
ResNet-50 model (103 MB) model (103 MB)
ResNet-101 model (179 MB) model (179 MB)
ResNet-152 model (243 MB) model (243 MB)
DenseNet-121 model (32 MB) model (32 MB)
DenseNet-169 model (56 MB) model (56 MB)
DenseNet-161 model (112 MB) model (112 MB)

Requirements

  • Keras 2.0.3
  • TensorFlow 1.1.0