def get_colormap() -> np.ndarray: """Loads the colormap. The colormap was precomputed using Glasbey et al. algorythm (Colour Displays for Categorical Images, 2017) to generate maximally distinct colors. It was generated using https://github.com/taketwo/glasbey: ```python gb = glasbey.Glasbey( base_palette=[(0, 0, 0), (228, 26, 28), (55, 126, 184), (77, 175, 74)], no_black=True, ) palette = gb.generate_palette(size=256) gb.save_palette(palette, 'colormap.csv') ``` Returns: colormap: A `np.array(shape=(255, 3), dtype=np.uint8)` representing the mapping id -> color. """ colormap_path = resource_utils.tfds_path() / 'core/utils/colormap.csv' with colormap_path.open() as f: return np.array(list(csv.reader(f)), dtype=np.uint8)
def test_tfds_path(): """Test the proper suffix only, since the prefix can vary.""" assert resource_utils.tfds_path().name == 'tensorflow_datasets'