sonusai 1.0.6__py3-none-any.whl → 1.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sonusai/__init__.py +9 -8
- sonusai/audiofe.py +1 -1
- sonusai/calc_metric_spenh.py +9 -9
- sonusai/genft.py +1 -1
- sonusai/genmetrics.py +3 -3
- sonusai/genmix.py +1 -1
- sonusai/genmixdb.py +1 -1
- sonusai/metrics_summary.py +17 -18
- sonusai/mixture/mixdb.py +1 -1
- sonusai/mkwav.py +1 -1
- sonusai/onnx_predict.py +1 -1
- {sonusai-1.0.6.dist-info → sonusai-1.0.8.dist-info}/METADATA +1 -1
- {sonusai-1.0.6.dist-info → sonusai-1.0.8.dist-info}/RECORD +15 -16
- sonusai/summarize_metric_spenh.py +0 -65
- {sonusai-1.0.6.dist-info → sonusai-1.0.8.dist-info}/WHEEL +0 -0
- {sonusai-1.0.6.dist-info → sonusai-1.0.8.dist-info}/entry_points.txt +0 -0
sonusai/__init__.py
CHANGED
@@ -16,9 +16,9 @@ commands_doc = """
|
|
16
16
|
genmix Generate mixture and truth data
|
17
17
|
genmixdb Generate a mixture database
|
18
18
|
lsdb List information about a mixture database
|
19
|
+
metrics_summary Summarize generated metrics in a mixture database
|
19
20
|
mkwav Make WAV files from a mixture database
|
20
21
|
onnx_predict Run ONNX predict on a trained model
|
21
|
-
summarize_metric_spenh Summarize speech enhancement and analysis results
|
22
22
|
vars List custom SonusAI variables
|
23
23
|
"""
|
24
24
|
|
@@ -36,7 +36,7 @@ logger_db = logging.getLogger("sonusai_db")
|
|
36
36
|
logger_db.setLevel(logging.DEBUG)
|
37
37
|
|
38
38
|
# create file handler
|
39
|
-
def create_file_handler(filename: str) -> None:
|
39
|
+
def create_file_handler(filename: str, verbose: bool = False) -> None:
|
40
40
|
from pathlib import Path
|
41
41
|
|
42
42
|
fh = logging.FileHandler(filename=filename, mode="w")
|
@@ -44,12 +44,13 @@ def create_file_handler(filename: str) -> None:
|
|
44
44
|
fh.setFormatter(formatter)
|
45
45
|
logger.addHandler(fh)
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
if verbose:
|
48
|
+
filename_db = Path(filename)
|
49
|
+
filename_db = filename_db.parent / (filename_db.stem + "_dbtrace" + filename_db.suffix)
|
50
|
+
fh = logging.FileHandler(filename=filename_db, mode="w")
|
51
|
+
fh.setLevel(logging.DEBUG)
|
52
|
+
fh.setFormatter(formatter_db)
|
53
|
+
logger_db.addHandler(fh)
|
53
54
|
|
54
55
|
|
55
56
|
# update console handler
|
sonusai/audiofe.py
CHANGED
sonusai/calc_metric_spenh.py
CHANGED
@@ -531,10 +531,10 @@ def _process_mixture(
|
|
531
531
|
pesq_speech = calc_pesq(target_est_wav, target_fi)
|
532
532
|
csig_tg, cbak_tg, covl_tg = calc_speech(target_est_wav, target_fi, pesq=pesq_speech)
|
533
533
|
metrics = mixdb.mixture_metrics(m_id, ["mxpesq", "mxcsig", "mxcbak", "mxcovl"])
|
534
|
-
pesq_mx = metrics["mxpesq"][
|
535
|
-
csig_mx = metrics["mxcsig"][
|
536
|
-
cbak_mx = metrics["mxcbak"][
|
537
|
-
covl_mx = metrics["mxcovl"][
|
534
|
+
pesq_mx = metrics["mxpesq"]["primary"] if isinstance(metrics["mxpesq"], dict) else metrics["mxpesq"]
|
535
|
+
csig_mx = metrics["mxcsig"]["primary"] if isinstance(metrics["mxcsig"], dict) else metrics["mxcsig"]
|
536
|
+
cbak_mx = metrics["mxcbak"]["primary"] if isinstance(metrics["mxcbak"], dict) else metrics["mxcbak"]
|
537
|
+
covl_mx = metrics["mxcovl"]["primary"] if isinstance(metrics["mxcovl"], dict) else metrics["mxcovl"]
|
538
538
|
# pesq_speech_tst = calc_pesq(hypothesis=target_est_wav, reference=target)
|
539
539
|
# pesq_mixture_tst = calc_pesq(hypothesis=mixture, reference=target)
|
540
540
|
# pesq improvement
|
@@ -560,11 +560,11 @@ def _process_mixture(
|
|
560
560
|
if asr_method is not None and mixdb.mixture(m_id).noise.snr >= -96: # noise only, ignore/reset target ASR
|
561
561
|
asr_mx_name = f"mxasr.{asr_method}"
|
562
562
|
wer_mx_name = f"mxwer.{asr_method}"
|
563
|
-
asr_tt_name = f"
|
563
|
+
asr_tt_name = f"sasr.{asr_method}"
|
564
564
|
metrics = mixdb.mixture_metrics(m_id, [asr_mx_name, wer_mx_name, asr_tt_name])
|
565
|
-
asr_mx = metrics[asr_mx_name][
|
566
|
-
wer_mx = metrics[wer_mx_name][
|
567
|
-
asr_tt = metrics[asr_tt_name][
|
565
|
+
asr_mx = metrics[asr_mx_name]["primary"] if isinstance(metrics[asr_mx_name], dict) else metrics[asr_mx_name]
|
566
|
+
wer_mx = metrics[wer_mx_name]["primary"] if isinstance(metrics[wer_mx_name], dict) else metrics[wer_mx_name]
|
567
|
+
asr_tt = metrics[asr_tt_name]["primary"] if isinstance(metrics[asr_tt_name], dict) else metrics[asr_tt_name]
|
568
568
|
|
569
569
|
if asr_tt:
|
570
570
|
noiseadd = None # TBD add as switch, default -30
|
@@ -849,7 +849,7 @@ def main():
|
|
849
849
|
logger.info(f"Found predict log {basename(predict_logfile[0])} in predict location.")
|
850
850
|
|
851
851
|
# Setup logging file
|
852
|
-
create_file_handler(join(predict_location, "calc_metric_spenh.log"))
|
852
|
+
create_file_handler(join(predict_location, "calc_metric_spenh.log"), verbose)
|
853
853
|
update_console_handler(verbose)
|
854
854
|
initial_log_messages("calc_metric_spenh")
|
855
855
|
|
sonusai/genft.py
CHANGED
sonusai/genmetrics.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
"""sonusai genmetrics
|
2
2
|
|
3
|
-
usage: genmetrics [-hvusd] [-i MIXID] [-n INCLUDE] [-
|
3
|
+
usage: genmetrics [-hvusd] [-i MIXID] [-n INCLUDE] [-x EXCLUDE] [-p NUMPROC] LOC
|
4
4
|
|
5
5
|
options:
|
6
6
|
-h, --help
|
7
7
|
-v, --verbose Be verbose.
|
8
8
|
-i MIXID, --mixid MIXID Mixture ID(s) to generate. [default: *].
|
9
9
|
-n INCLUDE, --include INCLUDE Metrics to include. [default: all]
|
10
|
-
-p NUMPROC, --nproc NUMPROC Number of parallel processes to use. Default single thread.
|
11
10
|
-x EXCLUDE, --exclude EXCLUDE Metrics to exclude. [default: none]
|
11
|
+
-p NUMPROC, --nproc NUMPROC Number of parallel processes to use. Default single thread.
|
12
12
|
-u, --update Update metrics (do not regenerate existing metrics).
|
13
13
|
-s, --supported Show list of supported metrics.
|
14
14
|
-d, --dryrun Show list of metrics that will be generated and exit.
|
@@ -97,7 +97,7 @@ def main() -> None:
|
|
97
97
|
start_time = time.monotonic()
|
98
98
|
|
99
99
|
# Setup logging file
|
100
|
-
create_file_handler(join(location, "genmetrics.log"))
|
100
|
+
create_file_handler(join(location, "genmetrics.log"), verbose)
|
101
101
|
update_console_handler(verbose)
|
102
102
|
initial_log_messages("genmetrics")
|
103
103
|
|
sonusai/genmix.py
CHANGED
@@ -144,7 +144,7 @@ def main() -> None:
|
|
144
144
|
|
145
145
|
start_time = time.monotonic()
|
146
146
|
|
147
|
-
create_file_handler(join(location, "genmix.log"))
|
147
|
+
create_file_handler(join(location, "genmix.log"), verbose)
|
148
148
|
update_console_handler(verbose)
|
149
149
|
initial_log_messages("genmix")
|
150
150
|
|
sonusai/genmixdb.py
CHANGED
@@ -314,7 +314,7 @@ def main() -> None:
|
|
314
314
|
|
315
315
|
makedirs(location, exist_ok=True)
|
316
316
|
|
317
|
-
create_file_handler(join(location, "genmixdb.log"))
|
317
|
+
create_file_handler(join(location, "genmixdb.log"), verbose)
|
318
318
|
update_console_handler(verbose)
|
319
319
|
initial_log_messages("genmixdb")
|
320
320
|
|
sonusai/metrics_summary.py
CHANGED
@@ -55,13 +55,13 @@ def _process_mixture(
|
|
55
55
|
|
56
56
|
all_metrics = mixdb.mixture_metrics(m_id, all_metric_names)
|
57
57
|
|
58
|
-
# replace
|
58
|
+
# replace dict with 'primary' value (ignore mixup)
|
59
59
|
scalar_metrics = {
|
60
|
-
key: all_metrics[key][
|
60
|
+
key: all_metrics[key]["primary"] if isinstance(all_metrics[key], dict) else all_metrics[key]
|
61
61
|
for key in scalar_metric_names
|
62
62
|
}
|
63
63
|
string_metrics = {
|
64
|
-
key: all_metrics[key][
|
64
|
+
key: all_metrics[key]["primary"] if isinstance(all_metrics[key], dict) else all_metrics[key]
|
65
65
|
for key in string_metric_names
|
66
66
|
}
|
67
67
|
|
@@ -90,8 +90,8 @@ def _process_mixture(
|
|
90
90
|
def main() -> None:
|
91
91
|
from docopt import docopt
|
92
92
|
|
93
|
-
from
|
94
|
-
from .utils
|
93
|
+
from sonusai import __version__ as sai_version
|
94
|
+
from sonusai.utils import trim_docstring
|
95
95
|
|
96
96
|
args = docopt(trim_docstring(__doc__), version=sai_version, options_first=True)
|
97
97
|
|
@@ -107,14 +107,14 @@ def main() -> None:
|
|
107
107
|
|
108
108
|
import psutil
|
109
109
|
|
110
|
-
from
|
111
|
-
from
|
112
|
-
from
|
113
|
-
from
|
114
|
-
from .mixture
|
115
|
-
from .utils
|
116
|
-
from .utils
|
117
|
-
from .utils
|
110
|
+
from sonusai import create_file_handler
|
111
|
+
from sonusai import initial_log_messages
|
112
|
+
from sonusai import logger
|
113
|
+
from sonusai import update_console_handler
|
114
|
+
from sonusai.mixture import MixtureDatabase
|
115
|
+
from sonusai.utils import create_timestamp
|
116
|
+
from sonusai.utils import par_track
|
117
|
+
from sonusai.utils import track
|
118
118
|
|
119
119
|
mixdb = MixtureDatabase(location)
|
120
120
|
print(f"Found SonusAI mixture database with {mixdb.num_mixtures} mixtures.")
|
@@ -133,7 +133,7 @@ def main() -> None:
|
|
133
133
|
timestamp = create_timestamp() # string good for embedding into filenames
|
134
134
|
mixdb_fname = basename(location)
|
135
135
|
if verbose:
|
136
|
-
create_file_handler(join(location, "metrics_summary.log"))
|
136
|
+
create_file_handler(join(location, "metrics_summary.log"), verbose)
|
137
137
|
update_console_handler(verbose)
|
138
138
|
initial_log_messages("metrics_summary")
|
139
139
|
logger.info(f"Logging summary of SonusAI mixture database at {location}")
|
@@ -168,10 +168,9 @@ def main() -> None:
|
|
168
168
|
for metric in metrics_present:
|
169
169
|
metval = all_metrics[metric] # get metric value
|
170
170
|
logger.debug(f"First mixid {mixids[0]} metric {metric} = {metval}")
|
171
|
-
if isinstance(metval,
|
172
|
-
|
173
|
-
|
174
|
-
metval = metval[0] # remove any list
|
171
|
+
if isinstance(metval, dict):
|
172
|
+
logger.warning(f"Mixid {mixids[0]} metric {metric} is a dict, using 'primary'.")
|
173
|
+
metval = metval["primary"] # remove any dict
|
175
174
|
if isinstance(metval, float | int):
|
176
175
|
logger.debug(f"Metric is scalar {type(metval)}, entering in summary table.")
|
177
176
|
scalar_metric_names.append(metric)
|
sonusai/mixture/mixdb.py
CHANGED
@@ -2180,7 +2180,7 @@ class MixtureDatabase:
|
|
2180
2180
|
|
2181
2181
|
# Check for metrics dependencies and add them even if not explicitly requested.
|
2182
2182
|
if metric.startswith("mxwer"):
|
2183
|
-
dependencies = ("mxasr." + metric[6:], "
|
2183
|
+
dependencies = ("mxasr." + metric[6:], "sasr." + metric[6:])
|
2184
2184
|
for dependency in dependencies:
|
2185
2185
|
result[dependency] = calc(dependency)
|
2186
2186
|
|
sonusai/mkwav.py
CHANGED
sonusai/onnx_predict.py
CHANGED
@@ -210,7 +210,7 @@ def main() -> None:
|
|
210
210
|
if mixdb_path is not None or len(pfiles) > 1: # log file only if mixdb or more than one file
|
211
211
|
makedirs(output_dir, exist_ok=True)
|
212
212
|
# Setup logging file
|
213
|
-
create_file_handler(join(output_dir, "onnx-predict.log"))
|
213
|
+
create_file_handler(join(output_dir, "onnx-predict.log"), verbose)
|
214
214
|
update_console_handler(verbose)
|
215
215
|
initial_log_messages("onnx_predict")
|
216
216
|
# print some previous messages
|
@@ -1,7 +1,7 @@
|
|
1
|
-
sonusai/__init__.py,sha256=
|
1
|
+
sonusai/__init__.py,sha256=uIuqSf_XWSVHTj4Q7bfJaO7uK1C25XpSK90DWMRKyx4,3773
|
2
2
|
sonusai/aawscd_probwrite.py,sha256=QZLMQrmPr3OjZ06buyYDwlnk9YPCpyr4KHkBjPsiqjU,3700
|
3
|
-
sonusai/audiofe.py,sha256=
|
4
|
-
sonusai/calc_metric_spenh.py,sha256=
|
3
|
+
sonusai/audiofe.py,sha256=un6fbS1fHWo9rpgRYG6SdBjaCWuxLkDKtg6N_ZkC1dk,19457
|
4
|
+
sonusai/calc_metric_spenh.py,sha256=UW4ItryjYgb4NHkwki9LHvyDBwdIHIARc1yT6yCPJno,50084
|
5
5
|
sonusai/config/__init__.py,sha256=NeXdBQiuRKIm77pK9WHaxkdst9-jwhX1IDrHvpZecpI,52
|
6
6
|
sonusai/config/config.py,sha256=nM1W7dQXBWMdMLrgh3o7_cEItztFf1UTW-4faM0hIqY,1692
|
7
7
|
sonusai/config/config.yml,sha256=9y8wWXemU8tnvm_O21treyCpZF85QzokHsHQ8yl6IfE,283
|
@@ -20,10 +20,10 @@ sonusai/deprecated/tplot.py,sha256=0p238DvTaP4oU9y-dp0JdLaTV4TKrooAwbx7zdz_QAc,1
|
|
20
20
|
sonusai/doc/__init__.py,sha256=KyQ26Um0RM8A3GYsb_tbFH64RwpoAw6lja2f_moUWas,33
|
21
21
|
sonusai/doc/doc.py,sha256=vyEfiUNd--F14Eel-u1EY4mfvHUXJrGrV3xKKExUiC4,19272
|
22
22
|
sonusai/doc.py,sha256=ZgFSSI56oNDb-yC3xi-RHMClMjryR2VrgGyi3ggX8gM,1098
|
23
|
-
sonusai/genft.py,sha256=
|
24
|
-
sonusai/genmetrics.py,sha256=
|
25
|
-
sonusai/genmix.py,sha256=
|
26
|
-
sonusai/genmixdb.py,sha256=
|
23
|
+
sonusai/genft.py,sha256=yiADvi0J-Fy4kNpNOEB3wVvU9RZowGvOsCTJndQYXFw,5580
|
24
|
+
sonusai/genmetrics.py,sha256=9l7g_DAKa126RGq23-Wilzdh1M3QHCCeNfUVYaQS1mU,6193
|
25
|
+
sonusai/genmix.py,sha256=gcmqcPqZ1Vz_TtZMp29L8cGnqTK5jcw0cAOc16NOR9A,5753
|
26
|
+
sonusai/genmixdb.py,sha256=VDQMF6JHcHc-yJAZ1Se3CM3ac8fFKIgnaxv4e5jdE1I,11281
|
27
27
|
sonusai/ir_metric.py,sha256=nxS_mARPSZG5Y0G3L8HysOnkPj4v-RGxAxAVBYe-gJI,19600
|
28
28
|
sonusai/lsdb.py,sha256=86t6PpsyardRa6VcSJ-KyU1NiTmlg59VUlcSTptJbn0,5078
|
29
29
|
sonusai/main.py,sha256=72feJv5XEVJE_CQatmNIL1VD9ca-Mo0QNDbXxLrHrbQ,2619
|
@@ -44,7 +44,7 @@ sonusai/metrics/class_summary.py,sha256=mQbMxQ8EtFIN7S2h7A4Dk0X4XF_CIxKk3W8zZMmp
|
|
44
44
|
sonusai/metrics/confusion_matrix_summary.py,sha256=lhd8TyHVMC03khX85h_D75XElmawx56KkqpX3X2O2gQ,3133
|
45
45
|
sonusai/metrics/one_hot.py,sha256=aKc-xYd4zWIjbmoQikIcQ6BJB1k-68XKTg8eJCacHTU,13906
|
46
46
|
sonusai/metrics/snr_summary.py,sha256=qKHctpmvGeu2cmjTG7iQPX1lvVUEtEnCIKwUGu6VrEQ,5773
|
47
|
-
sonusai/metrics_summary.py,sha256=
|
47
|
+
sonusai/metrics_summary.py,sha256=jtSwHomw23qwTYfzjFo_JmqzrkZcts1CMFFzTmJCmWk,12189
|
48
48
|
sonusai/mixture/__init__.py,sha256=_vepE2uhAGKHIujPWxfGDeaWHP5yKLf5BjXkU9ZereA,1258
|
49
49
|
sonusai/mixture/audio.py,sha256=JyrVtVPLH3aTXFgyl446f5uVHxlFRa4aBaSPYaMdg80,5814
|
50
50
|
sonusai/mixture/class_balancing.py,sha256=lubicVCzxs4TMh2dZSsuIffkLkk1gmwjmwtrtQ27BVQ,3638
|
@@ -59,7 +59,7 @@ sonusai/mixture/helpers.py,sha256=dmyHwf1C5dZjYOd11kVV16KI33CaM-dU_fyaxOrrKt8,11
|
|
59
59
|
sonusai/mixture/ir_delay.py,sha256=aiC23HMWQ08-v5wORgMx1_DOJSdh4kunULqiQ-SGuMo,2026
|
60
60
|
sonusai/mixture/ir_effects.py,sha256=PqiqD4PS42-7kD6ESnsZi2a3tnKCFa4E0xqUujRBvGg,2152
|
61
61
|
sonusai/mixture/log_duration_and_sizes.py,sha256=3ekS27IMKlnxIkQAmprzmBnzHOpRjZh3d7maL2VqWQU,927
|
62
|
-
sonusai/mixture/mixdb.py,sha256=
|
62
|
+
sonusai/mixture/mixdb.py,sha256=zGFagqRIV9uX2QiP795lyN29AarGnZgeKTdUIBcuyfY,86305
|
63
63
|
sonusai/mixture/pad_audio.py,sha256=KNxVQAejA0hblLOnMJgLS6lFaeE0n3tWQ5rclaHBnIY,1015
|
64
64
|
sonusai/mixture/resample.py,sha256=jXqH6FrZ0mlhQ07XqPx88TT9elu3HHVLw7Q0a7Lh5M4,221
|
65
65
|
sonusai/mixture/sox_effects.py,sha256=tndS9qrh3eJOTUPrufyWHCt3UqjbPuh81I4Lo4MNmDg,5328
|
@@ -75,8 +75,8 @@ sonusai/mixture/truth_functions/metrics.py,sha256=Mu6o4Hf-I0-f-dVA_egFBUvf1OBj5v
|
|
75
75
|
sonusai/mixture/truth_functions/phoneme.py,sha256=PhSev7PNDOECcdjnCwiISDZlXQwAiOdk_hD0p3eoXN4,763
|
76
76
|
sonusai/mixture/truth_functions/sed.py,sha256=bMYHLBNPfzo4K-22_iGNi2NwDAG82vNtlDioA8VqcOo,3750
|
77
77
|
sonusai/mixture/truth_functions/target.py,sha256=06zNRu4aD7TReZiaq0HQgukqOrYr1sDgYhHCTIPV1Es,4913
|
78
|
-
sonusai/mkwav.py,sha256=
|
79
|
-
sonusai/onnx_predict.py,sha256=
|
78
|
+
sonusai/mkwav.py,sha256=CExhCtnCvWm2pOS0JW_1FL0Te63JC_WbgA78tS4GB1Q,4200
|
79
|
+
sonusai/onnx_predict.py,sha256=w_gyvxWlDIxj0ySG3c1y8bMV7xlPb-ecVUtun_LInms,15781
|
80
80
|
sonusai/queries/__init__.py,sha256=gB7mgKVg8nIIgH-M1Oivoxkc3TGieOlIFzRHMwBQmrY,277
|
81
81
|
sonusai/queries/queries.py,sha256=HLbwbd7OSXKO-IH6LxKzpr98_vfNlNQXIKZSUvQ98lw,7702
|
82
82
|
sonusai/speech/__init__.py,sha256=vqAymCBPjMUSM4OZKHTai6BYwXsOBlf_G_vOhELVf8I,133
|
@@ -88,7 +88,6 @@ sonusai/speech/timit.py,sha256=73T1eOQcA1FfvpCGN8gC4iP56vt4KWcDjLnlkVgdZ9U,4099
|
|
88
88
|
sonusai/speech/types.py,sha256=4eKVPAktpkIrZ2qoVp2iT45zxTVNocQEGT6O_Zlub_w,214
|
89
89
|
sonusai/speech/vctk.py,sha256=WInvRRRkZCW6t_NcZAJffJzgCbyetal-j2w0kKX5SDw,1527
|
90
90
|
sonusai/speech/voxceleb.py,sha256=Uu1kB1krf8hess1yuvGbYfV_VgYhklEyoz4I7KfrVpw,2658
|
91
|
-
sonusai/summarize_metric_spenh.py,sha256=Zha0PZGZ_NznPeHh8rjVIaWR7ac4MEIlijci1uikiT0,1870
|
92
91
|
sonusai/utils/__init__.py,sha256=4XB-62-4Dg_XgZ6Ip2fEOBJ0_oQff6jndYl2rlzl6XE,2699
|
93
92
|
sonusai/utils/asl_p56.py,sha256=zH82RI7h399ZYFOOiOC35iv_qi0KhXpmG5uItWB8n78,3854
|
94
93
|
sonusai/utils/asr.py,sha256=w5xSBpA2wibzsiCWzdSm1m3LwNd54dcJMMLBWN33FJs,2818
|
@@ -132,7 +131,7 @@ sonusai/utils/tokenized_shell_vars.py,sha256=EDrrAgz5lJ0RBAjLcTJt1MeyjhbNZiqXkym
|
|
132
131
|
sonusai/utils/write_audio.py,sha256=IHzrJoFtFcea_J6wo6QSiojRkgnNOzAEcg-z0rFV7nU,810
|
133
132
|
sonusai/utils/yes_or_no.py,sha256=0h1okjXmDNbJp7rZJFR2V-HFU1GJDm3YFTUVmYExkOU,263
|
134
133
|
sonusai/vars.py,sha256=m8pdgfR4A6A9TCGf_rok6jPAT5BgrEsYXTSISIh1nrI,1163
|
135
|
-
sonusai-1.0.
|
136
|
-
sonusai-1.0.
|
137
|
-
sonusai-1.0.
|
138
|
-
sonusai-1.0.
|
134
|
+
sonusai-1.0.8.dist-info/METADATA,sha256=UABc8ZNaqTCnFNoOgmRokBRF9G7RI58MDP1B081075c,2652
|
135
|
+
sonusai-1.0.8.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
136
|
+
sonusai-1.0.8.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
|
137
|
+
sonusai-1.0.8.dist-info/RECORD,,
|
@@ -1,65 +0,0 @@
|
|
1
|
-
"""sonusai summarize_metric_spenh
|
2
|
-
|
3
|
-
usage: summarize_metric_spenh [-hr] [-s SORT] LOC
|
4
|
-
|
5
|
-
options:
|
6
|
-
-h, --help
|
7
|
-
-s SORT, --sort SORT Sort by SORT column. [default: MIXID]
|
8
|
-
-r, --reverse Reverse sort order.
|
9
|
-
|
10
|
-
Summarize speech enhancement metrics results using data generated by SonusAI calc_metric_spenh.
|
11
|
-
|
12
|
-
Inputs:
|
13
|
-
LOC A SonusAI calc_metric_spenh results directory.
|
14
|
-
|
15
|
-
"""
|
16
|
-
|
17
|
-
|
18
|
-
def summarize_metric_spenh(location: str, by: str = "MIXID", reverse: bool = False) -> str:
|
19
|
-
import glob
|
20
|
-
|
21
|
-
import pandas as pd
|
22
|
-
|
23
|
-
files = sorted(glob.glob(location + "/*_metric_spenh.txt"))
|
24
|
-
need_header = True
|
25
|
-
header = ["MIXID"]
|
26
|
-
data = []
|
27
|
-
for file in files:
|
28
|
-
with open(file) as f:
|
29
|
-
for i, line in enumerate(f):
|
30
|
-
if i == 1 and need_header:
|
31
|
-
need_header = False
|
32
|
-
header.extend(line.strip().split())
|
33
|
-
elif i == 2:
|
34
|
-
data.append(line.strip().split())
|
35
|
-
break
|
36
|
-
|
37
|
-
df = pd.DataFrame(data, columns=header) # pyright: ignore [reportArgumentType]
|
38
|
-
df[header[0:-2]] = df[header[0:-2]].apply(pd.to_numeric, errors="coerce")
|
39
|
-
return df.sort_values(by=by, ascending=not reverse).to_string(index=False)
|
40
|
-
|
41
|
-
|
42
|
-
def main():
|
43
|
-
from docopt import docopt
|
44
|
-
|
45
|
-
from sonusai import __version__ as sai_version
|
46
|
-
from sonusai.utils import trim_docstring
|
47
|
-
|
48
|
-
args = docopt(trim_docstring(__doc__), version=sai_version, options_first=True)
|
49
|
-
|
50
|
-
by = args["--sort"]
|
51
|
-
reverse = args["--reverse"]
|
52
|
-
location = args["LOC"]
|
53
|
-
|
54
|
-
print(summarize_metric_spenh(location, by, reverse))
|
55
|
-
|
56
|
-
|
57
|
-
if __name__ == "__main__":
|
58
|
-
from sonusai import exception_handler
|
59
|
-
from sonusai.utils import register_keyboard_interrupt
|
60
|
-
|
61
|
-
register_keyboard_interrupt()
|
62
|
-
try:
|
63
|
-
main()
|
64
|
-
except Exception as e:
|
65
|
-
exception_handler(e)
|
File without changes
|
File without changes
|