remove no-calib argument
This commit is contained in:
parent
3cbc818059
commit
2222d12e20
@ -109,7 +109,7 @@ class PreprocessKitti:
|
|||||||
dds.append(dd)
|
dds.append(dd)
|
||||||
self.dic_names[basename + '.png']['boxes'].append(box)
|
self.dic_names[basename + '.png']['boxes'].append(box)
|
||||||
self.dic_names[basename + '.png']['dds'].append(dd)
|
self.dic_names[basename + '.png']['dds'].append(dd)
|
||||||
self.dic_names[basename + '.png']['K'].append(kk.tolist())
|
self.dic_names[basename + '.png']['K'] = kk.tolist()
|
||||||
self.cnt_gt += 1
|
self.cnt_gt += 1
|
||||||
|
|
||||||
# Find the annotations if exists
|
# Find the annotations if exists
|
||||||
@ -131,7 +131,7 @@ class PreprocessKitti:
|
|||||||
self.dic_jo[phase]['kps'].append(uv_kps[ii])
|
self.dic_jo[phase]['kps'].append(uv_kps[ii])
|
||||||
self.dic_jo[phase]['X'].append(inputs[ii])
|
self.dic_jo[phase]['X'].append(inputs[ii])
|
||||||
self.dic_jo[phase]['Y'].append([dds[idx_max]]) # Trick to make it (nn,1)
|
self.dic_jo[phase]['Y'].append([dds[idx_max]]) # Trick to make it (nn,1)
|
||||||
self.dic_jo[phase]['K'].append(kk.tolist())
|
self.dic_jo[phase]['K'] = kk.tolist()
|
||||||
self.dic_jo[phase]['names'].append(name) # One image name for each annotation
|
self.dic_jo[phase]['names'].append(name) # One image name for each annotation
|
||||||
self.append_cluster(self.dic_jo, phase, inputs[ii], dds[idx_max], uv_kps[ii])
|
self.append_cluster(self.dic_jo, phase, inputs[ii], dds[idx_max], uv_kps[ii])
|
||||||
self.dic_cnt[phase] += 1
|
self.dic_cnt[phase] += 1
|
||||||
|
|||||||
@ -59,12 +59,10 @@ def cli():
|
|||||||
predict_parser.add_argument('--model', help='path of MonoLoco model to load',
|
predict_parser.add_argument('--model', help='path of MonoLoco model to load',
|
||||||
default="data/models/best_model__seed_2_.pickle")
|
default="data/models/best_model__seed_2_.pickle")
|
||||||
predict_parser.add_argument('--path_gt', help='path of json file with gt 3d localization',
|
predict_parser.add_argument('--path_gt', help='path of json file with gt 3d localization',
|
||||||
default='data/arrays/names-kitti-190513-1428.json')
|
default='data/arrays/names-kitti-190513-1754.json')
|
||||||
predict_parser.add_argument('--dir_calib', default='data/kitti/calib/', help='directory of calib_files')
|
|
||||||
predict_parser.add_argument('--transform', help='transformation for the pose', default='None')
|
predict_parser.add_argument('--transform', help='transformation for the pose', default='None')
|
||||||
predict_parser.add_argument('--draw_kps', help='to draw kps in the images', action='store_true')
|
predict_parser.add_argument('--draw_kps', help='to draw kps in the images', action='store_true')
|
||||||
predict_parser.add_argument('--predict', help='whether to make prediction', action='store_true')
|
predict_parser.add_argument('--predict', help='whether to make prediction', action='store_true')
|
||||||
predict_parser.add_argument('--no_calib', help='use standard intrinsic matrix', action='store_true')
|
|
||||||
predict_parser.add_argument('--z_max', type=int, help='', default=22)
|
predict_parser.add_argument('--z_max', type=int, help='', default=22)
|
||||||
predict_parser.add_argument('--y_scale', type=float, help='', default=1)
|
predict_parser.add_argument('--y_scale', type=float, help='', default=1)
|
||||||
predict_parser.add_argument('--n_dropout', type=int, help='Epistemic uncertainty evaluation', default=0)
|
predict_parser.add_argument('--n_dropout', type=int, help='Epistemic uncertainty evaluation', default=0)
|
||||||
|
|||||||
@ -33,11 +33,6 @@ class PredictMonoLoco:
|
|||||||
print("Monoloco: ground truth file not found")
|
print("Monoloco: ground truth file not found")
|
||||||
print('-' * 120)
|
print('-' * 120)
|
||||||
|
|
||||||
# Check for calibration file
|
|
||||||
if not args.no_calib:
|
|
||||||
self.path_calib = os.path.join(args.dir_calib, basename + '.txt')
|
|
||||||
assert os.path.isfile(self.path_calib), "Calibration file not found. Change dir or use --no_calib"
|
|
||||||
|
|
||||||
self.boxes = boxes
|
self.boxes = boxes
|
||||||
self.keypoints = keypoints
|
self.keypoints = keypoints
|
||||||
self.image_path = image_path
|
self.image_path = image_path
|
||||||
@ -45,7 +40,6 @@ class PredictMonoLoco:
|
|||||||
self.device = args.device
|
self.device = args.device
|
||||||
self.draw_kps = args.draw_kps
|
self.draw_kps = args.draw_kps
|
||||||
self.y_scale = args.y_scale # y_scale = 1.85 for kitti combined
|
self.y_scale = args.y_scale # y_scale = 1.85 for kitti combined
|
||||||
self.no_calib = args.no_calib
|
|
||||||
self.z_max = args.z_max
|
self.z_max = args.z_max
|
||||||
self.output_types = args.output_types
|
self.output_types = args.output_types
|
||||||
self.show = args.show
|
self.show = args.show
|
||||||
@ -94,17 +88,14 @@ class PredictMonoLoco:
|
|||||||
|
|
||||||
cnt = 0
|
cnt = 0
|
||||||
|
|
||||||
if self.no_calib:
|
# Extract calibration matrix if ground-truth file is present or use a default one
|
||||||
|
name = os.path.basename(self.image_path)
|
||||||
|
if self.dic_names:
|
||||||
|
kk = self.dic_names[name]['K']
|
||||||
|
else:
|
||||||
# kk = [[1266.4, 0., 816.27], [0, 1266.4, 491.5], [0., 0., 1.]]
|
# kk = [[1266.4, 0., 816.27], [0, 1266.4, 491.5], [0., 0., 1.]]
|
||||||
kk = [[718.3351, 0., 600.3891], [0., 718.3351, 181.5122], [0., 0., 1.]]
|
kk = [[718.3351, 0., 600.3891], [0., 718.3351, 181.5122], [0., 0., 1.]]
|
||||||
|
|
||||||
else:
|
|
||||||
kk, tt = self.get_calibration(self.path_calib)
|
|
||||||
# kk = self.get_simplified_calibration(self.path_calib)
|
|
||||||
|
|
||||||
# kk = [[1266.4, 0., 816.27], [0, 1266.4, 491.5], [0., 0., 1.]]
|
|
||||||
# self.factor = 1
|
|
||||||
# self.y_scale = 1
|
|
||||||
(inputs_norm, xy_kps), (uv_kps, uv_boxes, uv_centers, uv_shoulders) = \
|
(inputs_norm, xy_kps), (uv_kps, uv_boxes, uv_centers, uv_shoulders) = \
|
||||||
self.get_input_data(self.boxes, self.keypoints, kk, left_to_right=True)
|
self.get_input_data(self.boxes, self.keypoints, kk, left_to_right=True)
|
||||||
|
|
||||||
@ -140,7 +131,6 @@ class PredictMonoLoco:
|
|||||||
|
|
||||||
# Print image and save json
|
# Print image and save json
|
||||||
dic_out = defaultdict(list)
|
dic_out = defaultdict(list)
|
||||||
name = os.path.basename(self.image_path)
|
|
||||||
if self.dic_names:
|
if self.dic_names:
|
||||||
boxes_gt, dds_gt = self.dic_names[name]['boxes'], self.dic_names[name]['dds']
|
boxes_gt, dds_gt = self.dic_names[name]['boxes'], self.dic_names[name]['dds']
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user