Giter VIP home page Giter VIP logo

speechmos_tts's Introduction

🎧 SpeechMOS 🎧

Predict subjective speech score with only 2 lines of code, with various MOS prediction systems.

predictor = torch.hub.load("tarepan/SpeechMOS:v1.0.0", "utmos22_strong", trust_repo=True)
score = predictor(wave, sr)
# tensor([3.7730]), good quality speech!

Demo

Predict naturalness (Naturalness Mean-Opinion-Score) of your audio by UTMOS:

import torch
import librosa

wave, sr = librosa.load("<your_audio>.wav", sr=None, mono=True)
predictor = torch.hub.load("tarepan/SpeechMOS:v1.0.0", "utmos22_strong", trust_repo=True)
score = predictor(torch.from_numpy(wave).unsqueeze(0), sr)
# tensor([3.7730])

How to Use

SpeechMOS use torch.hub built-in model loader, so no needs of library importπŸ˜‰
(As general dependencies, SpeechMOS requires Python=>3.10, torch and torchaudio.)

First, instantiate a MOS predictor with model specifier string:

import torch
predictor = torch.hub.load("tarepan/SpeechMOS:v1.0.0", "<model_specifier>", trust_repo=True)

Then, pass tensor of speeches :: (Batch, Time):

waves_tensor = torch.rand((2, 16000)) # Two speeches, each 1 sec (sr=16,000)
score = predictor(waves_tensor, sr=16000)
# tensor([2.0321, 2.0943])

Returned scores :: (Batch,) are each speech's predicted MOS.
If you hope MOS average over speeches (e.g. for TTS model evaluation), just average them:

average_score = score.mean().item()
# 2.0632

Predictors

This repository is reimplementation collection of various MOS prediction systems.
Currently we provide below models:

Model specifier paper
UTMOS strong utmos22_strong Saeki (2022)

Acknowlegements

speechmos_tts's People

Contributors

tarepan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.