Exemplo n.º 1
0
def apply_depth_inference_on_folder(folder_images_path, output_path):
    """
    This method is used to apply depth inference on a given folder (pretty much self explanatory name, right?)
    :param folder_images_path: where our images are located
    :param output_path: where the results of our depth inference will be saved
    :param checkpoint_path: the checkpoint used to perform the inference
    :return:
    """
    params = generate_default_monodepth_parameters()

    output_path = file_helper.guarantee_path_preconditions(output_path)

    left, model, sess = init_tensorflow(CHECKPOINT_PATH, params)

    # all_images = file_helper.get_frames_from_folder(folder_images_path)

    missing_frames = get_not_processed_frames(folder_images_path, output_path)

    with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
        fs = [
            executor.submit(apply_inference, folder_images_path, image, left,
                            model, output_path, sess)
            for image in missing_frames
        ]
        concurrent.futures.wait(fs)

    K.clear_session()

    return file_helper.get_frames_from_folder(output_path)
Exemplo n.º 2
0
    def extract_from_folder(self, frames_path, output_path):
        frames = os.listdir(frames_path)

        missing_frames = len(get_not_processed_frames(frames_path,
                                                      output_path))

        if missing_frames > self.THRESHOLD_MISSING_FRAMES:
            with ProcessPoolExecutor() as exec:
                for frame_name in frames:
                    path_frame = os.path.join(frames_path, frame_name)

                    if not os.path.exists(os.path.join(output_path,
                                                       frame_name)):
                        exec.submit(file_utils.file_helper.copy_file,
                                    path_frame, output_path)
Exemplo n.º 3
0
    def extract_from_folder(self, frames_path, output_path):
        missing_frames = get_not_processed_frames(frames_path, output_path)

        if not os.path.exists(output_path):
            os.makedirs(output_path)

        noise_path = '/codes/bresan/remote/spoopy/spoopy/refactored/preprocessing/property/noise_extraction_code/bin/noise_extractor'
        for frame in missing_frames:
            output_img = join(output_path, frame + "_RF2.bmp")

            if not os.path.isfile(output_img):
                with ProcessPoolExecutor(max_workers=20) as exec:
                    output_img = join(output_path, frame)

                    exec.submit(self.extract_noise, frame, frames_path, noise_path, output_path)
        print('Extracting frames with noise')
Exemplo n.º 4
0
    def extract_from_folder(self, frames_path, output_path):
        missing_frames = len(get_not_processed_frames(frames_path,
                                                      output_path))

        if missing_frames > self.THRESHOLD_MISSING_FRAMES:
            extract_rbd_saliency_folder(frames_path, output_path)
Exemplo n.º 5
0
    def extract_from_folder(self, frames_path, output_path):
        missing_frames = get_not_processed_frames(frames_path, output_path)

        if len(missing_frames) > self.THRESHOLD_MISSING_FRAMES:
            monodepth_simple.apply_depth_inference_on_folder(
                frames_path, output_path)