I'd like to use pool_3 features extracted from a set of images. Currently I have a loop over each image to extract the pool_3 features:
# X_input.shape = (40000, 32, 32, 3)
def batch_pool3_features(X_input):
sess = tf.InteractiveSession()
n_train = X_input.shape[0]
print 'Extracting features for %i rows' % n_train
pool3 = sess.graph.get_tensor_by_name('pool_3:0')
X_pool3 = []
for i in range(n_train):
print 'Iteration %i' % i
pool3_features = sess.run(pool3,{'DecodeJpeg:0': X_input[i,:]})
X_pool3.append(np.squeeze(pool3_features))
return np.array(X_pool3)
This is quite slow though. Is there a faster batch implementation to do this?
Thanks
It doesn't - yet. I've opened a ticket for this feature request on github in response to another question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With