From f0abd50b2c472f3b996421529d919b2bc30bf368 Mon Sep 17 00:00:00 2001 From: Etsushi Nozaki Date: Wed, 13 Dec 2023 23:13:20 +0900 Subject: [PATCH] Explicitly specify the paths for onnx models relative to the path of dnsmos_local.py By explicitly specifying paths, it is easier to run dnsmos_local.py from other directories. --- DNSMOS/dnsmos_local.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DNSMOS/dnsmos_local.py b/DNSMOS/dnsmos_local.py index e32032e9754..5d330d8958f 100644 --- a/DNSMOS/dnsmos_local.py +++ b/DNSMOS/dnsmos_local.py @@ -102,12 +102,13 @@ def __call__(self, fpath, sampling_rate, is_personalized_MOS): def main(args): models = glob.glob(os.path.join(args.testset_dir, "*")) audio_clips_list = [] - p808_model_path = os.path.join('DNSMOS', 'model_v8.onnx') + dnsmos_abs_path = os.path.dirname(os.path.abspath(__file__)) + p808_model_path = os.path.join(dnsmos_abs_path, 'DNSMOS', 'model_v8.onnx') if args.personalized_MOS: - primary_model_path = os.path.join('pDNSMOS', 'sig_bak_ovr.onnx') + primary_model_path = os.path.join(dnsmos_abs_path, 'pDNSMOS', 'sig_bak_ovr.onnx') else: - primary_model_path = os.path.join('DNSMOS', 'sig_bak_ovr.onnx') + primary_model_path = os.path.join(dnsmos_abs_path, 'DNSMOS', 'sig_bak_ovr.onnx') compute_score = ComputeScore(primary_model_path, p808_model_path)