|
@ -17,7 +17,7 @@ This operator extracts features for image or text with [CLIP](https://arxiv.org/ |
|
|
|
|
|
|
|
|
## Code Example |
|
|
## Code Example |
|
|
|
|
|
|
|
|
Load an image from path './dog.jpg' to generate an image embedding. |
|
|
|
|
|
|
|
|
Load an image from path './teddy.jpg' to generate an image embedding. |
|
|
Read the text 'a dog' to generate an text embedding. |
|
|
Read the text 'a dog' to generate an text embedding. |
|
|
*Write the pipeline in simplified style*: |
|
|
*Write the pipeline in simplified style*: |
|
|
|
|
|
|
|
@ -34,7 +34,8 @@ towhee.dc(["a dog"]) \ |
|
|
.towhee.clip(name='ViT-B/32', modality='text') \ |
|
|
.towhee.clip(name='ViT-B/32', modality='text') \ |
|
|
.show() |
|
|
.show() |
|
|
``` |
|
|
``` |
|
|
<img src="https://towhee.io/image-embedding/dolg/raw/branch/main/result1.png" alt="result1" style="height:20px;"/> |
|
|
|
|
|
|
|
|
<img src="https://towhee.io/towhee/clip/raw/branch/main/vec1.png" alt="result1" style="height:20px;"/> |
|
|
|
|
|
<img src="https://towhee.io/towhee/clip/raw/branch/main/vec2.png" alt="result2" style="height:20px;"/> |
|
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
@ -53,7 +54,7 @@ towhee.dc(["a dog"]) \ |
|
|
.select['data', 'vec']() \ |
|
|
.select['data', 'vec']() \ |
|
|
.show() |
|
|
.show() |
|
|
``` |
|
|
``` |
|
|
<img src="https://towhee.io/image-embedding/dolg/raw/branch/main/result2.png" alt="result2" style="height:60px;"/> |
|
|
|
|
|
|
|
|
<img src="https://towhee.io/towhee/clip/raw/branch/main/tabular1.png" alt="result1" style="height:60px;"/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
<br /> |
|
@ -82,8 +83,7 @@ Create the operator via the following factory method |
|
|
|
|
|
|
|
|
## Interface |
|
|
## Interface |
|
|
|
|
|
|
|
|
An image embedding operator takes a [towhee image](link/to/towhee/image/api/doc) as input. |
|
|
|
|
|
It uses the pre-trained model specified by model name to generate an image embedding in ndarray. |
|
|
|
|
|
|
|
|
An image-text embedding operator takes a [towhee image](link/to/towhee/image/api/doc) or string as input and generate an image embedding in ndarray. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:** |
|
|
**Parameters:** |
|
|