copied
Readme
Files and versions
Updated 4 months ago
audio-embedding
Audio Embedding with CLMR
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 2s. This operator is built on top of the original implementation of CLMR. The default model weight provided is pretrained on Magnatagatune Dataset with SampleCNN.
Code Example
Generate embeddings for the audio "test.wav".
Write a pipeline with explicit inputs/outputs name specifications:
from towhee import pipe, ops, DataCollection
p = (
pipe.input('path')
.map('path', 'frame', ops.audio_decode.ffmpeg())
.map('frame', 'vecs', ops.audio_embedding.clmr())
.output('path', 'vecs')
)
DataCollection(p('./test.wav')).show()
Factory Constructor
Create the operator via the following factory method
audio_embedding.clmr(framework="pytorch")
Parameters:
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 3s.
Returns:
numpy.ndarray
Audio embeddings in shape (num_clips, 512). Each embedding stands for features of an audio clip with length of 2.7s.
More Resources
- 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.
- 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
a3b11b1efd
| 24 Commits | ||
---|---|---|---|
.gitattributes |
1.1 KiB
|
3 years ago | |
README.md |
3.3 KiB
|
4 months ago | |
__init__.py |
688 B
|
3 years ago | |
clmr_checkpoint.py |
1.2 KiB
|
3 years ago | |
clmr_checkpoint_10000.pt |
10 MiB
|
3 years ago | |
clmr_magnatagatune.py |
4.7 KiB
|
2 years ago | |
clmr_model.py |
1.0 KiB
|
3 years ago | |
requirements.txt |
31 B
|
2 years ago | |
result.png |
5.8 KiB
|
2 years ago | |
sample_cnn.py |
2.5 KiB
|
3 years ago |