I am trying to evaluate the pre-trained VGG16 model on ImagenNet validation set. (keras 2.1.6, Tensorflow-gpu 1.8.0)
However, I cannot duplicate the accuracy reported on Keras’ documents.
4. Use this code to evaluate the accuracy of VGG16 on ImageNet validation.
I only got 0.63(top1) and 0.85(top5) accuracy.
However, Keras claims that they achieve 0.715(top1) and 0.901(top5) on ImageNet validation set.
from keras.applications import VGG16
from keras.applications.vgg16 import preprocess_input
from keras.preprocessing.image import ImageDataGenerator
from keras import metrics
val_datagen = ImageDataGenerator(preprocessing_function=preprocess_input)
validation_generator = val_datagen.flow_from_directory(
'/data/xincoder/imagenet/imagenet-datavalidation',
class_mode='categorical',
model = VGG16(weights='imagenet', include_top=True)
model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['acc', metrics.top_k_categorical_accuracy])
results = model.evaluate_generator(validation_generator, steps=5000, workers=1, max_queue_size=1)