Skip to content

Computes features for images using various pretrained Tensorflow models

Notifications You must be signed in to change notification settings

bisunny/Compute-Features

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compute-Features

Computes features for images using various pretrained Tensorflow models. For each model, this will output the final fully connected layer (e.g. fc7 for Alexnet, fc8 for VGG_19, etc.). These can be used within various applications such as classification, clustering, etc.

Usage

Download one of the checkpoint files below, for example Inception V1.

tar -xvf inception_v1_2016_08_28.tar.gz
python compute_features.py --data_dir=test_images/ --checkpoint_file=inception_v1.ckpt --model=inception_v1

The output will be in inception_v1_features.pkl, which contains a dictionary of the form {image_path:feature}.

Look at load_features.py for an example of how to use the features that were computed. For example,

python load_features.py features/inception_v1_features.pkl

Some of these aren't working, such as inception_v4 due to differences in the model checkpoint and the model defined in the nets/ directory. Still working on that.

Pre-trained Models

You can download all models here. Otherwise links for individual models can be found below.

These CNNs have been trained on the ILSVRC-2012-CLS image classification dataset.

In the table below, we list each model, the corresponding TensorFlow model file, the link to the model checkpoint, and the top 1 and top 5 accuracy (on the imagenet test set). Note that the VGG and ResNet V1 parameters have been converted from their original caffe formats (here and here), whereas the Inception and ResNet V2 parameters have been trained internally at Google. Also be aware that these accuracies were computed by evaluating using a single image crop. Some academic papers report higher accuracy by using multiple crops at multiple scales.

Model TF-Slim File Checkpoint Top-1 Accuracy Top-5 Accuracy
Inception V1 Code inception_v1_2016_08_28.tar.gz 69.8 89.6
Inception V2 Code inception_v2_2016_08_28.tar.gz 73.9 91.8
Inception V3 Code inception_v3_2016_08_28.tar.gz 78.0 93.9
Inception V4 Code inception_v4_2016_09_09.tar.gz 80.2 95.2
Inception-ResNet-v2 Code inception_resnet_v2_2016_08_30.tar.gz 80.4 95.3
ResNet V1 50 Code resnet_v1_50_2016_08_28.tar.gz 75.2 92.2
ResNet V1 101 Code resnet_v1_101_2016_08_28.tar.gz 76.4 92.9
ResNet V1 152 Code resnet_v1_152_2016_08_28.tar.gz 76.8 93.2
ResNet V2 50 Code resnet_v2_50_2017_04_14.tar.gz 75.6 92.8
ResNet V2 101 Code resnet_v2_101_2017_04_14.tar.gz 77.0 93.7
ResNet V2 152 Code resnet_v2_152_2017_04_14.tar.gz 77.8 94.1
VGG 16 Code vgg_16_2016_08_28.tar.gz 71.5 89.8
VGG 19 Code vgg_19_2016_08_28.tar.gz 71.1 89.8

About

Computes features for images using various pretrained Tensorflow models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%