https://github.com/g-eoj/cv-tl-keras
Use the cross validation functions from scikit-learn to evaluate image classification transfer learning with Keras models.
https://github.com/g-eoj/cv-tl-keras
cross-validation keras numpy scikit-learn transfer-learning
Last synced: about 2 months ago
JSON representation
Use the cross validation functions from scikit-learn to evaluate image classification transfer learning with Keras models.
- Host: GitHub
- URL: https://github.com/g-eoj/cv-tl-keras
- Owner: g-eoj
- Created: 2017-07-04T20:59:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T06:46:03.000Z (over 7 years ago)
- Last Synced: 2025-03-15T04:09:23.421Z (about 1 year ago)
- Topics: cross-validation, keras, numpy, scikit-learn, transfer-learning
- Language: Python
- Homepage:
- Size: 107 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cross Validate Transfer Learning
Use the cross validation functions from scikit-learn to evaluate image classification transfer learning with Keras models.
The system has the following features:
- Transfer learning bottlenecks stored in the HDF5 format for increased speed using h5py.
- Stratified k-fold, group k-fold, and leave one group out cross validation.
- Groups can be defined in csvs so that cross validation splits are done on group membership.
- Combine or exclude classes (so you don't have to copy or delete images on disk).
- Ways to deal with unbalanced classes:
- Oversampling to balance classes during training.
- Use class balance to scale the loss function during training.
- Logger to save all terminal output to a log file.
Results (particularly individual class scores for each fold) are saved as csvs for further analysis in your platform of choice.
Training status, accuracy, F-scores, and confusion matrices are output to terminal while the tests are running.
Additional info, such as model or data summaries, can also be output to terminal.
## Quick Intro
[CIFAR-10 Example Notebook](./examples/cifar10-example.ipynb)
## Setup
Install [miniconda](http://conda.pydata.org/miniconda.html).
Create a conda environment:
conda create -n Keras python=3 numpy scipy yaml h5py scikit-learn pillow matplotlib tensorflow keras
source activate Keras
## Usage
See the example notebook and script. Most functions have detailed docstrings.
### Preparing Images
Put the images in folders named with the image class label. Then put these folders in a parent directory so the directory structure looks something like:
images
├── airplane
├── automobile
├── bird
├── cat
├── deer
├── dog
├── frog
├── horse
├── ship
└── truck