tensorflow版本Faster R-CNN特徵圖可視化

參考文獻:

https://blog.csdn.net/zd_nupt/article/details/77508083

endernewton 的 Tensorflow 版 Faster RCNN 代碼:

https://github.com/endernewton/tf-faster-rcnn

主要代碼:

with tf.Session() as sess:#打開會話
    sess.run(init)#初始化
    img1 = mnist.train.images[1]#輸入圖片
    img1.shape = [1, 784]#轉換接口格式
    result = sess.run(h_conv1, feed_dict={xs : img1})#提取tensor特徵
    for i in range(32):#畫出每一張特徵圖
        show_img = result[:, :, :, i]
        # print type(show_img)
        show_img.shape = [28, 28]
        plt.subplot(4, 8, i + 1)#打開一個4x8的畫布。
        plt.imshow(show_img, cmap='gray')
        plt.axis('off')
    plt.show()

我用的resnetv1_101,也就是slim封裝好的模型。下面可視化RPN輸入的特徵圖。

單張顯示:(看出來已經對目標有感應了。)

集體顯示:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章