Trains a softmax regression model on CIFAR-10 using CNN pool_3 weights from inception-v3.
Forked from https://github.com/sthomp/tensorflow_transfer_cifar10
Made changes to do training in batches.
This is the code that supplements the original blog post
- Download and extract CIFAR-10 dataset to resources/datasets/
- Download and extract the Inception v3 model to resources/
- First generate and save bottleneck features.
To generate the bottleneck features set the flag DO_SERIALIZATION in transfer_cifar10_softmax.py to True:
#flag to generate and save bottleneck features
DO_SERIALIZATION = False
-
Run script transfer_cifar10_softmax.py This would run the input images through the trained Inception V3 network and save the output of the pool_3 layer.
-
The previous step would generate .npy files in the project root directory. The files will be
- X_train.npy
- X_test.npy
- Y_train.npy
- Y_test.npy These files store the oputput of layer pool3 of the Inception model and the corresponding labels. Training for the new task will use these as inputs.
-
Add desired layers by modifying function
add_final_training_ops()
in transfer_cifar10_softmax.py. -
Set flag DO_SERIALIZATION to False.
-
run script transfer_cifar10_softmax.py.
function load_CIFAR10()
in data_utils.py can be modified to return only 1000 training images and 100 test images from the CIFAR-10 data. This will speed up the
generation of bottlenecks for a quick demo.
- Fix to train in batches
- Code Cleanup
- Create methods and classes
- Fix tsne plotting code