包含OTB数据绘图和保存的函数,只需要更改图片保存路径即可使用。
注意运行时输入: ./pysot-toolkit-OTB2015/bin/eval.py --show_video_level --vis
import matplotlib.pyplot as plt
import numpy as np
from .draw_utils import COLOR, LINE_STYLE
# figure_dir = r"C:\Users\lpf\Desktop\paper Latex\latex_lpf\figure\ps"
figure_dir = r"C:\Users\lpf\Desktop\毕业相关\paper\0_SiamLPF\Latex\figure\OTB2015"
def draw_success_precision(success_ret, name, videos, attr, precision_ret=None,
norm_precision_ret=None, bold_name=None, axis=[0, 1]):
# success plot
fig, ax = plt.subplots()
ax.grid(b=True)
ax.set_aspect(1)
plt.xlabel('Overlap threshold', fontdict={
'family': 'Times New Roman', 'size': 16})
plt.ylabel('Success rate', fontdict={
'family': 'Times New Roman', 'size': 16})
if attr == 'ALL':
plt.title(r'\textbf{Success plots of OPE on %s}' % (name))
path_name = name
else:
plt.title(r'\textbf{Success plots of OPE - %s}' % (attr))
path_attr = attr
plt.axis([0, 1] + axis)
success = {
}
# 阈值 产生0-1(闭区间)数组,间隔0.05
thresholds = np.arange(0, 1.05, 0.05)
for tracker_name in success_ret.keys():
value = [v for k, v in success_ret[tracker_name].items() if k in videos]
success[tracker_name] = np.mean(value)
for idx, (tracker_name, auc) in \
enumerate(sorted(success.items(), key=lambda x: x[1], reverse=True)):
if tracker_name == bold_name:
label = r"\textbf{[%.3f] %s}" % (auc, tracker_name