Commit b3a42cf9 authored by Luca Pasa's avatar Luca Pasa
Browse files

mod on malatiello for MULTI_GRID_100 ds

parent 9c26431c
......@@ -6,7 +6,7 @@ import os
#comago
# root = grid_multi_speaker_path = "/DATA_NEW/lpasa/Data/MULTI_GRID/"
#root="/home/storage/Data/GRID/"
root="/home/storage/Data/MULTI_GRID/"
root="/home/storage/Data/MULTI_GRID_100/"
dict_path = "./dictionary.txt"
word_path = "./word.txt"
......@@ -72,9 +72,9 @@ if __name__ == '__main__':
word_file = open(word_path, 'r')
dict_file = open(dict_path, 'r')
# CREATE FILE PROCEDURE
# create_copy_files_string()
# for word,transcription in zip(word_file,dict_file):
# replace_in_dataset(word.strip(),transcription.strip())
create_copy_files_string()
for word,transcription in zip(word_file,dict_file):
replace_in_dataset(word.strip(),transcription.strip())
# CREATE LINEARIZED FILE
create_linearized_files()
......
......@@ -50,21 +50,21 @@ dataset_video_mean = np.load('dataset_video_mean.npy')
dataset_video_std = np.load('dataset_video_stdev.npy')
# destination folders
train_dir = '/home/storage/Data/MULTI_GRID/multiModalTfRec/TRAIN_CTC_SENTENCES/'
val_dir = '/home/storage/Data/MULTI_GRID/multiModalTfRec/VAL_CTC_SENTENCES/'
test_dir = '/home/storage/Data/MULTI_GRID/multiModalTfRec/TEST_CTC_SENTENCES/'
train_dir = '/home/storage/Data/MULTI_GRID_100/multiModalTfRec/TRAIN_CTC_SENTENCES/'
val_dir = '/home/storage/Data/MULTI_GRID_100/multiModalTfRec/VAL_CTC_SENTENCES/'
test_dir = '/home/storage/Data/MULTI_GRID_100/multiModalTfRec/TEST_CTC_SENTENCES/'
f = open('./dictionary.txt', 'r')
dictionary = f.read()
phonemes = dictionary.replace('\n', ' ').split(' ')
phonemes = [ph for ph in sorted(set(phonemes)) if ph is not '']
print('Number of phonemes = ', len(phonemes))
print(phonemes)
#print('Number of phonemes = ', len(phonemes))
#print(phonemes)
features_file_list_base_audio = sorted(glob.glob('/home/storage/Data/MULTI_GRID/s*/base_audio/*.csv'))
features_file_list_audio = sorted(glob.glob('/home/storage/Data/MULTI_GRID/s*/multi_audio/*.csv'))
features_file_list_video = sorted(glob.glob('/home/storage/Data/MULTI_GRID/s*/video/*.txt'))
features_file_list_base_audio = sorted(glob.glob('/home/storage/Data/MULTI_GRID_100/s*/base_audio/*.csv'))
features_file_list_audio = sorted(glob.glob('/home/storage/Data/MULTI_GRID_100/s*/multi_audio/*.csv'))
features_file_list_video = sorted(glob.glob('/home/storage/Data/MULTI_GRID_100/s*/video/*.txt'))
assert len(features_file_list_audio) == len(features_file_list_video) == len(features_file_list_base_audio), "#base_audop != #multi_audio != #video"
print('Total number of files = {}'.format(
......@@ -103,14 +103,14 @@ for file_index, (csv_base_file_audio,csv_file_audio, txt_file_video) in enumerat
features_file_list_audio,
features_file_list_video)):
print('base audio {:s},multi audio {:s}, video {:s}'.format(csv_base_file_audio, csv_file_audio, txt_file_video))
# print('base audio {:s},multi audio {:s}, video {:s}'.format(csv_base_file_audio, csv_file_audio, txt_file_video))
features_base_audio = np.loadtxt(csv_base_file_audio, delimiter=',')
features_audio = np.loadtxt(csv_file_audio, delimiter=',')
features_video = np.loadtxt(txt_file_video)
print features_base_audio
print features_audio.shape
print features_video.shape
# print features_base_audio
#print features_audio.shape
#print features_video.shape
# label path
labels_file = csv_file_audio.replace('/multi_audio/', '/transcription/').replace('.csv', '.transcription')
......@@ -119,12 +119,12 @@ for file_index, (csv_base_file_audio,csv_file_audio, txt_file_video) in enumerat
labels = f.read()
labels = labels.replace('\n', '').replace('SP', '').split(',')
labels = [lab for lab in labels if lab is not '']
print('labels : ', labels)
#print('labels : ', labels)
labels = [phonemes.index(ph) for ph in labels]
print('labels : ', labels)
#print('labels : ', labels)
labels = np.asarray(labels)
print(labels.shape)
print('')
#print(labels.shape)
#print('')
features_base_audio = np.subtract(features_base_audio, dataset_audio_base_mean) / dataset_audio_base_std
features_audio = np.subtract(features_audio, dataset_multi_audio_mean) / dataset_multi_audio_std
features_video = np.subtract(features_video, dataset_video_mean) / dataset_video_std
......
......@@ -11,15 +11,12 @@ for file_index, txt_file in enumerate(features_file_list):
#print(file_index,txt_file)
data=np.loadtxt(txt_file)
if data.shape[0]<60:
#print data.shape
#print txt_file
last_frame=data[-1,:].reshape((1,data.shape[1]))
for _ in range(74-data.shape[0]):
data=np.concatenate((data,last_frame),axis=0)
f_len.append(data.shape[0])
features.append(data)
raw_input("STOP")
features = np.concatenate(features)
print(features.shape)
......
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