由于vot-tookit一直没有改出来这是一个绕过vot-tookit的实现的方法Da-SiamRPN的复现(非vot toolkit环境)
VOT2018表现抢眼的Da SiameseRPN 的结果和代码已经公布,结果链接
我主要是做的是VOT2018-baseline结果的可视化
F:\DaSiamRPN_VOT2018\SiamRPN\baseline
目录里是数据名称,里面是结果的文本文件。
打开任意一个文件,可以看到:
1
129.9982,472.0081,24.6704,60.6127
134.7336,505.3270,24.3238,61.2944
150.0695,557.3633,25.2360,60.9369
155.8515,574.0930,25.4967,60.4395
155.4509,581.5272,25.4602,60.7933
154.3121,584.6936,25.7224,60.3026
154.2443,586.5606,25.8430,60.3916
155.7579,585.4097,26.5962,59.3330
156.7315,584.7499,27.1430,58.9002
157.7630,585.7665,27.5521,58.4631
158.4078,585.8468,27.6484,58.5722
158.8659,585.9130,27.5617,58.6804
159.9025,586.2085,28.1295,56.9109
159.1193,587.2997,28.3570,55.9945
158.7357,588.3513,28.4146,55.2446
159.2287,595.0887,28.2253,55.5174
159.9423,595.8986,28.0894,55.5992
160.6438,598.3456,27.5642,56.4028
162.5252,607.1038,26.4603,58.0092
第一帧来自groundtruth,其他均以x,y,w,h的格式保存
可视化的过程就是将文本文件的内容读取,然后调用opencv-python cv2.rectangle函数
你也可以txt内容保存为csv文件,其实大致过程是一样的,细节可能需要处理一些符号的去除
import cv2
import os
import numpy as np
import math
import csv
list0=[]
file_dir='//home//mars//Documents//Subject2018//data//VOT2018//ants1//img//'
for files in os.walk(file_dir):
list0.append(files)
img_list=[]
for ii in list0[0][2]:
img_list.append(ii)
list_img_name=np.array(img_list)
list_img_name.sort()
# print(list_img_name)
csv_file = csv.reader(open('//home//mars//Documents//Subject2018//ants.csv'))
list2=[]
for i in csv_file:
list2.append(i)
list3=np.array(list2)
list4=[]
list_temp=[]
for j in list3:
list_temp=np.array([0.0 if y=='' else float(y) for y in j])
list4.append(list_temp)
list5=np.array(list4)
list_temp1=[]
list_temp2=[]
for k in list5:
list_temp1=np.array([int(z) for z in k])
list_temp2.append(list_temp1)
list_rect=np.array(list_temp2)
for num in range(0,324):
#print(list_rect[num][0])
if list_rect[num][0]>2:
img_file_name='/home/mars/Documents/Subject2018/data/VOT2018/ants1/img/'+str(list_img_name[num])
# print(img_file_name)
src=cv2.imread(img_file_name)
# cv2.imshow('aa',src)
# cv2.waitKey(0)
x=list_rect[num][0]
y=list_rect[num][1]
w=list_rect[num][2]
h=list_rect[num][3]
cv2.rectangle(src,(x,y),(x+w,y+h),(0,0,255),)
# cv2.imshow('aa',src)
# cv2.waitKey(0)
save_file_name="//home//mars//Documents//Subject2018//temp//"+str(list_img_name[num])
print(save_file_name)
cv2.imwrite(save_file_name,src)
读取txt文件的主要过程:
data=[]
for line2 in open(path):
data.append(line2)
#print(line2)
data1=[]
for i in data:
data1.append(i[:len(i)-1])
data2=[]
data3=[]
for j in data1:
data2.append(j.split(','))
# print(data2[1])
data4=[]
for k in data2:
data3=np.array([0.0 if y=='' else float(y) for y in k])
data4.append(data3)
data_rect=np.array(data4)
全部代码
较有挑战的结果展示:
高清视频结果展示
ants3
motorcross2
crab1
motorcross1