Commit 4245c7ce authored by Jan Rudolf's avatar Jan Rudolf

ADD siamese nn training

parent 734dba57
......@@ -34,13 +34,12 @@ def preprocess(n_mfcc):
os.mkdir(output_folder)
else:
print('Cached features found')
return
return pd.read_csv(output_file), pd.read_pickle(similarity_file)
for genre in df['label'].unique().tolist():
genre_folder = os.path.join(output_folder, genre)
if not os.path.isdir(genre_folder):
os.mkdir(genre_folder)
for index, row in df.iterrows():
dumb_absolute_path = row['file']
smart_suffix = dumb_absolute_path[len(DUMB_PREFIX):]
......@@ -50,14 +49,13 @@ def preprocess(n_mfcc):
output_index.append((smart_relative_output_path, row['label']))
mfccs = preprocess_sample(smart_relative_path, n_mfcc=n_mfcc)
np.save(smart_relative_output_path, mfccs)
done += 1
print(f'Preprocessing <{done}/{length}> ', end='\r')
output_df = pd.DataFrame(output_index, columns=columns, index=None)
output_df.to_csv(output_file, header=False, index=False)
output_df.to_csv(output_file, index=False)
similarity_list = list()
for i in range(len(output_index)):
......@@ -68,6 +66,7 @@ def preprocess(n_mfcc):
similarity_df.to_pickle(similarity_file, protocol=4)
print('\nDone')
return output_df, similarity_df
if __name__ == '__main__':
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment