Commit fc583924 authored by Alessio Brutti's avatar Alessio Brutti
Browse files

second commit, minor fixings

parent 20f3f3d1
......@@ -34,22 +34,23 @@ model.summary()
buckets = utils.build_buckets(MAX_SEC, BUCKET_STEP, FRAME_STEP)
for foldername in sorted(glob.glob(args.input_dir+'/*')):
print(foldername)
for foldername in sorted(glob.glob(args.input_dir+'/**', recursive = True)):
#session_name=foldername.split('/')[-1]
#print(session_name)
#embs=[]
#for audio_file in sorted(glob.glob(foldername+'/*/*.flac')): ## parametrizzare il tipo di file (oppure cercare semplicemente tutti i fiels
audio_file=foldername ###This is so fucked up... I need to fix
print('Extracting features from file %s'%audio_file)
signal = utils.get_fft_spectrum(audio_file, buckets,SAMPLE_RATE,NUM_FFT,FRAME_LEN,FRAME_STEP,PREEMPHASIS_ALPHA)
#embs.append((audio_file.split('.')[0],np.squeeze(model.predict(signal.reshape(1,*signal.shape,1)))))
embs = np.squeeze(model.predict(signal.reshape(1,*signal.shape,1)))
print(embs.shape)
print('Dumping vggvox embeddings')
if os.path.isfile(foldername) and foldername.lower().endswith(('.flac', '.wav')):
audio_file=foldername ###This is so fucked up... I need to fix
#print(audio_file)
#print('Extracting features from file %s'%audio_file)
signal = utils.get_fft_spectrum(audio_file, buckets,SAMPLE_RATE,NUM_FFT,FRAME_LEN,FRAME_STEP,PREEMPHASIS_ALPHA)
embs = np.squeeze(model.predict(signal.reshape(1,*signal.shape,1)))
#print(embs.shape)
#print('Dumping vggvox embeddings')
fdump=open(args.output_dir+'/'+audio_file.split('/')[-1].split('.')[0]+'.pkl','wb')
pkl.dump(embs, fdump, protocol=pkl.HIGHEST_PROTOCOL)
fdump.close()
fdump=open(args.output_dir+'/'+audio_file.split('/')[-1].split('.')[0]+'.pkl','wb')
pkl.dump(embs, fdump, protocol=pkl.HIGHEST_PROTOCOL)
fdump.close()
Supports Markdown
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