Configuration

DIM as library

DIM can also be utilized as a library instead of being executed through the Command Line Interface (CLI). For an illustrative example also setting custom configurations, please see notebooks/sfm_pipeline.ipynb.

CLI

When utilizing the CLI, specific configuration parameters linked to feature extraction and matching can be specified using the option --config /path/to/yaml/configuration/file. Examples of YAML configuration files can be found in the config folder.

For example, in the config/sift.yaml file, under the general section, parameters such as tile size and others related to geometric verification can be adjusted. Under the extractor and matcher sections, there are options specific to the SIFT local feature.

general:
  tile_size: (2400, 2000)
  geom_verification: pydegensac
  min_inliers_per_pair: 10
  min_inlier_ratio_per_pair: 0.25

extractor:
  name: "sift"
  n_features: 8000
  nOctaveLayers: 3
  contrastThreshold: 0.04
  edgeThreshold: 10
  sigma: 1.6

matcher:
  name: "kornia_matcher"
  match_mode: "smnn"
  th: 0.85

The Config Class

Config

Configuration class for deep image matching.

This class represents the configuration settings for deep image matching. It provides methods to parse user input, retrieve configuration options, update configuration from a YAML file, print the configuration settings, and save the configuration to a file.

Attributes:
  • default_cli_opts (dict) –

    The default command-line options.

  • cfg (dict) –

    The configuration dictionary with the following keys: general, extractor, matcher.

METHOD DESCRIPTION
general

Get the general configuration options.

extractor

Get the extractor configuration options.

matcher

Get the matcher configuration options.

__init__

Initialize the Config object.

as_dict

Get the configuration dictionary.

get_config

Get a specific configuration by name.

get_config_names

Get a list of available configuration names.

get_matching_strategy_names

Get a list of available matching strategy names.

get_extractor_names

Get a list of available extractor names.

get_matcher_names

Get a list of available matcher names.

get_retrieval_names

Get a list of available retrieval names.

parse_user_config

Parse the user configuration and perform checks on the input arguments.

update_from_yaml

Update the configuration from a YAML file.

print

Print the configuration settings.

save

Save the configuration to a file.

__init__(args)

Initialize the Config object.

Parameters:
  • args (dict) –

    The input arguments provided by the user.

as_dict()

Get the configuration dictionary.

Returns:
  • dict( dict ) –

    The configuration dictionary.

get_config(name) staticmethod

Get a specific configuration by name.

Parameters:
  • name (str) –

    The name of the configuration.

Returns:
  • dict( dict ) –

    The configuration dictionary.

Raises:
  • ValueError

    If the configuration name is invalid.

parse_general_config(input_args) staticmethod

Parses the user configuration and performs checks on the input arguments.

Parameters:
  • input_args (dict) –

    The input arguments provided by the user (e.g., from CLI parser).

Returns:
  • dict( dict ) –

    The configuration dictionary with the following keys: general, extractor, matcher.

print()

Print the configuration settings.

This method prints the general, extractor, and matcher configuration settings.

save(path=None)

Save configuration to file.

Parameters:
  • path (Path, default: None ) –

    The path where the configuration will be saved. If not provided, the default configuration file path will be used.

update_from_yaml(path)

Update the configuration from a YAML file.

Parameters:
  • path (Path) –

    The path to the YAML file.

Raises:
  • FileNotFoundError

    If the configuration file is not found.

  • ValueError

    If the extractor name in the configuration file does not match with the extractor chosen from CLI or GUI.

  • ValueError

    If the matcher name in the configuration file does not match with the matcher chosen from CLI or GUI.