-
Notifications
You must be signed in to change notification settings - Fork 12
/
dataset.py
57 lines (45 loc) · 1.5 KB
/
dataset.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
'''
Dataset base class
'''
class Dataset(object):
def __init__(self):
self._image_ids = []
self.image_info = []
def add_image(self, source, image_id, path, **kwargs):
image_info = {
"id": image_id,
"source": source,
"path": path,
}
image_info.update(kwargs)
self.image_info.append(image_info)
@property
def image_ids(self):
return self._image_ids
def source_image_link(self, image_id):
"""Returns the path or URL to the image.
Override this to return a URL to the image if it's available online for easy
debugging.
"""
return self.image_info[image_id]["path"]
def load_location(self, image_id):
info = self.image_info[image_id]
return info["location"]
def load_keypoints(self, image_id):
info = self.image_info[image_id]
return info["keypoints"]
def load_quaternion(self, image_id):
info = self.image_info[image_id]
return info["quaternion"]
def load_euler_angles(self, image_id):
info = self.image_info[image_id]
return info["pyr"]
def load_angle_axis(self, image_id):
info = self.image_info[image_id]
return info["angleaxis"]
def load_location_encoded(self, image_id):
info = self.image_info[image_id]
return info["location_map"]
def load_orientation_encoded(self, image_id):
info = self.image_info[image_id]
return info["ori_map"]