【问题标题】:convolutional neural network- how to use two cnn model on same image卷积神经网络 - 如何在同一张图像上使用两个 cnn 模型
【发布时间】:2017-12-13 08:28:38
【问题描述】:

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

【问题讨论】:

    标签: python-2.7 tensorflow deep-learning keras


    【解决方案1】:

    在 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-06
      • 2019-08-03
      • 2015-04-09
      • 2023-03-28
      • 1970-01-01
      • 2020-05-26
      • 2021-03-04
      • 2017-10-21
      相关资源
      最近更新 更多