Skip to content

dysdsyd/cnn_finetune

 
 

Repository files navigation

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. This repo serves to fill this gap by providing working examples of fine-tuning on Cifar10 dataset with ImageNet pretrained models on popular ConvNet implementations.

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

Usage

For illustration purpose, let's say you want to perform fine-tuning with VGG-16. First, download the ImageNet pretrained weights for VGG-16 to the imagenet_models directory. The schema and sample code for fine-tuning on Cifar10 can be found in vgg16.py. Run the file:

python vgg16.py

The code will automatically download Cifar10 dataset and performs fine-tuning with VGG-16. Please be aware that it might take some time (up to minutes) for the model to compile and load the ImageNet weights.

If you wish to perform fine-tuning on your own dataset, you have to replace the module which loads the Cifar10 dataset with your own load_data() module to load your own dataset.

ImageNet Pretrained Models

Network Theano Tensorflow
VGG-16 model (553 MB) -
VGG-19 model (575 MB) -
GoogLeNet (Inception-V1) model (54 MB) -
Inception-V3 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 1.2.2
  • Theano 0.8.2 or TensorFlow 0.12.0

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%