copied
Readme
Files and versions
Updated 3 months ago
audio-embedding
Audio Embedding with Vggish
Author: Jael Gu
Description
The audio embedding operator converts an input audio into a dense vector which can be used to represent the audio clip's semantics. Each vector represents for an audio clip with a fixed length of around 0.9s. This operator is built on top of VGGish with Pytorch. The model is a VGG variant pre-trained with a large scale of audio dataset AudioSet. As suggested, it is suitable to extract features at high level or warm up a larger model.
Code Example
Generate embeddings for the audio "test.wav".
Write a same pipeline with explicit inputs/outputs name specifications:
from towhee import pipe, ops
p = (
pipe.input('path')
.map('path', 'frame', ops.audio_decode.ffmpeg())
.map('frame', 'vecs', ops.audio_embedding.vggish())
.output('vecs')
)
p('test.wav').get()[0]
| [-0.4931737, -0.40068552, -0.032327592, ...] shape=(10, 128) |
Factory Constructor
Create the operator via the following factory method
audio_embedding.vggish(weights_path=None, framework="pytorch")
Parameters:
weights_path: str
The path to model weights. If None, it will load default model weights.
framework: str
The framework of model implementation. Default value is "pytorch" since the model is implemented in Pytorch.
Interface
An audio embedding operator generates vectors in numpy.ndarray given towhee audio frames.
Parameters:
data: List[towhee.types.audio_frame.AudioFrame]
Input audio data is a list of towhee audio frames. The input data should represent for an audio longer than 0.9s.
Returns:
numpy.ndarray
Audio embeddings in shape (num_clips, 128). Each embedding stands for features of an audio clip with length of 0.9s.
More Resources
- Exploring Multimodal Embeddings with FiftyOne and Milvus - Zilliz blog: This post explored how multimodal embeddings work with Voxel51 and Milvus.
- How to Get the Right Vector Embeddings - Zilliz blog: A comprehensive introduction to vector embeddings and how to generate them with popular open-source models.
- Audio Retrieval Based on Milvus - Zilliz blog: Create an audio retrieval system using Milvus, an open-source vector database. Classify and analyze sound data in real time.
- Evaluating Your Embedding Model - Zilliz blog: Review some practical examples to evaluate different text embedding models.
- Vector Database Use Case: Audio Similarity Search - Zilliz: Building agile and reliable audio similarity search with Zilliz vector database (fully managed Milvus).
- Sparse and Dense Embeddings: A Guide for Effective Information Retrieval with Milvus | Zilliz Webinar: Zilliz webinar covering what sparse and dense embeddings are and when you'd want to use one over the other.
- Sparse and Dense Embeddings: A Guide for Effective Information Retrieval with Milvus | Zilliz Webinar: Zilliz webinar covering what sparse and dense embeddings are and when you'd want to use one over the other.
- An Introduction to Vector Embeddings: What They Are and How to Use Them - Zilliz blog: In this blog post, we will understand the concept of vector embeddings and explore its applications, best practices, and tools for working with embeddings.
Jael Gu
6f3e63947c
| 32 Commits | ||
---|---|---|---|
.gitattributes |
48 B
|
3 years ago | |
README.md |
3.9 KiB
|
3 months ago | |
__init__.py |
686 B
|
2 years ago | |
mel_features.py |
9.6 KiB
|
3 years ago | |
requirements.txt |
60 B
|
2 years ago | |
vggish.pth |
275 MiB
|
3 years ago | |
vggish.py |
3.4 KiB
|
2 years ago | |
vggish_input.py |
3.1 KiB
|
2 years ago | |
vggish_params.py |
2.0 KiB
|
3 years ago |