Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Finetuning CNNs in Keras

These examples train and finetune CNNs in Keras with the goal of exploring curriculum learning: the effect of training data order (from simple to more complex, or general to more specific material) on the performance or accuracy of the network. The dataset is iNaturalist 2017, which contains >675K photos of >5K different species of life. Species are also annotated with higher-level taxonomy like biological class, phylum, and/or kingdom.

Data acquisition and tools

The full iNaturalist 2017 dataset, available here, is 186GB. You can download a more manageable random 12K subset by clicking this link. You can also download a small dataset (10GB) for curriculum learning (one copy partitioned into 5 biological classes and another into 25 species) by clicking this link. The data_tools directory contains a helper script to generate other subsets for training via symlinks.

Training a small CNN

This example trains a small CNN on images of plants and animals using Keras. Highly configurable through command line flags: run with -h to see all the options. For more context on this example, see this blog post and this W&B report, which explores various settings and hyperparameters.

cd examples/keras-cnn-nature
wandb init

Finetuning experiments

Enables two kinds of finetuning experiments:

  • loading various pretrained base CNNs in Keras (Xception, ResNet, InceptionResNetV2, InceptionV3), pretraining for some epochs, freezing some of the layers of the resulting network, then continuing to finetune the rest of the layers
  • loading a small CNN, pretraining on general labels (in this case, predicting one of 5 biological classes) for a certain number of epochs, then finetuning on specific labels (predicting one of 25 biological species). Note that you'll likely need to modify the absolute paths for loading the curriculum learning data on L205:208 of

For more context on this example, see this W&B report.

Highly configurable with commandline flags: run with -h to see all the options.

cd examples/keras-cnn-nature
wandb init
You can’t perform that action at this time.