首页 文章

卷积神经网络 - 如何在同一图像上使用两个cnn模型

提问于
浏览
0

我想在同一图像上使用两个不同训练的CNN(卷积神经网络)模块 . 我训练了两个模块,1个用于检测,1个用于分类 . 现在,我想在同一图像上使用这两个模块 . 代码在python中使用keras和tensorflow库 . Two different CNN on the same image

1 回答

  • 0

    在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 .

相关问题