Justin-Tan / generative-compression

TensorFlow Implementation of Generative Adversarial Networks for Extreme Learned Image Compression
MIT License
511 stars 108 forks source link

How to generate the required HDF5 file? #41

Open davidyang19971209 opened 3 years ago

davidyang19971209 commented 3 years ago

This is my first use HDF5 dataset in neural network and I am clueless about how to generate the file with required format. Could anyone offer a example code about it?

JimmyWooo commented 3 years ago

import glob import os import pandas as pd

img_path = 'testB' #图片路径

i_paths = glob.glob(os.path.join(img_path,'*.jpg')) i_paths.sort() a = {'semantic_map_paths': i_paths} df = pd.DataFrame(data=a) #生成dataframe

print(df)

df.to_hdf('underwater_paths_test.h5',key='trainB') #转存为h5文件

f = pd.read_hdf('underwater_paths_train.h5',key='semantic_map_paths') print(f)

davidyang19971209 commented 3 years ago

import glob import os import pandas as pd

img_path = 'testB' #图片路径

i_paths = glob.glob(os.path.join(img_path,'*.jpg')) i_paths.sort() a = {'semantic_map_paths': i_paths} df = pd.DataFrame(data=a) #生成dataframe

print(df)

df.to_hdf('underwater_paths_test.h5',key='trainB') #转存为h5文件

f = pd.read_hdf('underwater_paths_train.h5',key='semantic_map_paths') print(f)

Thanks a lot, it is a great help to me