logo
Browse Source

Update

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 1 year ago
parent
commit
0e972da129
  1. 35
      README.md
  2. BIN
      result.png

35
README.md

@ -18,37 +18,22 @@ This operator extracts features for audio with [data2vec](https://arxiv.org/abs/
Generate embeddings for the audio "test.wav".
*Write the pipeline in simplified style*:
*Write a pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
(
towhee.glob('test.wav')
.audio_decode.ffmpeg()
.runas_op(func=lambda x:[y[0] for y in x])
.audio_embedding.data2vec()
.show()
)
```
from towhee.dc2 import pipe, ops, DataCollection
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
(
towhee.glob['path']('test.wav')
.audio_decode.ffmpeg['path', 'frames']()
.runas_op['frames', 'frames'](func=lambda x:[y[0] for y in x])
.audio_embedding.data2vec['frames', 'vecs'](model_name="facebook/data2vec-audio-base-960h")
.select['path', 'vecs']()
.show()
p = (
pipe.input('path')
.map('path', 'frame', ops.audio_decode.ffmpeg(sample_rate=16000))
.map('frame', 'vecs', ops.audio_embedding.data2vec(model_name='facebook/data2vec-audio-base-960h'))
.output('path', 'vecs')
)
DataCollection(p('test.wav')).show()
```
<img src="./result.png" width="800px"/>
<br />

BIN
result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Loading…
Cancel
Save