I am engaged in isolating signs in audio files in Python, in particular, I use Anaconda. There are ready-made models. Faced a problem - it is required to process sets of files (an average of 3,500 pieces in a folder), isolate signs and then save the result, as a table, into one file in h5 format. Reading, brute force organized in the format:
root = 'c:\\scripts' pattern = '*.py' for folder, subdirs, files in os.walk(root): for filename in fnmatch.filter(files, pattern): fullname = os.path.join(folder, filename) next, in the loop for filename in fnmatch.filter(files, pattern): implement the isolation of features. All signs are added to one file as:
x.append((chs/znam)**alpha) mgd = np.vstack(x) print(mgd.shape) np.savetxt('H:\\Magistr\\testdata\\mgd\\rezult_zn.csv', mgd, delimiter = ",") In the end, no matter how I tried to vary the stack combination for the array and append for the list. Because everything happens in a loop, I always save the result of processing the last iteration, processing the last file. How to fix? P / s: I just started doing Python, and the question should be closed within a week.
with h5py.File("H:\\...\file.h5", "a") as hf: dset = hf.create_dataset('mgd-feature', data = array, dtype = 'float')put in HDF5, where array in which I collect everything. In this case, it ismgd, which I can not properly form. For each file separately, everything works out for me, but I need it for everyone in a folder in one file. - Bear541