Precomputing conv layer outputs of Inception-v3 model

Hi all,
I am trying to pre compute the convolution layer outputs of Inception-v3 model. When I use Inception-v3 for transfer learning on “dogs Vs cats” dataset I am able to achieve 97% accuracy. But when I pre-calculate the conv layer outputs and do it, I am not getting more than 75%. can anyone help me with why it is not giving good performance ?

I am using the following code:

//using Inception Base Model, whose output would be a output of the last convolution layer of this model
inception_base = InceptionV3(input_dim=(img_rows,img_cols),include_top=False)
train_data = inception_base.model.predict_generator(train_batches, int(np.ceil(train_batches.samples/batch_size)))
validation_data = inception_base.model.predict_generator(val_batches, int(np.ceil(val_batches.samples/batch_size)))

// defining last layers
model = Sequential()
model.add(GlobalAveragePooling2D(input_shape=train_data.shape[1:]))
model.add(Dense(1024, activation=‘relu’))
model.add(Dense(2, activation=‘softmax’))
model.compile(optimizer=RMSprop(lr=0.1),
loss=‘mse’,
metrics=[‘accuracy’])

//training the sequential model declared
model.optimizer.lr=0.001
model.fit(train_data, trn_labels, nb_epoch=10, batch_size=batch_size, validation_data=(validation_data, val_labels))

complete code can be found at in the repo :
Setup: I am using Keras-2.0, Python 3, Backend is Tensorflow
’using_convolution_outputs_new.ipynb’ has the complete precomputed conv layer code.
I am currently working on a huge dataset and want to reduce training time using this technique.

thank you

1 Like

Have you found any solution to this?

I haven’t

Even I am facing similar issue. Did you find out solution?