INNER CODE UNIT · Python
load_lvis_annotations
allenai/objaverse-xl · objaverse/__init__.py:196
def load_lvis_annotations() -> Dict[str, List[str]]:
"""Load the LVIS annotations.
If the annotations are not already downloaded, they will be downloaded.
Returns:
A dictionary mapping the LVIS category to the list of uids in that category.
"""
hf_url = "https://huggingface.co/datasets/allenai/objaverse/resolve/main/lvis-annotations.json.gz"
local_path = os.path.join(_VERSIONED_PATH, "lvis-annotations.json.gz")
os.makedirs(os.path.dirname(local_path), exist_ok=True)
if not os.path.exists(local_path):
urllib.request.urlretrieve(hf_url, local_path)
with gzip.open(local_path, "rb") as f:
lvis_annotations = json.load(f)
return lvis_annotations