testers

This module takes charge of testing.

Class

BaseTester

class gedml.launcher.testers.base_tester.BaseTester(batch_size, dataset_num_workers=8, is_normalize=True, splits_to_eval=['test'], is_distributed=False)[source]

Bases: object

BaseTester takes charge of testing.

Parameters
  • batch_size (int) – Batch size.

  • dataset_num_workers (int) – Number of processes to load data.

  • is_normalize (bool) – Whether to normalize embeddings.

  • splits_to_eval (list(str)) – List of sub-dataset to evaluate.

  • is_distributed (bool) – Whether to set in the distributed mode.

Example

>>> tester = BaseTester(32)
>>> tester.prepare(...) # load models etc.
>>> results = tester.test()
prepare(models, datasets, evaluators, device, device_ids)[source]

Load objects to be tested.

Parameters
  • models (dict) – Dictionary of models.

  • datasets (dict) – Dictionary of datasets.

  • evaluators (dict) – Dictioanry of evaluators.

  • device (device) – Computation device.

  • device_ids (list(int)) – Instruct Faiss package to use the corresponding devices.

test()[source]

Start testing.

Returns

evaluation results.

Return type

dict