Tensorflow 为大量图像提取池_3的有效方法?

Tensorflow 为大量图像提取池_3的有效方法?,tensorflow,Tensorflow,我想使用从一组图像中提取的pool_3特征。目前,我在每个图像上都有一个循环来提取pool_3功能: # 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 poo

我想使用从一组图像中提取的pool_3特征。目前,我在每个图像上都有一个循环来提取pool_3功能:

# 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)
但这相当缓慢。是否有更快的批处理实现来实现这一点


谢谢,还没有。我开始回答另一个问题。

对于提取池特征,它实际上是有效的,-分类不是没有变化的,但它很简单。