print('Completed generating {} depth samples for sequence={}'.format(
            n_generated, sequence_dirpath))

    output_sparse_depth_filepath = \
        TRAIN_SPARSE_DEPTH_OUTPUT_FILEPATH[:-4] + '-' + seq_id + '.txt'
    output_validity_map_filepath = \
        TRAIN_VALIDITY_MAP_OUTPUT_FILEPATH[:-4] + '-' + seq_id + '.txt'
    output_semi_dense_depth_filepath = \
        TRAIN_SEMI_DENSE_DEPTH_OUTPUT_FILEPATH[:-4] + '-' + seq_id + '.txt'
    output_ground_truth_filepath = \
        TRAIN_GROUND_TRUTH_OUTPUT_FILEPATH[:-4] + '-' + seq_id + '.txt'

    print('Storing {} sparse depth file paths into: {}'.format(
        len(output_sequence_sparse_depth_paths), output_sparse_depth_filepath))
    data_utils.write_paths(output_sparse_depth_filepath,
                           output_sequence_sparse_depth_paths)

    print('Storing {} validity map file paths into: {}'.format(
        len(output_sequence_validity_map_paths), output_validity_map_filepath))
    data_utils.write_paths(output_validity_map_filepath,
                           output_sequence_validity_map_paths)

    print('Storing {} semi dense depth file paths into: {}'.format(
        len(output_sequence_semi_dense_depth_paths),
        output_semi_dense_depth_filepath))
    data_utils.write_paths(output_semi_dense_depth_filepath,
                           output_sequence_semi_dense_depth_paths)

    print('Storing {} ground truth file paths into: {}'.format(
        len(output_sequence_ground_truth_paths), output_ground_truth_filepath))
    data_utils.write_paths(output_ground_truth_filepath,
        continue
    else:
        train_image_clean_output_paths.append(image_output_path)
        train_sparse_depth_clean_output_paths.append(sparse_depth_output_path)
        train_validity_map_clean_output_paths.append(validity_map_output_path)
        train_ground_truth_clean_output_paths.append(ground_truth_output_path)
        train_intrinsics_clean_output_paths.append(intrinsics_output_path)

    sys.stdout.write(
        'Processed {}/{} examples \r'.format(idx + 1, n_sample))
    sys.stdout.flush()


print('Storing training image file paths into: %s' %
    TRAIN_IMAGE_OUTPUT_FILEPATH)
data_utils.write_paths(
    TRAIN_IMAGE_OUTPUT_FILEPATH, train_image_output_paths)

print('Storing training sparse depth file paths into: %s' %
    TRAIN_SPARSE_DEPTH_OUTPUT_FILEPATH)
data_utils.write_paths(
    TRAIN_SPARSE_DEPTH_OUTPUT_FILEPATH, train_sparse_depth_output_paths)

print('Storing training validity map file paths into: %s' %
    TRAIN_VALIDITY_MAP_OUTPUT_FILEPATH)
data_utils.write_paths(
    TRAIN_VALIDITY_MAP_OUTPUT_FILEPATH, train_validity_map_output_paths)

print('Storing training ground truth file paths into: %s' %
    TRAIN_GROUND_TRUTH_OUTPUT_FILEPATH)
data_utils.write_paths(
    TRAIN_GROUND_TRUTH_OUTPUT_FILEPATH, train_ground_truth_output_paths)
Beispiel #3
0
assert (len(stereo_flow_image0_paths) == len(stereo_flow_disparity_paths))

# Split KITTI 2012 dataset into training and test sets
stereo_flow_train_image0_paths = stereo_flow_image0_paths[0:160]
stereo_flow_train_image1_paths = stereo_flow_image1_paths[0:160]
stereo_flow_train_disparity_paths = stereo_flow_disparity_paths[0:160]

stereo_flow_test_image0_paths = stereo_flow_image0_paths[160:]
stereo_flow_test_image1_paths = stereo_flow_image1_paths[160:]
stereo_flow_test_disparity_paths = stereo_flow_disparity_paths[160:]

# Write all paths to disk
print(
    'Storing all {} stereo flow left stereo images file paths into: {}'.format(
        len(stereo_flow_image0_paths), STEREO_FLOW_ALL_IMAGE0_FILEPATH))
data_utils.write_paths(STEREO_FLOW_ALL_IMAGE0_FILEPATH,
                       stereo_flow_image0_paths)

print('Storing all {} stereo flow right stereo images file paths into: {}'.
      format(len(stereo_flow_image1_paths), STEREO_FLOW_ALL_IMAGE1_FILEPATH))
data_utils.write_paths(STEREO_FLOW_ALL_IMAGE1_FILEPATH,
                       stereo_flow_image1_paths)

print('Storing all {} stereo flow ground truth disparity file paths into: {}'.
      format(len(stereo_flow_disparity_paths),
             STEREO_FLOW_ALL_DISPARITY_FILEPATH))
data_utils.write_paths(STEREO_FLOW_ALL_DISPARITY_FILEPATH,
                       stereo_flow_disparity_paths)

# Write training paths to disk
print('Storing {} training stereo flow left stereo images file paths into: {}'.
      format(len(stereo_flow_train_image0_paths),
                        output_semi_dense_depth_path, \
                        output_dense_depth_path, \
                        output_ground_truth_path = result

                    # Collect filepaths
                    output_sparse_depth_paths.append(output_sparse_depth_path)
                    output_validity_map_paths.append(output_validity_map_path)
                    output_semi_dense_depth_paths.append(output_semi_dense_depth_path)
                    output_dense_depth_paths.append(output_dense_depth_path)
                    output_ground_truth_paths.append(output_ground_truth_path)

            print('Completed generating {} depth samples for using KITTI sequence={} camera={}'.format(
                n_vkitti_filepaths, kitti_sequence, camera_dirpath))

print('Storing sparse depth file paths into: %s' % OUTPUT_SPARSE_DEPTH_FILEPATH)
data_utils.write_paths(
    OUTPUT_SPARSE_DEPTH_FILEPATH, output_sparse_depth_paths)

print('Storing validity map file paths into: %s' % OUTPUT_VALIDITY_MAP_FILEPATH)
data_utils.write_paths(
    OUTPUT_VALIDITY_MAP_FILEPATH, output_validity_map_paths)

print('Storing semi dense depth file paths into: %s' % OUTPUT_SEMI_DENSE_DEPTH_FILEPATH)
data_utils.write_paths(
    OUTPUT_SEMI_DENSE_DEPTH_FILEPATH, output_semi_dense_depth_paths)

print('Storing dense depth file paths into: %s' % OUTPUT_DENSE_DEPTH_FILEPATH)
data_utils.write_paths(
    OUTPUT_DENSE_DEPTH_FILEPATH, output_dense_depth_paths)

print('Storing ground-truth depth file paths into: %s' % OUTPUT_GROUND_TRUTH_FILEPATH)
data_utils.write_paths(
        print('Completed processing {} examples for sequence={}'.format(
            len(pool_input), seq_dirpath))

    print('Completed processing {} examples for density={}'.format(
        n_sample, data_dirpath))

    void_train_image_filepath, \
        void_train_sparse_depth_filepath, \
        void_train_validity_map_filepath, \
        void_train_ground_truth_filepath, \
        void_train_intrinsics_filepath = train_filepaths

    print('Storing training image file paths into: %s' %
          void_train_image_filepath)
    data_utils.write_paths(void_train_image_filepath, train_image_outpaths)

    print('Storing training sparse depth file paths into: %s' %
          void_train_sparse_depth_filepath)
    data_utils.write_paths(void_train_sparse_depth_filepath,
                           train_sparse_depth_outpaths)

    print('Storing training validity map file paths into: %s' %
          void_train_validity_map_filepath)
    data_utils.write_paths(void_train_validity_map_filepath,
                           train_validity_map_outpaths)

    print('Storing training groundtruth depth file paths into: %s' %
          void_train_ground_truth_filepath)
    data_utils.write_paths(void_train_ground_truth_filepath,
                           train_ground_truth_outpaths)
Beispiel #6
0
                output_depth_dirpath = os.path.dirname(output_depth_path)
                if not os.path.exists(output_depth_dirpath):
                    os.makedirs(output_depth_dirpath)

                train_output_depth_paths.append(output_depth_path)
                data_utils.save_depth(output_depth, output_depth_path)

                n += 1
                print('Processed {}/{} training examples \r'.format(n + 1, n_sample), end='\r')

            except tf.errors.OutOfRangeError:
                print('Currently processed {}/{} training examples'.format(n, n_sample))
                break

print('Storing prediction for training file paths into: %s' % args.train_output_depth_path)
data_utils.write_paths(args.train_output_depth_path, train_output_depth_paths)


'''
Setup for validation and testing set
'''
# Load validation sparse depth and validity map paths from file
val_sparse_depth_paths = data_utils.read_paths(args.val_sparse_depth_path)

# Load testing sparse depth and validity map paths from file
test_sparse_depth_paths = data_utils.read_paths(args.test_sparse_depth_path)

val_output_depth_paths = []
test_output_depth_paths = []
modes = [
    [