Browse Source
Update readme with new pipe
Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
3 changed files with
13 additions and
14 deletions
-
README.md
-
result.png
-
BIN
result1.png
|
|
@ -17,25 +17,26 @@ The nnfp operator is suitable for audio fingerprinting. |
|
|
|
|
|
|
|
## Code Example |
|
|
|
|
|
|
|
Generate embeddings for the audio "test.wav". |
|
|
|
Generate embeddings for the audio "test.wav". |
|
|
|
|
|
|
|
*Write the pipeline in simplified style*: |
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
- option 1 (towhee>=0.9.0): |
|
|
|
```python |
|
|
|
import towhee |
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
|
|
|
|
( |
|
|
|
towhee.glob('test.wav') |
|
|
|
.audio_decode.ffmpeg() |
|
|
|
.runas_op(func=lambda x:[y[0] for y in x]) |
|
|
|
.audio_embedding.nnfp() # use default model |
|
|
|
.show() |
|
|
|
p = ( |
|
|
|
pipe.input('path') |
|
|
|
.map('path', 'frame', ops.audio_decode.ffmpeg()) |
|
|
|
.map('frame', 'vecs', ops.audio_embedding.nnfp(device='cpu')) |
|
|
|
.output('path', 'vecs') |
|
|
|
) |
|
|
|
``` |
|
|
|
<img src="./result1.png" width="800px"/> |
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
DataCollection(p('test.wav')).show() |
|
|
|
``` |
|
|
|
<img src="./result.png" width="800px"/> |
|
|
|
|
|
|
|
- option 2: |
|
|
|
```python |
|
|
|
import towhee |
|
|
|
|
|
|
@ -48,8 +49,6 @@ import towhee |
|
|
|
.show() |
|
|
|
) |
|
|
|
``` |
|
|
|
<img src="./result2.png" width="800px"/> |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
## Factory Constructor |
|
|
|
Width:
|
Height:
|
Size: 5.9 KiB
Width:
|
Height:
|
Size: 5.9 KiB
|
Width:
|
Height:
|
Size: 3.8 KiB
|