INNER CODE UNIT · Python
get_basename
aniketmaurya/chitra · chitra/core.py:25
def get_basename(path: tf.string) -> tf.string:
if not isinstance(path, tf.Tensor):
raise AssertionError
return tf.strings.split(path, os.path.sep)[-1]
def load_imagenet_labels() -> Tuple[str]:
global IMAGENET_LABELS
if IMAGENET_LABELS is None:
logger.debug("Downloading imagenet labels...")
IMAGENET_LABELS = requests.get(IMAGENET_LABEL_URL).content.decode("UTF-8").split("\n")[1:]
return IMAGENET_LABELS