diff --git a/README.md b/README.md index e409733..1aaa26a 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,19 @@ This operator extracts features for image with [data2vec](https://arxiv.org/abs/ Load an image from path './towhee.jpg' to generate an image embedding. - *Write the pipeline in simplified style*: +*Write a pipeline with explicit inputs/outputs name specifications:* ```python -import towhee +from towhee.dc2 import pipe, ops, DataCollection -towhee.glob('./towhee.jpg') \ - .image_decode.cv2() \ - .image_embedding.data2vec(model_name='facebook/data2vec-vision-base-ft1k') \ - .show() +p = ( + pipe.input('path') + .map('path', 'img', ops.image_decode()) + .map('img', 'vec', ops.image_embedding.data2vec(model_name='facebook/data2vec-vision-base-ft1k')) + .output('img', 'vec') +) -``` -result1 - -*Write a same pipeline with explicit inputs/outputs name specifications:* - -```python -import towhee - -towhee.glob['path']('./towhee.jpg') \ - .image_decode.cv2['path', 'img']() \ - .image_embedding.data2vec['img', 'vec'](model_name='facebook/data2vec-vision-base-ft1k') \ - .select['img', 'vec']() \ - .show() +DataCollection(p('towhee.jpeg')).show() ``` result2