Closed seattlegirl closed 5 years ago
def dump_example(n): if n % 2000 == 0: print('Progress %d/%d....' % (n, data_loader.num_train)) example = data_loader.get_train_example_with_idx(n) if example == False: return image_seq = concat_image_seq(example['image_seq']) intrinsics = example['intrinsics'] fx = intrinsics[0, 0] fy = intrinsics[1, 1] cx = intrinsics[0, 2] cy = intrinsics[1, 2] dump_dir = os.path.join(args.dump_root, example['folder_name'])
try: os.makedirs(dump_dir) except OSError: if not os.path.isdir(dump_dir): raise dump_img_file = dump_dir + '/%s.jpg' % example['file_name'] scipy.misc.imsave(dump_img_file, image_seq.astype(np.uint8)) dump_cam_file = dump_dir + '/%s_cam.txt' % example['file_name'] with open(dump_cam_file, 'w') as f: f.write('%f,0.,%f,0.,%f,%f,0.,0.,1.' % (fx, cx, fy, cy))
Sorry I can see no bug here. Can you provide more details if the data preparation script doesn't work smoothly?
data/prepare_train_data.py 的94行是不是写错了?dump_example函数的参数没有传进去吧? Parallel(n_jobs=args.num_threads)(delayed(dump_example)(n) for n in range(data_loader.num_train)