Browse Source
update the readme.
Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb
2 years ago
1 changed files with
9 additions and
19 deletions
-
README.md
|
@ -18,28 +18,18 @@ This operator generates the caption with [ExpansionNet v2](https://arxiv.org/abs |
|
|
|
|
|
|
|
|
Load an image from path './image.jpg' to generate the caption. |
|
|
Load an image from path './image.jpg' to generate the caption. |
|
|
|
|
|
|
|
|
*Write the pipeline in simplified style*: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
```python |
|
|
```python |
|
|
import towhee |
|
|
|
|
|
|
|
|
|
|
|
towhee.glob('./image.jpg') \ |
|
|
|
|
|
.image_decode() \ |
|
|
|
|
|
.image_captioning.expansionnet_v2(model_name='expansionnet_rf') \ |
|
|
|
|
|
.show() |
|
|
|
|
|
``` |
|
|
|
|
|
<img src="./cap.png" alt="result1" style="height:20px;"/> |
|
|
|
|
|
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
|
|
|
|
```python |
|
|
|
|
|
import towhee |
|
|
|
|
|
|
|
|
p = ( |
|
|
|
|
|
pipe.input('url') |
|
|
|
|
|
.map('url', 'img', ops.image_decode.cv2_rgb()) |
|
|
|
|
|
.map('img', 'text', ops.image_captioning.expansionnet_v2(model_name='expansionnet_rf')) |
|
|
|
|
|
.output('img', 'text') |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
towhee.glob['path']('./image.jpg') \ |
|
|
|
|
|
.image_decode['path', 'img']() \ |
|
|
|
|
|
.image_captioning.expansionnet_v2['img', 'text'](model_name='expansionnet_rf') \ |
|
|
|
|
|
.select['img', 'text']() \ |
|
|
|
|
|
.show() |
|
|
|
|
|
|
|
|
DataCollection(p('./image.jpg')).show() |
|
|
``` |
|
|
``` |
|
|
<img src="./tabular.png" alt="result2" style="height:60px;"/> |
|
|
<img src="./tabular.png" alt="result2" style="height:60px;"/> |
|
|
|
|
|
|
|
|