from libero.libero import get_libero_path
datasets_default_path = get_libero_path("datasets")
print("Default dataset root path: ", datasets_default_path)
运行结果:
Default dataset root path: /media/jiangyvhang/WD_BLACK/dataset/libero
from libero.libero import set_libero_default_path
set_libero_default_path("修改后benchmark_root的路径")
from libero.libero import benchmark
#可用基准名称及其对应类
benchmark_dict = benchmark.get_benchmark_dict()
#实例化对应类
benchmark_instance = benchmark_dict["libero_10"]()
#基准名称
print("基准名称:",benchmark_instance.name)
#任务数量
print("任务数量:",benchmark_instance.get_num_tasks())
#每一个任务的描述
task_names = benchmark_instance.get_task_names()
print("任务1描述:",task_names[1])
#获取指定第i个任务
i = 1
task = benchmark_instance.get_task(i)
#获取任务的bddl文件的路径
print("bddl文件名:",task.bddl_file)
print("bddl上级文件夹:",task.problem_folder)
print("上级文件夹所在目录:",get_libero_path("bddl_files"))
import os
print("完整的绝对路径:",os.path.join(get_libero_path("bddl_files"), task.problem_folder, task.bddl_file))
#获取任务的init文件的路径
print("init文件名:",task.init_states_file)
print("bddl上级文件夹:",task.problem_folder)
print("上级文件夹所在目录:",get_libero_path("init_states"))
import os
print("完整的绝对路径:",os.path.join(get_libero_path("init_states"), task.problem_folder, task.init_states_file))
#第i个任务的初始状态
init_states = benchmark_instance.get_task_init_states(i)
print("初始状态维度:",init_states.shape)
运行结果