/transfer_learning

A keras-based transfer learning module for arbitrary image classification

Primary LanguagePythonMIT LicenseMIT

TransferLearning

Overview

transfer_learning is a keras-based transfer learning module for arbitrary end-to-end image classification. The module supports transfer learning that is based on any of the following pre-trained models

Transfer learning takes place through the following two steps

  • Quick learning via a top model
    • A top model is a pre-trained model with last block of fully connected layers being re-trained to accommodate a specific classification task.
  • Fine tuning of unfreezed layers
    • Fine tuning begins by initializing its weights to those of a top model trained in first step and re-trains those unfreezed layers, typically the final fully connected layer block + its previous adjacent convolutional layer block.

Please refer to Francois Chollet's excellent tutorial for the details of a top model and fine tuning process.

Setup

Download all the Python files of the module into the project folder. In order for the module to correctly find the data, the following folder structure is required to store the data

project_dir/
    data/
        train/
            category_1
                image_11
                image_12
                ...
            category_2
                image_21
                image_22
                ...
            ...
            category_N
                image_N1
                image_N2
                ...
        valid/
            ...
        test/
            ...

Usuage

python transfer_learning.py -m resnet50

Contact

If you have any questions or encounter any bugs, please contact the author (Feiyang Niu, statech.forums@gmail.com)