ethograph.labels.intervals.load_mapping#
- ethograph.labels.intervals.load_mapping(mapping_file)[source]#
Load a class-name ↔ index mapping file.
The file is whitespace-delimited with lines
<index> <name>.- Parameters:
mapping_file (str or Path) – Path to the mapping file.
- Return type:
- Returns:
class_to_idx (dict[str, int])
idx_to_class (dict[int, str])
Examples
>>> class_to_idx, idx_to_class = load_mapping("mapping.txt") >>> class_to_idx["walk"] 1 >>> idx_to_class[1] 'walk'