tests.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:tf-Faster-RCNN 作者: kevinjliang 项目源码 文件源码
def plot_img(image, gt_box):
        """ Takes an image and bounding box coordinates and displays it using matplotlib """

        # First print out image metrics
        print("Using First Image of the Batch..")
        print("Image Max Value (should be less than 1): %f" % image.max())
        print("Image Min Value (should be greater than -1): %f" % image.min())
        print("Image Mean Value (should be equal to 0): %f" % image.mean())
        print("Digit: %d" % gt_box[4])

        # Import matplotlib and setup axes
        import matplotlib
        matplotlib.use('TkAgg')  # For Mac OS
        import matplotlib.pyplot as plt
        import matplotlib.patches as patches
        fig, ax = plt.subplots(1)

        # Plot Image First
        ax.imshow(np.squeeze(image), cmap="gray")

        # Calculate Bounding Box Rectangle and plot it
        width = gt_box[3] - gt_box[1]
        height = gt_box[2] - gt_box[0]
        rect = patches.Rectangle((gt_box[1], gt_box[0]), height, width, linewidth=2, edgecolor='r', facecolor='none')
        ax.add_patch(rect)

        # Display Final composite image
        plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号