【问题标题】:Efficient way to extract pool_3 for large number of images?为大量图像提取 pool_3 的有效方法?
【发布时间】:2016-02-09 00:59:47
【问题描述】:

我想使用从一组图像中提取的 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)

虽然这很慢。是否有更快的批处理实现来执行此操作?

谢谢

【问题讨论】:

    标签: tensorflow


    【解决方案1】:

    现在还没有。我已打开 a ticket for this feature request on github 以回答另一个问题。

    【讨论】:

    猜你喜欢
    • 2021-06-23
    • 1970-01-01
    • 2019-11-28
    • 1970-01-01
    • 1970-01-01
    • 2016-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多