Skip to content

Commit

Permalink
Support test split
Browse files Browse the repository at this point in the history
  • Loading branch information
fukatani committed Sep 12, 2019
1 parent ad9cd75 commit 29869ec
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions kitti_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_label_objects(self, idx):
return utils.read_label(label_filename)

def get_pred_objects(self, idx):
assert(idx<self.num_samples and self.split=='training')
assert(idx<self.num_samples)
pred_filename = os.path.join(self.pred_dir, '%06d.txt'%(idx))
is_exist = os.path.exists(pred_filename)
if is_exist:
Expand Down Expand Up @@ -571,14 +571,17 @@ def bbox3d(obj):
Image.fromarray(top_image).show()

def dataset_viz(root_dir, args):
dataset = kitti_object(root_dir, args=args)
dataset = kitti_object(root_dir, split=args.split, args=args)
## load 2d detection results
objects2ds = read_det_file('box2d.list')
for data_idx in range(len(dataset)):
if args.ind>0:
data_idx=args.ind
# Load data from dataset
objects = dataset.get_label_objects(data_idx)
if args.split == 'training':
objects = dataset.get_label_objects(data_idx)
else:
objects = []
objects2d = objects2ds[data_idx]

objects_pred = None
Expand Down Expand Up @@ -656,7 +659,7 @@ def dataset_viz(root_dir, args):
break

def depth_to_lidar_format(root_dir, args):
dataset = kitti_object(root_dir, args=args)
dataset = kitti_object(root_dir, split=args.split, args=args)
for data_idx in range(len(dataset)):
# Load data from dataset

Expand Down Expand Up @@ -703,6 +706,8 @@ def read_det_file(det_filename):
help='input (default: data/object)')
parser.add_argument('-p','--pred', action='store_true', help='show predict results')
parser.add_argument('-s','--stat', action='store_true', help=' stat the w/h/l of point cloud in gt bbox')
parser.add_argument('--split', type=str, default='training',
help='use training split or testing split (default: training)')
parser.add_argument('-l','--lidar', type=str, default="velodyne", metavar='N',
help='velodyne dir (default: velodyne)')
parser.add_argument('-e','--depthdir', type=str, default="depth", metavar='N',
Expand All @@ -724,7 +729,7 @@ def read_det_file(det_filename):
parser.add_argument('--show_lidar_topview_with_boxes', action='store_true', help='show lidar topview')
args = parser.parse_args()
if args.pred:
assert os.path.exists(args.dir+"/training/pred")
assert os.path.exists(args.dir+"/" + args.split + "/pred")

if args.vis:
dataset_viz(args.dir, args)
Expand Down

0 comments on commit 29869ec

Please sign in to comment.