You need to enable JavaScript to run this app.
Lake AI Service

Lake AI Service

Copy page
Download PDF
Audio processing
Audio quality scoring (DNSMOS)
Copy page
Download PDF
Audio quality scoring (DNSMOS)

Operator introduction

Description

Audio quality scoring module – evaluates audio quality using the DNSMOS model

Key features

  • Evaluates audio quality using the DNSMOS (Deep Noise Suppression Mean Opinion Score) model
  • Provides scores for three dimensions: overall quality (OVRL), signal quality (SIG), and background noise (BAK)
  • The scoring range is from 1 to 5, with higher scores indicating better audio quality
  • Supports automatic sample rate conversion and audio preprocessing
  • Suitable for scenarios such as speech quality evaluation, audio filtering, and quality control

Explanation of scoring dimensions

  • OVRL (Overall): Overall audio quality score, comprehensively evaluates audibility
  • SIG (Signal): Signal quality score, evaluates the clarity and naturalness of the speech signal
  • BAK (Background): Background noise score, evaluates the degree of interference from background noise

Daft invocation

Operator parameters

Input

Input column name

Note

audio_col

An array containing audio binary data; each element should be a complete audio segment

Output

Structured result array, where each element contains the following fields:

  • ovrl (float): Overall audio quality score, comprehensively evaluates audibility, range from 1.0 to 5.0
  • sig (float): Signal quality score, evaluates the clarity and naturalness of the speech signal, range from 1.0 to 5.0
  • bak (float): Background noise score, evaluates the degree of interference from background noise, range from 1.0 to 5.0

Audio that fails processing returns a structure containing null values

Parameters

If a parameter does not have a default value, it is required

Parameter name

Type

Default value

Description

model_path

str

/opt/las/models

Directory where the local DNSMOS model files are located. Default value: "/opt/las/models"

device

str

cpu

Device for running the model ('cuda' or 'cpu'). Default value: "cpu"

is_personalized_mos

bool

False

Whether to use personalized MOS scoring. Default value: False

Examples

The following code demonstrates how to use Daft to run the operator for audio quality scoring.

from __future__ import annotations

import os

import daft
from daft import col
from daft.las.functions.audio import AudioQualityScore
from daft.las.functions.udf import las_udf

if __name__ == "__main__":
    TOS_TEST_DIR_URL = os.getenv("TOS_TEST_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com")
    model_path = os.getenv("MODEL_PATH", "/opt/las/models")

    if os.getenv("DAFT_RUNNER", "native") == "ray":
        import logging

        import ray

        def configure_logging():
            logging.basicConfig(
                level=logging.INFO,
                format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
                datefmt="%Y-%m-%d %H:%M:%S",
            )
            logging.getLogger("tracing.span").setLevel(logging.WARNING)
            logging.getLogger("daft_io.stats").setLevel(logging.WARNING)
            logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING)

        ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging})
        daft.set_runner_ray()

    daft.set_execution_config(actor_udf_ready_timeout=600)
    daft.set_execution_config(min_cpu_per_task=0)

    samples = {"audio_path": [f"https://{TOS_TEST_DIR_URL}/public/archive/audio_quality_score/test_audio.wav"]}
    df = daft.from_pydict(samples)
    df = df.with_column(
        "audio_quality_score",
        las_udf(
            AudioQualityScore,
            construct_args={"model_path": model_path, "device": "cuda"},
            num_gpus=1,
            batch_size=8,
            concurrency=1,
        )(col("audio_path")),
    )

    df.show()
    # ╭────────────────────────────────┬───────────────────────────────────────────────────╮
    # │ audio_path                     ┆ audio_quality_score                               │
    # │ ---                            ┆ ---                                               │
    # │ String                         ┆ Struct[ovrl: Float64, sig: Float64, bak: Float64] │
    # ╞════════════════════════════════╪═══════════════════════════════════════════════════╡
    # │ https://las-public-data-qa.to… ┆ {ovrl: 1.7469981067293439,                        │
    # │                                ┆ si…                                               │
    # ╰────────────────────────────────┴───────────────────────────────────────────────────╯
Last updated: 2026.05.12 19:06:33