def test_can_remap_mask(self): class_count = 10 remap_fn = lambda c: class_count - c src = np.empty((class_count, class_count), dtype=np.uint8) for c in range(class_count): src[c:, c:] = c expected = np.empty_like(src) for c in range(class_count): expected[c:, c:] = remap_fn(c) actual = mask_tools.remap_mask(src, remap_fn) self.assertTrue(np.array_equal(expected, actual), '%s\nvs.\n%s' % (expected, actual))
def _remap_mask(self, mask): return remap_mask(mask, self._label_id_mapping)