def __init__(self, image_set, kitti_path=None):
datasets.imdb.__init__(self, 'kitti_' + image_set)
self._image_set = image_set
self._kitti_path = self._get_default_path() if kitti_path is None \
else kitti_path
self._data_path = os.path.join(self._kitti_path, 'data_object_image_2')
self._classes = ('__background__', 'Car', 'Pedestrian', 'Cyclist')
self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
self._image_ext = '.png'
self._image_index = self._load_image_set_index()
# Default to roidb handler
if cfg.IS_RPN:
self._roidb_handler = self.gt_roidb
else:
self._roidb_handler = self.region_proposal_roidb
# num of subclasses
if image_set == 'train' or image_set == 'val':
self._num_subclasses = 125 + 24 + 24 + 1
prefix = 'validation'
else:
self._num_subclasses = 227 + 36 + 36 + 1
prefix = 'test'
# load the mapping for subcalss to class
filename = os.path.join(self._kitti_path, cfg.SUBCLS_NAME, prefix, 'mapping.txt')
assert os.path.exists(filename), 'Path does not exist: {}'.format(filename)
mapping = np.zeros(self._num_subclasses, dtype=np.int)
with open(filename) as f:
for line in f:
words = line.split()
subcls = int(words[0])
mapping[subcls] = self._class_to_ind[words[1]]
self._subclass_mapping = mapping
self.config = {'top_k': 100000}
# statistics for computing recall
self._num_boxes_all = np.zeros(self.num_classes, dtype=np.int)
self._num_boxes_covered = np.zeros(self.num_classes, dtype=np.int)
self._num_boxes_proposal = 0
assert os.path.exists(self._kitti_path), \
'KITTI path does not exist: {}'.format(self._kitti_path)
assert os.path.exists(self._data_path), \
'Path does not exist: {}'.format(self._data_path)
kitti.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录