gpt4 book ai didi

tensorflow - 为大量图像提取 pool_3 的有效方法?

转载 作者:行者123 更新时间:2023-12-02 02:56:56 28 4
gpt4 key购买 nike

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

但这相当慢。是否有更快的批处理实现来执行此操作?

谢谢

最佳答案

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

关于tensorflow - 为大量图像提取 pool_3 的有效方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35261789/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com