
概述与QA本系列为我在vla上的第一个实践基于lerobot做π0.5的推理、微调 、仿真。本文主要介绍libero数据集的可视化。下面列出几个QA来引入Q什么是liberoA大家都在训练各种 AI 机器人模型怎么证明你的模型很牛呢不能光靠嘴说得拉到同一个考场里用同一套卷子考一考看谁分数高。LIBERO 就是这个考场。具体来说它包含了四项东西1.任务库定义了机器人在这个考场上需要完成的任务具体类别有libero_spatial空间关系、libero_object物体类别等等。2.仿真环境其基于mujoco和robosuite搭建了仿真环境模型通过简单的接口即可实现可视化。3.标准数据集其包含了各种任务的标准演示数据集这也是我们本章需要可视化的东西。4.评测指标libero封装了工具用于模型在各种任务上的评测。Q为什么要做这个数据可视化A我们之后将会在libero数据集上做模型的微调因此必须要先验证这个数据集的格式满足pi0.5模型的输入要求。1. 数据集基本信息在可视化具体数据之前先宏观的了解一下libero数据集的组成from time import perf_counter # LeRobotDatasetMetadata不包含真实的数据只包含数据信息 from lerobot.datasets import LeRobotDatasetMetadata repo_id lerobot/libero start perf_counter() meta LeRobotDatasetMetadata(repo_id) elapsed perf_counter() - start print( A3 数据集基本信息 ) print(f数据集ID:{repo_id}) print(f格式版本:{meta.info.codebase_version}) print(f回合(episode)数:{meta.total_episodes}) print(f总帧数:{meta.total_frames}) print(ffps:{meta.fps}) print(f任务数:{meta.total_tasks}) print(f元数据读取耗时:{elapsed}) print(f本地元数据目录:{meta.root}) print(A3_METADATA_OK)输出# A3 数据集基本信息 # 数据集ID:lerobot/libero # 格式版本:v3.0 # 回合(episode)数:1693 # 总帧数:273465 # fps:10.0 # 任务数:40 # 元数据读取耗时:3.976761218160391 # 本地元数据目录:/root/autodl-tmp/huggingface/lerobot/hub/datasets--lerobot--libero/snapshots/a1aaacb7f6cd6ee5fb43120f673cebb0cfea7dd4 # A3_METADATA_OKepisode意思是回合一条完整的演示便可以认为是一个episode任务数为40也就是说这个数据集一共有40种任务这40种任务拥有1693条演示总帧数为273465。2. 数据集完整字段回到之前QA中的问题我们需要检查该数据集中的字段能不能跟pi0.5需要的输入字段对上运行如下代码# LeRobotDatasetMetadata不包含真实的数据只包含数据信息 from lerobot.datasets import LeRobotDatasetMetadata repo_id lerobot/libero meta LeRobotDatasetMetadata(repo_id) print( A3 数据集全部字段 ) for key, feature in meta.features.items(): print( f{key}: fdtype{feature.get(dtype)}, fshape{feature.get(shape)} ) print( libero数据集比对π0.5字段 ) print(f相机键名:{meta.camera_keys}) for key in [ observation.images.image, observation.images.image2, observation.state, action, ]: if key in meta.features: feature meta.features[key] print( f{key}: fdtype{feature.get(dtype)}, fshape{feature.get(shape)} ) else: print(f{key}:缺失) print(A3_FEATURES_OK)输出 A3 libero数据集全部字段 observation.images.image:dtypevideo,shape(256, 256, 3) observation.images.image2:dtypevideo,shape(256, 256, 3) observation.state:dtypefloat32,shape(8,) action:dtypefloat32,shape(7,) timestamp:dtypefloat32,shape(1,) frame_index:dtypeint64,shape(1,) episode_index:dtypeint64,shape(1,) index:dtypeint64,shape(1,) task_index:dtypeint64,shape(1,) libero数据集比对π0.5字段 相机键名:[observation.images.image, observation.images.image2] observation.images.image:dtypevideo,shape(256, 256, 3) observation.images.image2:dtypevideo,shape(256, 256, 3) observation.state:dtypefloat32,shape(8,) action:dtypefloat32,shape(7,) A3_FEATURES_OK可以发现libero的数据集字段中也包含pi0.5所需要的两路imagestate换句话说libero数据集完全能适配pi0.5的输入我们后续不用做数据处理就能让模型在这个数据集上微调。3.任务描述字段通过下面的代码简单看看实际每一条数据对应的任务描述是什么# LeRobotDatasetMetadata不包含真实的数据只包含数据信息 from lerobot.datasets import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDataset repo_id lerobot/libero meta LeRobotDatasetMetadata(repo_id) print( 任务描述表 ) print(f任务文本字段名:{meta.tasks.index.name}) print(f任务表中的列:{meta.tasks.columns.tolist()}) print(f任务总数:{len(meta.tasks)}) print(\n前五个任务) for task_text, row in meta.tasks.head(5).iterrows(): print(ftask_index{row[task_index]}:{task_text}) print(\n episode 0真实数据 ) dataset LeRobotDataset( repo_idrepo_id, episodes[0], download_videosFalse, ) first_frame dataset.get_raw_item(0) task_index int(first_frame[task_index]) task_text meta.tasks.iloc[task_index].name print(f第一帧的task_index:{task_index}) print(f对应的任务文本{task_text}) print(A3_TASKS_OK)输出 任务描述表 任务文本字段名: task 任务表中的列: [task_index] 任务总数: 40 前五个任务 task_index0: put the white mug on the left plate and put the yellow and white mug on the right plate task_index1: put the white mug on the plate and put the chocolate pudding to the right of the plate task_index2: put the yellow and white mug in the microwave and close it task_index3: turn on the stove and put the moka pot on it task_index4: put both the alphabet soup and the cream cheese box in the basket episode 0 第一帧的task_index: 0 对应的任务文本put the white mug on the left plate and put the yellow and white mug on the right plate A3_TASKS_OK最后的输出表明第一个episode对应的任务是“put the white mug on the left plate and put the yellow and white mug on the right plate”。4.rerun可视化通过下面的指令可视化第一个episode的数据lerobot-dataset-viz \ --repo-id lerobot/libero \ --episode-index 0 \ --save 1 \ --output-dir /root/autodl-tmp/workspace/my_test/a3_viz \ --num-workers 0最终会得到一个rrd文件用rerun打开总结本文介绍了libero数据集的基本信息、字段、任务描述并使用rerun进行了单条数据的可视化。文章仅做学习分享如有谬误欢迎指正。