Skip to main content

A lightweight library of Frechet Audio Distance calculation.

Project description

Frechet Audio Distance in PyTorch

A lightweight library of Frechet Audio Distance calculation.

Currently, we support embedding from:

Installation

pip install frechet_audio_distance

Demo

from frechet_audio_distance import FrechetAudioDistance

# to use `vggish`
frechet = FrechetAudioDistance(
    model_name="vggish",
    use_pca=False, 
    use_activation=False,
    verbose=False,
    dtype="float32"
)
# to use `PANN`
frechet = FrechetAudioDistance(
    model_name="pann",
    use_pca=False, 
    use_activation=False,
    verbose=False,
    dtype="float32"
)
fad_score = frechet.score("/path/to/background/set", "/path/to/eval/set")

Result validation

Test 1: Distorted sine waves on vggish (as provided here) [notes]

FAD scores comparison w.r.t. to original implementation in google-research/frechet-audio-distance

baseline vs test1 baseline vs test2
google-research 12.4375 4.7680
frechet_audio_distance 12.7398 4.9815

Test 2: Distorted sine waves on PANN

baseline vs test1 baseline vs test2
frechet_audio_distance 0.000465 0.00008594

To contribute

  • Run python3 -m build to build your version locally. The built wheel should be in dist/.
  • pip install your local wheel version, and run pytest test/ to validate your changes.

References

VGGish in PyTorch: https://github.com/harritaylor/torchvggish

Frechet distance implementation: https://github.com/mseitzer/pytorch-fid

Frechet Audio Distance paper: https://arxiv.org/abs/1812.08466

PANN paper: https://arxiv.org/abs/1912.10211

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frechet_audio_distance-0.1.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

frechet_audio_distance-0.1.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file frechet_audio_distance-0.1.1.tar.gz.

File metadata

File hashes

Hashes for frechet_audio_distance-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ea8ec0f0aa8c8789d5bf1001b378efa52e7adf8338c09acbf16732d86f37b98
MD5 9d2199bb71c7a557286ca080fb3f1622
BLAKE2b-256 b5fb670bbeaaa226b930639a8a19f34822bf7fbb53f044408c772b8186d86272

See more details on using hashes here.

File details

Details for the file frechet_audio_distance-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for frechet_audio_distance-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eebd0cae037e9d0c0d65ce499dafd06c393bbc2bc199df6e0e14b85736f28217
MD5 fe9013e40df7cbaa6e34c72095f23dbc
BLAKE2b-256 f7cccc8818258249428f3c7e6e799a4aafa8c2732eaafef4b41b4edb4bbacca8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page