-
Notifications
You must be signed in to change notification settings - Fork 104
/
votdataset.py
executable file
·122 lines (107 loc) · 4.24 KB
/
votdataset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import numpy as np
from pytracking.evaluation.data import Sequence, BaseDataset, SequenceList
class VOTDataset(BaseDataset):
"""
VOT2018 dataset
Publication:
The sixth Visual Object Tracking VOT2018 challenge results.
Matej Kristan, Ales Leonardis, Jiri Matas, Michael Felsberg, Roman Pfugfelder, Luka Cehovin Zajc, Tomas Vojir,
Goutam Bhat, Alan Lukezic et al.
ECCV, 2018
https://prints.vicos.si/publications/365
Download the dataset from http://www.votchallenge.net/vot2018/dataset.html
"""
def __init__(self):
super().__init__()
self.base_path = self.env_settings.vot_path
self.sequence_list = self._get_sequence_list()
def get_sequence_list(self):
return SequenceList([self._construct_sequence(s) for s in self.sequence_list])
def _construct_sequence(self, sequence_name):
sequence_path = sequence_name
nz = 8
ext = 'jpg'
start_frame = 1
anno_path = '{}/{}/groundtruth.txt'.format(self.base_path, sequence_name)
try:
ground_truth_rect = np.loadtxt(str(anno_path), dtype=np.float64)
except:
ground_truth_rect = np.loadtxt(str(anno_path), delimiter=',', dtype=np.float64)
end_frame = ground_truth_rect.shape[0]
frames = ['{base_path}/{sequence_path}/color/{frame:0{nz}}.{ext}'.format(base_path=self.base_path,
sequence_path=sequence_path, frame=frame_num, nz=nz, ext=ext)
for frame_num in range(start_frame, end_frame+1)]
# Convert gt
if ground_truth_rect.shape[1] > 4:
gt_x_all = ground_truth_rect[:, [0, 2, 4, 6]]
gt_y_all = ground_truth_rect[:, [1, 3, 5, 7]]
x1 = np.amin(gt_x_all, 1).reshape(-1,1)
y1 = np.amin(gt_y_all, 1).reshape(-1,1)
x2 = np.amax(gt_x_all, 1).reshape(-1,1)
y2 = np.amax(gt_y_all, 1).reshape(-1,1)
ground_truth_rect = np.concatenate((x1, y1, x2-x1, y2-y1), 1)
return Sequence(sequence_name, frames, 'vot', ground_truth_rect)
def __len__(self):
return len(self.sequence_list)
def _get_sequence_list(self):
sequence_list= ['ants1',
'ants3',
'bag',
'ball1',
'ball2',
'basketball',
'birds1',
'blanket',
'bmx',
'bolt1',
'bolt2',
'book',
'butterfly',
'car1',
'conduction1',
'crabs1',
'crossing',
'dinosaur',
'drone_across',
'drone_flip',
'drone1',
'fernando',
'fish1',
'fish2',
'fish3',
'flamingo1',
'frisbee',
'girl',
'glove',
'godfather',
'graduate',
'gymnastics1',
'gymnastics2',
'gymnastics3',
'hand',
'handball1',
'handball2',
'helicopter',
'iceskater1',
'iceskater2',
'leaves',
'matrix',
'motocross1',
'motocross2',
'nature',
'pedestrian1',
'rabbit',
'racing',
'road',
'shaking',
'sheep',
'singer2',
'singer3',
'soccer1',
'soccer2',
'soldier',
'tiger',
'traffic',
'wiper',
'zebrafish1']
return sequence_list