# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # ''' Download specific Objaverse meshes given their UUIDs. Installation: pip install trimesh==4.5.3 objaverse==0.1.7 meshcat==0.0.12 webdataset==0.2.111 Usage: python download_objaverse.py --uuid_list /path_to_dataset/splits/franka/valid_scenes.json --output_dir /tmp/objs ''' import argparse import json import os import shutil from objaverse import load_objects from pathlib import Path from dataset import load_uuid_list def download_objaverse_meshes(uuids: list[str], output_dir: str): """ Download specific Objaverse meshes given their UUIDs. Args: uuid_list_path (str): Path to JSON file containing list of UUIDs output_dir (str): Directory where meshes will be saved """ # Create output directory if it doesn't exist os.makedirs(output_dir, exist_ok=True) print(f"Found {len(uuids)} UUIDs to download") # Download objects using Objaverse objects = load_objects(uids=uuids) map_uuid_to_path = {} # Save each object to the output directory for uuid in uuids: try: # Get the object path from Objaverse obj_path = objects[uuid] if obj_path is None: print(f"Failed to download object {uuid}") continue # Create destination path dest_path = os.path.join(output_dir, os.path.basename(obj_path)) shutil.copy2(obj_path, dest_path) print(f"Successfully downloaded and saved object {uuid}, saved to {dest_path}") map_uuid_to_path[uuid] = dest_path os.remove(obj_path) json.dump(map_uuid_to_path, open(os.path.join(output_dir, "map_uuid_to_path.json"), "w")) except Exception as e: print(f"Error processing object {uuid}: {e}") print("Download complete!") def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--uuid_list", type=str, help="Path to UUID list or Json. This can be the split json file from the GraspGen dataset") parser.add_argument("--output_dir", type=str, help="Path to output directory") return parser.parse_args() if __name__ == "__main__": args = parse_args() uuid_list = load_uuid_list(args.uuid_list) download_objaverse_meshes(uuid_list, args.output_dir)