remove no-calib argument

This commit is contained in:
lorenzo 2019-05-13 17:59:13 +02:00
parent 3cbc818059
commit 2222d12e20
3 changed files with 8 additions and 20 deletions

View File

@ -109,7 +109,7 @@ class PreprocessKitti:
dds.append(dd)
self.dic_names[basename + '.png']['boxes'].append(box)
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
# Find the annotations if exists
@ -131,7 +131,7 @@ class PreprocessKitti:
self.dic_jo[phase]['kps'].append(uv_kps[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]['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.append_cluster(self.dic_jo, phase, inputs[ii], dds[idx_max], uv_kps[ii])
self.dic_cnt[phase] += 1

View File

@ -59,12 +59,10 @@ def cli():
predict_parser.add_argument('--model', help='path of MonoLoco model to load',
default="data/models/best_model__seed_2_.pickle")
predict_parser.add_argument('--path_gt', help='path of json file with gt 3d localization',
default='data/arrays/names-kitti-190513-1428.json')
predict_parser.add_argument('--dir_calib', default='data/kitti/calib/', help='directory of calib_files')
default='data/arrays/names-kitti-190513-1754.json')
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('--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('--y_scale', type=float, help='', default=1)
predict_parser.add_argument('--n_dropout', type=int, help='Epistemic uncertainty evaluation', default=0)

View File

@ -33,11 +33,6 @@ class PredictMonoLoco:
print("Monoloco: ground truth file not found")
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.keypoints = keypoints
self.image_path = image_path
@ -45,7 +40,6 @@ class PredictMonoLoco:
self.device = args.device
self.draw_kps = args.draw_kps
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.output_types = args.output_types
self.show = args.show
@ -94,17 +88,14 @@ class PredictMonoLoco:
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 = [[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) = \
self.get_input_data(self.boxes, self.keypoints, kk, left_to_right=True)
@ -140,7 +131,6 @@ class PredictMonoLoco:
# Print image and save json
dic_out = defaultdict(list)
name = os.path.basename(self.image_path)
if self.dic_names:
boxes_gt, dds_gt = self.dic_names[name]['boxes'], self.dic_names[name]['dds']