Skip to main content

A Pytorch port of Tensorflow's VGGish embedding model.

Project description

Torch VGGish

A PyTorch port of VGGish1, a feature embedding frontend for audio classification models. The weights are ported directly from the tensorflow model, so embeddings created using torchvggish will be identical.

Quick start

There are two options: you can install the last stable version from pypi, or clone this repo and install.

# optional: create virtual env
cd torchvggish && python3 -m venv .env
source activate .env/bin/activate

pip install -i https://test.pypi.org/simple/ torchvggish==0.1

# OR get the latest version
git clone git@github.com:harritaylor/torchvggish.git
pip install -r requirements.txt

Usage

Barebones example of creating embeddings from an example wav file:

from torchvggish import vggish, vggish_input

# Initialise model and download weights
embedding_model = vggish()
embedding_model.eval()

example = vggish_input.wavfile_to_examples("example.wav")
embeddings = embedding_model.forward(example)

1. S. Hershey et al., ‘CNN Architectures for Large-Scale Audio Classification’,\ in International Conference on Acoustics, Speech and Signal Processing (ICASSP),2017\ Available: https://arxiv.org/abs/1609.09430, https://ai.google/research/pubs/pub45611

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

torchvggish-0.1.tar.gz (9.7 kB view details)

Uploaded Source

File details

Details for the file torchvggish-0.1.tar.gz.

File metadata

  • Download URL: torchvggish-0.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for torchvggish-0.1.tar.gz
Algorithm Hash digest
SHA256 14c5ee9bfc524ff6dcfd5e48392ef469cdca2e1c8ef7f4318512b11a0d83c342
MD5 3588f637aeadfe23e3dba37ba9c1cb5e
BLAKE2b-256 8d01d8e7f49379016816f1828064b16bc53d6c3a3474d2062e67ec8840294961

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