test_example_lengths = np.load(old_data_path+'test_example_lengths_102012.npy') detection_array = np.zeros((test_example_lengths.shape[0], test_example_lengths.max() + 2),dtype=np.float32) linear_filter,c = et.construct_linear_filter(aar_template, clipped_bgd) # need to state the syllable we are working with syllable = np.array(['aa','r']) detection_array,example_start_end_times, detection_lengths = gtrd.get_detection_scores(data_path+'Test/', detection_array, syllable, linear_filter,c,verbose=True) np.save(tmp_data_path+'detection_array_aar_1.npy',detection_array) out = open(tmp_data_path+'example_start_end_times_aar_1.pkl','wb') cPickle.dump(example_start_end_times,out) out.close() out = open(tmp_data_path+'detection_lengths_aar_1.pkl','wb') cPickle.dump(detection_lengths,out) out.close() import template_speech_rec.roc_functions as rf window_start,window_end = rf.get_auto_syllable_window(aar_template)
num_mix = 1 aar_parts_template, aar_registered = et.register_templates_time_zero(syllable_examples,min_prob=.01) np.save(cur_tmp_data_path+'parts_aar_template_%d.npy' % num_mix,aar_parts_template) detection_array = np.zeros((parts_test_example_lengths.shape[0], parts_test_example_lengths.max() + 2),dtype=np.float32) linear_filter,c = et.construct_linear_filter(aar_parts_template, waliji_bgd) for i in xrange(num_mix): np.save(cur_tmp_data_path+'linear_filter_aar_%d_%d.npy'%(num_mix,i),linear_filter) np.save(cur_tmp_data_path+'c_aar_%d_%d.npy'%(num_mix,i),np.array(c)) syllable = np.array(['aa','r']) detection_array,parts_example_start_end_times, parts_detection_lengths = gtrd.get_detection_scores(test_data_path, detection_array, syllable, linear_filter,c, log_part_blocks=log_part_blocks, log_invpart_blocks=log_invpart_blocks, verbose=True) np.save(cur_tmp_data_path+'parts_detection_array_aar_%d.npy' % num_mix,detection_array) window_start = -2 window_end = 2 max_detect_vals = rf.get_max_detection_in_syllable_windows(detection_array, parts_example_start_end_times, parts_detection_lengths, window_start, window_end) np.save(cur_tmp_data_path+'parts_max_detect_vals_aar_%d.npy' % num_mix,max_detect_vals) num_mix = 1 max_detect_vals = np.load(cur_tmp_data_path+'parts_max_detect_vals_aar_%d.npy' % num_mix) detection_array = np.load(cur_tmp_data_path+'parts_detection_array_aar_%d.npy' % num_mix)