File size: 1,009 Bytes
f5498f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Named evaluation pools, cited by name in every artifact's provenance block."""
from typing import NamedTuple, Optional


class Pool(NamedTuple):
    name: str
    split: str
    n: Optional[int]
    balanced: bool
    selection: str


VAL5000 = Pool(
    'VAL5000', 'val2017', 5000, False,
    'the first 5000 val2017 image ids in sorted order, which is the whole split')

CALIB1000 = Pool(
    'CALIB1000', 'val2017', 1000, False,
    'the first 1000 val2017 image ids in sorted order')

VAL500 = Pool(
    'VAL500', 'val2017', 500, False,
    'the first 500 val2017 image ids in sorted order')

BALANCED_VAL = Pool(
    'BALANCED_VAL', 'val2017', None, True,
    'val2017 subsampled without replacement to equal person-positive and '
    'person-negative counts')

POOLS = {p.name: p for p in (VAL5000, CALIB1000, VAL500, BALANCED_VAL)}


def by_name(name: str) -> Pool:
    if name not in POOLS:
        raise ValueError(f'unknown pool {name!r}; expected one of {sorted(POOLS)}')
    return POOLS[name]