【发布时间】:2017-12-13 08:28:38
【问题描述】:
我想在同一张图像上使用两个不同训练的 CNN(卷积神经网络)模块。我训练了两个模块,一个用于检测,一个用于分类。现在,我想在同一个图像上使用这两个模块。代码在 python 中,使用 keras 和 tensorflow 库。 Two different CNN on the same image
【问题讨论】:
标签: python-2.7 tensorflow deep-learning keras
我想在同一张图像上使用两个不同训练的 CNN(卷积神经网络)模块。我训练了两个模块,一个用于检测,一个用于分类。现在,我想在同一个图像上使用这两个模块。代码在 python 中,使用 keras 和 tensorflow 库。 Two different CNN on the same image
【问题讨论】:
标签: python-2.7 tensorflow deep-learning keras
在 tensorflow 中,您需要为两个模型明确指定 the computational graph。
# build two separate graphs `g1` and `g2`
tf.reset_default_graph()
with tf.Session(graph=g1) as session:
result = sess.run(detect, feed_dict={x: test_x})
print(result)
tf.reset_default_graph()
with tf.Session(graph=g2) as session:
result = sess.run(recognize, feed_dict={x: test_x})
print(result)
在一个应用程序中构建多个图表时也有一些注意事项,请参阅this question。
【讨论】: