CharlesCNorton
Image-level person classification on EUPE-ViT-B features with a single free parameter
f5498f9 | """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] | |