|
|
@ -1,4 +1,4 @@ |
|
|
|
#Japanese Image-Text Retrieval Embdding with CLIP |
|
|
|
# Japanese Image-Text Retrieval Embdding with CLIP |
|
|
|
|
|
|
|
*author: David Wang* |
|
|
|
|
|
|
@ -28,15 +28,15 @@ import towhee |
|
|
|
|
|
|
|
towhee.glob('./teddy.jpg') \ |
|
|
|
.image_decode() \ |
|
|
|
.image_text_embedding.japanese_clip(model_name='clip_vit_b32', modality='image') \ |
|
|
|
.image_text_embedding.japanese_clip(model_name='japanese-clip-vit-b-16', modality='image') \ |
|
|
|
.show() |
|
|
|
|
|
|
|
towhee.dc(["スケートボードに乗っているテディベア。"]) \ |
|
|
|
.image_text_embedding.japanese_clip(model_name='clip_vit_b32', modality='text') \ |
|
|
|
.image_text_embedding.japanese_clip(model_name='japanese-clip-vit-b-16', modality='text') \ |
|
|
|
.show() |
|
|
|
``` |
|
|
|
<img src="https://towhee.io/image-text-embedding/clip/raw/branch/main/vec1.png" alt="result1" style="height:20px;"/> |
|
|
|
<img src="https://towhee.io/image-text-embedding/clip/raw/branch/main/vec2.png" alt="result2" style="height:20px;"/> |
|
|
|
<img src="./vec1.png" alt="result1" style="height:20px;"/> |
|
|
|
<img src="./vec2.png" alt="result2" style="height:20px;"/> |
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
@ -45,17 +45,17 @@ import towhee |
|
|
|
|
|
|
|
towhee.glob['path']('./teddy.jpg') \ |
|
|
|
.image_decode['path', 'img']() \ |
|
|
|
.image_text_embedding.japanese_clip['img', 'vec'](model_name='clip_vit_b32', modality='image') \ |
|
|
|
.image_text_embedding.japanese_clip['img', 'vec'](model_name='japanese-clip-vit-b-16', modality='image') \ |
|
|
|
.select['img', 'vec']() \ |
|
|
|
.show() |
|
|
|
|
|
|
|
towhee.dc['text'](["スケートボードに乗っているテディベア。"]) \ |
|
|
|
.image_text_embedding.japanese_clip['text','vec'](model_name='clip_vit_b32', modality='text') \ |
|
|
|
.image_text_embedding.japanese_clip['text','vec'](model_name='japanese-clip-vit-b-16', modality='text') \ |
|
|
|
.select['text', 'vec']() \ |
|
|
|
.show() |
|
|
|
``` |
|
|
|
<img src="https://towhee.io/image-text-embedding/clip/raw/branch/main/tabular1.png" alt="result1" style="height:60px;"/> |
|
|
|
<img src="https://towhee.io/image-text-embedding/clip/raw/branch/main/tabular2.png" alt="result2" style="height:60px;"/> |
|
|
|
<img src="./tabular1.png" alt="result1" style="height:60px;"/> |
|
|
|
<img src="./tabular2.png" alt="result2" style="height:60px;"/> |
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|