def get_visdom_env(cfg):
    """
    Parse out visdom environment name from the input config.

    Args:
        cfg: The global config file.

    Returns:
        visdom_env: The name of the visdom environment.
    """
    if len(cfg.visdom_env) == 0:
        visdom_env = cfg.exp_dir.split("/")[-1]
    else:
        visdom_env = cfg.visdom_env
    return visdom_env