Show percentage when calculating vectors

pull/23/merge
Matthew Scholefield 2018-08-09 23:59:26 -05:00
parent 7bded13de4
commit b1d7a7ff5d
1 changed files with 4 additions and 1 deletions

View File

@ -191,12 +191,14 @@ class TrainData:
outputs = [] outputs = []
def add(filenames, output): def add(filenames, output):
for f in filenames: for i, f in enumerate(filenames):
try: try:
inputs.append(load_vector(f, vectorizer)) inputs.append(load_vector(f, vectorizer))
outputs.append(np.array([output])) outputs.append(np.array([output]))
except InvalidAudio as e: except InvalidAudio as e:
print('Skipping invalid file:', f, e) print('Skipping invalid file:', f, e)
print('\r{0:.2%} '.format(i/len(filenames)), end='', flush=True)
print('\r \r', end='', flush=True)
print('Loading wake-word...') print('Loading wake-word...')
add(kw_files, 1.0) add(kw_files, 1.0)
@ -207,6 +209,7 @@ class TrainData:
from precise.params import pr from precise.params import pr
inputs = np.array(inputs) if inputs else np.empty((0, pr.n_features, pr.feature_size)) inputs = np.array(inputs) if inputs else np.empty((0, pr.n_features, pr.feature_size))
outputs = np.array(outputs) if outputs else np.empty((0, 1)) outputs = np.array(outputs) if outputs else np.empty((0, 1))
shuffle_ids = np.arange(len(inputs)) shuffle_ids = np.arange(len(inputs))
np.random.shuffle(shuffle_ids) np.random.shuffle(shuffle_ids)
return inputs[shuffle_ids], outputs[shuffle_ids] return inputs[shuffle_ids], outputs[shuffle_ids]