Ejemplo n.º 1
0
def main(argv: Tuple[str]) -> None:
    """Runs the TILDE model and saves the results.

    Arguments:
        argv {Tuple[str]} -- List of one parameters. There should be exactly
            one parameter - the path to the config file inside the tmp dir.
            This config file will be used to get all other information and
            process the correct images.
    """
    if len(argv) <= 0:
        raise RuntimeError("Missing argument <path_to_config_file>. Abort")

    with open(argv[0], 'rb') as src:
        config_file = pickle.load(src, encoding='utf-8')

    config, file_list = config_file
    model = load_tfeat()

    if config['task'] == 'descriptors':
        for file in tqdm(file_list):
            descriptors = compute(file, config, model)
            if descriptors is not None:
                io_utils.save_descriptor_output(file, config, descriptors)

    elif config['task'] == 'patches':
        for file in tqdm(file_list):
            descriptors = computeForPatchImages(file, config, model)
            if descriptors is not None:
                io_utils.save_descriptor_output(file, config, descriptors)
Ejemplo n.º 2
0
def main(argv: Tuple[str]) -> None:
    """Runs the LIFT model and saves the results.

    Arguments:
        argv {Tuple[str]} -- List of one parameters. There should be exactly
            one parameter - the path to the config file inside the tmp dir.
            This config file will be used to get all other information and
    """
    if len(argv) <= 0:
        raise RuntimeError("Missing argument <path_to_config_file>. Abort")

    with open(argv[0], 'rb') as src:
        config_file = pickle.load(src, encoding='utf-8')

    config, file_list = config_file
    model = load_model()

    if config['task'] == 'keypoints':
        for file in tqdm(file_list):
            keypoints, keypoints_image, heatmap_image = detect(
                file, config, model)
            if keypoints is not None:
                io_utils.save_detector_output(file, config['detector_name'],
                                              config, keypoints,
                                              keypoints_image, heatmap_image)

    elif config['task'] == 'descriptors':
        for file in tqdm(file_list):
            descriptors = compute(file, config, model)
            if descriptors is not None:
                io_utils.save_descriptor_output(file, config, descriptors)
Ejemplo n.º 3
0
def main(argv: Tuple[str]) -> None:
    """Runs the TILDE model and saves the results.

    Arguments:
        argv {Tuple[str]} -- List of one parameters. There should be exactly
            one parameter - the path to the config file inside the tmp dir.
            This config file will be used to get all other information and
    """
    if len(argv) <= 0:
        raise RuntimeError("Missing argument <path_to_config_file>. Abort")

    with open(argv[0], 'rb') as src:
        config_file = pickle.load(src, encoding='utf-8')

    _config, file_list = config_file

    # Since we cannot split detector and descriptor in the superpoint model,
    # we handle SuperPoint as a detector and add the property `descriptor_name`
    # with value 'superpoint' to be able to save the descriptors.
    # Note, that superpoint can only handle superpoint keypoints to generate
    # descriptors, but the found keypoints can still be used by other descriptors.
    config = copy.deepcopy(_config)
    config['descriptor_name'] = 'superpoint'
    model = load_superpoint()

    if config['task'] == 'keypoints':
        for file in tqdm(file_list):
            keypoints, descriptors, keypoints_image, heatmap_image = detect(
                file, config, model)

            # Save detector output
            io_utils.save_detector_output(file, config['detector_name'],
                                          config, keypoints, keypoints_image,
                                          heatmap_image)

            # Save descriptor output
            io_utils.save_descriptor_output(file, config, descriptors)

    elif config['task'] == 'patches':
        for file in tqdm(file_list):
            descriptors = computeForPatchImages(file, config, model)
            if descriptors is not None:
                io_utils.save_descriptor_output(file, config, descriptors)