Update examples/plot_pr_curves.py
Browse files
examples/plot_pr_curves.py
CHANGED
|
@@ -124,9 +124,10 @@ if __name__ == "__main__":
|
|
| 124 |
label_hop_512_all, vad_result_silero_vad_all = np.array([]), np.array([])
|
| 125 |
wav_list = glob.glob(f"{test_dir}/*.wav")
|
| 126 |
|
| 127 |
-
#
|
| 128 |
print("Start processing")
|
| 129 |
for wav_path in wav_list:
|
|
|
|
| 130 |
ten_vad_instance = TenVad(hop_size, threshold)
|
| 131 |
label_file = wav_path.replace(".wav", ".scv")
|
| 132 |
label = convert_label_to_framewise(
|
|
@@ -142,13 +143,14 @@ if __name__ == "__main__":
|
|
| 142 |
label_all = np.append(label_all, label[:frame_num - 1])
|
| 143 |
del ten_vad_instance # To prevent getting different results of each run
|
| 144 |
|
|
|
|
| 145 |
label_hop_512 = convert_label_to_framewise(
|
| 146 |
label_file, hop_size=512
|
| 147 |
) # Convert the VAD label to frame-wise one for Silero VAD
|
| 148 |
vad_result_silero_vad, _ = silero_vad_inference_single_file(wav_path)
|
| 149 |
frame_num_silero_vad = min(label_hop_512.__len__(), vad_result_silero_vad.__len__())
|
| 150 |
vad_result_silero_vad_all = np.append(vad_result_silero_vad_all, vad_result_silero_vad[:frame_num_silero_vad])
|
| 151 |
-
label_hop_512_all = np.append(label_hop_512_all, label_hop_512[:frame_num_silero_vad])
|
| 152 |
|
| 153 |
# Compute Precision and Recall
|
| 154 |
threshold_arr = np.arange(0, 1.01, 0.01)
|
|
|
|
| 124 |
label_hop_512_all, vad_result_silero_vad_all = np.array([]), np.array([])
|
| 125 |
wav_list = glob.glob(f"{test_dir}/*.wav")
|
| 126 |
|
| 127 |
+
# The WebRTC VAD is from the latest version of WebRTC and is not plotted here
|
| 128 |
print("Start processing")
|
| 129 |
for wav_path in wav_list:
|
| 130 |
+
# Running TEN VAD
|
| 131 |
ten_vad_instance = TenVad(hop_size, threshold)
|
| 132 |
label_file = wav_path.replace(".wav", ".scv")
|
| 133 |
label = convert_label_to_framewise(
|
|
|
|
| 143 |
label_all = np.append(label_all, label[:frame_num - 1])
|
| 144 |
del ten_vad_instance # To prevent getting different results of each run
|
| 145 |
|
| 146 |
+
# Running Silero VAD
|
| 147 |
label_hop_512 = convert_label_to_framewise(
|
| 148 |
label_file, hop_size=512
|
| 149 |
) # Convert the VAD label to frame-wise one for Silero VAD
|
| 150 |
vad_result_silero_vad, _ = silero_vad_inference_single_file(wav_path)
|
| 151 |
frame_num_silero_vad = min(label_hop_512.__len__(), vad_result_silero_vad.__len__())
|
| 152 |
vad_result_silero_vad_all = np.append(vad_result_silero_vad_all, vad_result_silero_vad[:frame_num_silero_vad])
|
| 153 |
+
label_hop_512_all = np.append(label_hop_512_all, label_hop_512[:frame_num_silero_vad])
|
| 154 |
|
| 155 |
# Compute Precision and Recall
|
| 156 |
threshold_arr = np.arange(0, 1.01, 0.01)
|