Spaces:
Sleeping
Sleeping
update
Browse files
.gitignore
CHANGED
@@ -11,6 +11,7 @@
|
|
11 |
/data/
|
12 |
/docs/
|
13 |
/dotenv/
|
|
|
14 |
/trained_models/
|
15 |
/temp/
|
16 |
|
|
|
11 |
/data/
|
12 |
/docs/
|
13 |
/dotenv/
|
14 |
+
/examples/**/*.wav
|
15 |
/trained_models/
|
16 |
/temp/
|
17 |
|
examples/sample_filter/bad_case_find.py
CHANGED
@@ -51,7 +51,7 @@ def main():
|
|
51 |
label1, prob1 = client.predict(
|
52 |
audio=handle_file(filename),
|
53 |
# model_name="vm_sound_classification8-ch32",
|
54 |
-
model_name="voicemail-
|
55 |
ground_true="Hello!!",
|
56 |
api_name="/click_button"
|
57 |
)
|
@@ -66,7 +66,7 @@ def main():
|
|
66 |
)
|
67 |
prob2 = float(prob2)
|
68 |
|
69 |
-
if label1 == "voicemail" and label2 in ("voicemail", "bell") and prob1 >
|
70 |
pass
|
71 |
elif label1 == "non_voicemail" and label2 not in ("voicemail", "bell") and prob1 > 0.6:
|
72 |
pass
|
|
|
51 |
label1, prob1 = client.predict(
|
52 |
audio=handle_file(filename),
|
53 |
# model_name="vm_sound_classification8-ch32",
|
54 |
+
model_name="voicemail-en-ph-2-ch4",
|
55 |
ground_true="Hello!!",
|
56 |
api_name="/click_button"
|
57 |
)
|
|
|
66 |
)
|
67 |
prob2 = float(prob2)
|
68 |
|
69 |
+
if label1 == "voicemail" and label2 in ("voicemail", "bell") and prob1 > 0.6:
|
70 |
pass
|
71 |
elif label1 == "non_voicemail" and label2 not in ("voicemail", "bell") and prob1 > 0.6:
|
72 |
pass
|
examples/sample_filter/correction.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import argparse
|
4 |
+
from pathlib import Path
|
5 |
+
import shutil
|
6 |
+
|
7 |
+
from gradio_client import Client, handle_file
|
8 |
+
from tqdm import tqdm
|
9 |
+
|
10 |
+
from project_settings import project_path
|
11 |
+
|
12 |
+
|
13 |
+
def get_args():
|
14 |
+
parser = argparse.ArgumentParser()
|
15 |
+
parser.add_argument(
|
16 |
+
"--data_dir",
|
17 |
+
default=r"E:\Users\tianx\HuggingDatasets\vm_sound_classification\data\wav_finished\en-PH\wav_finished",
|
18 |
+
type=str
|
19 |
+
)
|
20 |
+
parser.add_argument(
|
21 |
+
"--correction_dir",
|
22 |
+
default=r"E:\Users\tianx\HuggingDatasets\vm_sound_classification\data\correction",
|
23 |
+
type=str
|
24 |
+
)
|
25 |
+
args = parser.parse_args()
|
26 |
+
return args
|
27 |
+
|
28 |
+
|
29 |
+
def main():
|
30 |
+
args = get_args()
|
31 |
+
|
32 |
+
data_dir = Path(args.data_dir)
|
33 |
+
correction_dir = Path(args.correction_dir)
|
34 |
+
correction_dir.mkdir(parents=True, exist_ok=True)
|
35 |
+
|
36 |
+
client = Client("http://127.0.0.1:7864/")
|
37 |
+
|
38 |
+
for idx, filename in tqdm(enumerate(data_dir.glob("**/*.wav"))):
|
39 |
+
# if idx < 200:
|
40 |
+
# continue
|
41 |
+
ground_truth = filename.parts[-2]
|
42 |
+
filename = filename.as_posix()
|
43 |
+
|
44 |
+
label, prob = client.predict(
|
45 |
+
audio=handle_file(filename),
|
46 |
+
model_name="voicemail-en-ph-2-ch32",
|
47 |
+
ground_true="Hello!!",
|
48 |
+
api_name="/click_button"
|
49 |
+
)
|
50 |
+
prob = float(prob)
|
51 |
+
|
52 |
+
if label == "voicemail" and ground_truth in ("voicemail", "bell"):
|
53 |
+
pass
|
54 |
+
elif label == "non_voicemail" and ground_truth not in ("voicemail", "bell"):
|
55 |
+
pass
|
56 |
+
else:
|
57 |
+
print(f"ground_truth: {ground_truth}, label: {label}, prob: {prob}")
|
58 |
+
|
59 |
+
tgt_dir = correction_dir / ground_truth
|
60 |
+
tgt_dir.mkdir(parents=True, exist_ok=True)
|
61 |
+
shutil.move(
|
62 |
+
filename,
|
63 |
+
tgt_dir.as_posix(),
|
64 |
+
)
|
65 |
+
|
66 |
+
return
|
67 |
+
|
68 |
+
|
69 |
+
if __name__ == '__main__':
|
70 |
+
main()
|
examples/sample_filter/wav_find_by_task_excel.py
CHANGED
@@ -13,12 +13,13 @@ from project_settings import project_path
|
|
13 |
|
14 |
|
15 |
task_file_str = """
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
22 |
"""
|
23 |
|
24 |
|
|
|
13 |
|
14 |
|
15 |
task_file_str = """
|
16 |
+
task_DcTask_1_PH_LIVE_20250328_20250328-1.xlsx
|
17 |
+
task_DcTask_1_PH_LIVE_20250329_20250329-1.xlsx
|
18 |
+
task_DcTask_1_PH_LIVE_20250331_20250331-1.xlsx
|
19 |
+
task_DcTask_3_PH_LIVE_20250328_20250328-1.xlsx
|
20 |
+
task_DcTask_3_PH_LIVE_20250331_20250331-1.xlsx
|
21 |
+
task_DcTask_9_PH_LIVE_20250329_20250329-1.xlsx
|
22 |
+
task_DcTask_9_PH_LIVE_20250331_20250331-1.xlsx
|
23 |
"""
|
24 |
|
25 |
|
requirements.txt
CHANGED
@@ -9,5 +9,5 @@ tqdm==4.66.4
|
|
9 |
overrides==1.9.0
|
10 |
pyyaml==6.0.1
|
11 |
evaluate==0.4.2
|
12 |
-
gradio
|
13 |
python-dotenv==1.0.1
|
|
|
9 |
overrides==1.9.0
|
10 |
pyyaml==6.0.1
|
11 |
evaluate==0.4.2
|
12 |
+
gradio
|
13 |
python-dotenv==1.0.1
|