for x in img_audio:
        try:        
            # one group for each image file which will contain its vgg16 features and audio captions 
            output_file.create_group("/", append_name + x.split('.')[0])    
        except:
            continue
# else load an existing file to append new features to      
else:
    output_file = tables.open_file(data_loc, mode='a')
    
#list all the nodes
node_list = output_file.root._f_list_nodes()
    
# create the visual features for all images
for x in vis: 
    vis_feats(img_path, output_file, append_name, img_audio, node_list, x) 

######### parameter settings for the audio preprocessing ###############
# option for which audio feature to create (options are mfcc, fbanks, freq_spectrum and raw)
feat = ''
params = []
# set alpha for the preemphasis
alpha = 0.97
# set the number of desired filterbanks
nfilters = 40
# windowsize and shift in seconds
t_window = .025
t_shift = .010
# option to include delta and double delta features
use_deltas = True
# option to include frame energy
Beispiel #2
0
    subgroups.append(node)
    for x in batch:
        output_file.create_group(node, append_name + x.split('.')[0])
    count +=1
# list all the nodes containing training instances
train_node_list = []
for subgroup in subgroups:
    train_node_list = train_node_list + subgroup._f_list_nodes()

subgroups = []
for batch in batcher(10000, val_img):
    node = output_file.create_group('/', 'subgroup_' + str(count))
    subgroups.append(node)
    for x in batch:
        output_file.create_group(node, append_name + x.split('.')[0])
    count +=1     
# list all the nodes containing validation instances
val_node_list = []
for subgroup in subgroups:
    val_node_list = val_node_list + subgroup._f_list_nodes()
    
# create the visual features for all images  
vis_feats(val_img_path, output_file, append_name, val_img, val_node_list, 'resnet')
vis_feats(train_img_path, output_file, append_name, train_img, train_node_list, 'resnet') 

# add text features for all captions
text_features_coco(train_dict, output_file, append_name, train_node_list)
text_features_coco(val_dict, output_file, append_name, val_node_list)
# close the output files
output_file.close()