25 lines
585 B
Python
25 lines
585 B
Python
import h5py
|
|
|
|
file_path = "/home/maic/LYT/mindbot/datasets/mindrobot_demos.hdf5"
|
|
|
|
with h5py.File(file_path, "r") as f:
|
|
print("文件结构:")
|
|
|
|
def print_structure(name, obj):
|
|
print(name)
|
|
|
|
f.visititems(print_structure)
|
|
|
|
print("\n开始打印前 50 条数据:\n")
|
|
|
|
def print_first_50(name, obj):
|
|
if isinstance(obj, h5py.Dataset):
|
|
print(f"\nDataset: {name}")
|
|
print("Shape:", obj.shape)
|
|
|
|
# 只打印前 50 条
|
|
data = obj[:50]
|
|
print(data)
|
|
|
|
f.visititems(print_first_)
|