数据预处理—文件读取

1.npz文件读取

parent_dir='waveform'
sub_dir='fold1'
file_ext="*.npz"
for fn in glob.glob(os.path.join(parent_dir,sub_dir,file_ext)):
    wave_clip = np.load(fn)
2.dat文件读取

 for fn in glob.glob(os.path.join(parent_dir, sub_dir, file_ext)):
     file = open(fn, "rb")
     dates = file.read()
     file.close()
     wave_clip = np.fromstring(dates, dtype=np.int16)
     signal.append(wave_clip)
 signal = np.array(signal)

3.npy文件读取

wave_clip = np.load("waveform/fold3/data_0_0_3.npy")






猜你喜欢

转载自blog.csdn.net/huowa9077/article/details/79056430
今日推荐