Update examples/plot_pr_curves.py
Browse files123 unmodified lines1241251261271281291301311329 unmodified lines142143144145146147148149150151152153154123 unmodified lineslabel_hop_512_all, vad_result_silero_vad_all = np.array([]), np.array([])wav_list = glob.glob(f"{test_dir}/*.wav")# Running TEN VADprint("Start processing")for wav_path in wav_list:ten_vad_instance = TenVad(hop_size, threshold)label_file = wav_path.replace(".wav", ".scv")label = convert_label_to_framewise(9 unmodified lineslabel_all = np.append(label_all, label[:frame_num - 1])del ten_vad_instance # To prevent getting different results of each runlabel_hop_512 = convert_label_to_framewise(label_file, hop_size=512) # Convert the VAD label to frame-wise one for Silero VADvad_result_silero_vad, _ = silero_vad_inference_single_file(wav_path)frame_num_silero_vad = min(label_hop_512.__len__(), vad_result_silero_vad.__len__())vad_result_silero_vad_all = np.append(vad_result_silero_vad_all, vad_result_silero_vad[:frame_num_silero_vad])label_hop_512_all = np.append(label_hop_512_all, label_hop_512[:frame_num_silero_vad])# Compute Precision and Recallthreshold_arr = np.arange(0, 1.01, 0.01)123 unmodified lines1241251261271281291301311321339 unmodified lines143144145146147148149150151152153154155156123 unmodified lineslabel_hop_512_all, vad_result_silero_vad_all = np.array([]), np.array([])wav_list = glob.glob(f"{test_dir}/*.wav")# The WebRTC VAD is from the latest version of WebRTC and is not plotted hereprint("Start processing")for wav_path in wav_list:# Running TEN VADten_vad_instance = TenVad(hop_size, threshold)label_file = wav_path.replace(".wav", ".scv")label = convert_label_to_framewise(9 unmodified lineslabel_all = np.append(label_all, label[:frame_num - 1])del ten_vad_instance # To prevent getting different results of each run# Running Silero VADlabel_hop_512 = convert_label_to_framewise(label_file, hop_size=512) # Convert the VAD label to frame-wise one for Silero VADvad_result_silero_vad, _ = silero_vad_inference_single_file(wav_path)frame_num_silero_vad = min(label_hop_512.__len__(), vad_result_silero_vad.__len__())vad_result_silero_vad_all = np.append(vad_result_silero_vad_all, vad_result_silero_vad[:frame_num_silero_vad])label_hop_512_all = np.append(label_hop_512_all, label_hop_512[:frame_num_silero_vad])# Compute Precision and Recallthreshold_arr = np.arange(0, 1.01, 0.01)
examples/plot_pr_curves.py+4-2