• Python Script --- eval_single_video_SR and plot the curve


    import numpy as np
    import pdb

    resScore = np.loadtxt("/home/wangxiao/Downloads/pysot/experiments/siamrpn_r50_l234_dwxcorr_otb/results/response_score/responseScore.txt")

    res = np.loadtxt("/home/wangxiao/Downloads/pysot/experiments/siamrpn_r50_l234_dwxcorr_otb/results/siamrpn_resnet50_dwxcorr_otb/Assian_video_Z03_done.txt")
    gt_rects = np.loadtxt("/home/wangxiao/Downloads/pysot/experiments/siamrpn_r50_l234_dwxcorr_otb/results/siamrpn_resnet50_dwxcorr_otb/groundtruth.txt")

    # pdb.set_trace()

    def overlap_ratio(rect1, rect2):

    if rect1.ndim==1:
    rect1 = rect1[None,:]
    if rect2.ndim==1:
    rect2 = rect2[None,:]

    left = np.maximum(rect1[:,0], rect2[:,0])
    right = np.minimum(rect1[:,0]+rect1[:,2], rect2[:,0]+rect2[:,2])
    top = np.maximum(rect1[:,1], rect2[:,1])
    bottom = np.minimum(rect1[:,1]+rect1[:,3], rect2[:,1]+rect2[:,3])

    intersect = np.maximum(0,right - left) * np.maximum(0,bottom - top)
    union = rect1[:,2]*rect1[:,3] + rect2[:,2]*rect2[:,3] - intersect
    iou = np.clip(intersect / union, 0, 1)
    return iou

    def compute_success_overlap(gt_bb, result_bb):

    thresholds_overlap = np.arange(0, 1.05, 0.05)
    n_frame = len(gt_bb)
    success = np.zeros(len(thresholds_overlap))
    iou = np.zeros(n_frame)
    for i in range(n_frame):
    iou[i] = overlap_ratio(np.array(gt_bb[i]), np.array(result_bb[i]))
    for i in range(len(thresholds_overlap)):
    success[i] = sum(iou > thresholds_overlap[i]) / n_frame
    # return success
    return iou


    success_overlap = compute_success_overlap(gt_rects, res)

    import matplotlib.pyplot as plt
    import matplotlib.font_manager as fm

    x_data = list(range(gt_rects.shape[0]))
    y_data = success_overlap
    y_data2 = resScore

    # pdb.set_trace()

    ln1, = plt.plot(x_data,y_data,color='red',linewidth=2.0,linestyle='-')
    ln2, = plt.plot(x_data,y_data2,color='blue',linewidth=2.0,linestyle='-')

    plt.title("xxxx")
    plt.legend(handles=[ln1,ln2],labels=['IoU Value','Response Score'])

    ax = plt.gca()
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    plt.show()

    Stay Hungry,Stay Foolish ...
  • 相关阅读:
    web字体
    解决input之间的空隙
    CSS基础:text-overflow:ellipsis溢出文本
    css3控制内容的可选择性
    设置dt height 保证dd在同一行
    extjs Ext.Ajax.request 同步和异步
    jquery 同步和异步请求
    freemarker 基础
    freemarker简单使用示例
    【数据结构】线性表顺序结构的操作---C/C++语言
  • 原文地址:https://www.cnblogs.com/wangxiaocvpr/p/14333585.html
Copyright © 2020-2023  润新知