python convert .h5 file to csv

5. Find the results folder in jupyter, and then convert the running .h5 results into csv files

pip install tables

import h5py

import numpy as np

import pandas as pd

filename = 'Mnist_FEDL_0.003_0_10u_20b_5_avg.h5'

f = h5py.File(filename, 'r')

# List all groups

print("Keys: %s" % f.keys())

a_group_key = list(f.keys())[0]

# Get the data

data = list(f[a_group_key])

pd.DataFrame(data).to_csv("hi0.csv")

a_group_key = list(f.keys())[0]

pd.DataFrame(data).to_csv("hi0.csv")

a_group_key = list(f.keys())[1]

pd.DataFrame(data).to_csv("hi1.csv")

a_group_key = list(f.keys())[2]

pd.DataFrame(data).to_csv("hi2.csv")

The global accuracy, training accuracy, and training loss can be obtained respectively

 

Guess you like

Origin blog.csdn.net/weixin_43560675/article/details/131750700