[英]convolutional neural network- how to use two cnn model on same image
I want to use two differently trained CNN (convolutional neural network) modules on the same image. 我想在同一张图片上使用两个训练有素的CNN(卷积神经网络)模块。 I trained the two modules, 1 for detection and one for classification.
我训练了两个模块,一个用于检测,一个用于分类。 Now, I want to use these two modules on the same image.
现在,我想在同一图像上使用这两个模块。 The code is in python using the keras and tensorflow libraries.
该代码在python中使用keras和tensorflow库。 Two different CNN on the same image
同一张图片上有两个不同的CNN
In tensorflow you need to explicitly specify the computational graph for both of your models. 在tensorflow中,您需要为两个模型明确指定计算图 。
# 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)
There are also some caveats when multiple graphs are built in one application, see this question . 在一个应用程序中构建多个图形时,也有一些警告,请参见此问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.