Image Proposer

imageproposer (object, REQUIRED) section describes image proposer specific settings.

  • sorting_config_file (string, OPTIONAL): Absolute path to a configuration file for sorting images in proposals. When not set, then image sorting will be disabled.

Example:

imageproposer:
    sorting_config_file: /path/to/image-proposal-sorting.yaml

Image Sorting

The order of images in the proposal response can be influenced by a special configuration file in YAML format. In that file a list of image’s properties or fields must be specified, by which the images sould be sorted. Then a mapping must be provided, that assigns a rank value (an integer) to each specific field’s value. The proposer then uses that information to sort images using the following comparison-algorithm:

compare_images_by_rank(image1, image2):
        foreach field in config.sort_by:
                rank1 = lookup_rank(config, field, image1)
                rank2 = lookup_rank(config, field, image2)
                result = compare(rank1, rank2, order)
                if (result != "EQUAL")
                        return result

        # All fields have equal ranks!
        return "EQUAL"

The following configuration parameters are currently supported:

sort_by (array of objects, REQUIRED) section describes fields to sort images by and their order.

  • field (string, REQUIRED): The field’s name. Currently only id is implemented.
  • order (string, REQUIRED): The field’s sort ordering. Valid values are ascending and descending.

ranks (array of objects, REQUIRED) section describes rank assignments for specific field’s values.

  • field (string, REQUIRED): The field’s name as defined in sort_by.

  • default (integer, REQUIRED): The field’s default rank.

  • mapping (array of objects, REQUIRED): The mapping from field’s specific values to their ranks.

    • value (string, REQUIRED): The field’s value to assign a rank for.
    • rank (integer, REQUIRED): The corresponding rank value.

Example:

# Fields to sort images by
sort_by:
  - field: id
    order: descending

# Rank assignments for field's values
ranks:
  - field: id
    default: 0
    mapping:
      - value: 123
        rank: 10
      - value: 456
        rank: 20
      - value: 789
        rank: 30

If an image proposal contains images with IDs 123, 456, 789 and ABC, then their order according to the example configuration would be: 789 (rank 30), 456 (rank 20), 123 (rank 10), ABC (default rank 0)

Defaults

imageproposer:
    rebuildinterval:  300
ws:
    imagearchive: http://localhost:8080
    softwarearchive:  http://localhost:8080