Skip to main content

VGGish: A VGG-like audio classification model

This repository provides a VGGish model, implemented in Keras with tensorflow backend (since tf.slim is deprecated, I think we should have an up-to-date interface). This repository is developed based on the model for AudioSet. For more details, please visit the slim version.

Install

pip install vggish-keras

Weights will be automatically downloaded when installing via pip.

Currently - this relies on a pending change to pumpp in https://github.com/bmcfee/pumpp/pull/123. To get those changes, you need

pip install git+https://github.com/beasteers/pumpp@tf_keras

Usage

import librosa
import numpy as np
import vggish_keras as vgk

# define the model
pump = vgk.get_pump()
model = vgk.VGGish(pump)

# transform audio into VGGish embeddings without fc layers
X = pump.transform(librosa.util.example_audio_file())[vgk.params.PUMP_INPUT]
X = np.concatenate([X]*5)
Z = model.predict(X)

# calculate timestamps
op = pump['mel']
ts = np.arange(len(Z)) / op.sr * op.hop_length
assert Z.shape == (5, 512)

Reference:

TODO

  • add fully connected layers
  • add PCA postprocessing (needs fully connected layers and to add PCA params to model)
  • currently, parameters (sample rate, hop size, etc) can be changed globally via vgk.params - I'd like to allow for parameter overrides to be passed to vgk.VGGish

Metadata

Release files for vggish-keras 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vggish-keras 0.0.1
File Size Uploaded Provenance Actions
vggish-keras-0.0.1.tar.gz 5.6 kB Without provenance Details for vggish-keras-0.0.1.tar.gz

Release files / vggish-keras-0.0.1.tar.gz

Download URL vggish-keras-0.0.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
acfb9e5ab07e99b31884874f5105115bca3b158b8fbce92d7e9fe716f86efabc
BLAKE2b-256 checksum
How to use checksums
1cf101c514640e2c1b1f9dced37dcf134fc668b3ce68df3c49cf52cb2aa7805f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for vggish-keras 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page