Browse Source
Update code
Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
1 changed files with
0 additions and
13 deletions
-
faiss.py
|
|
@ -18,19 +18,6 @@ class Faiss(PyOperator): |
|
|
|
The path to faiss index file(defaults to './index.bin') or faiss index. |
|
|
|
kwargs |
|
|
|
The kwargs with index.search, refer to https://github.com/facebookresearch/faiss/wiki. And the parameter `k` defaults to 10. |
|
|
|
|
|
|
|
Examples: |
|
|
|
|
|
|
|
>>> import towhee |
|
|
|
>>> res = ( |
|
|
|
... towhee.glob['path']('./*.jpg') |
|
|
|
... .image_decode['path', 'img']() |
|
|
|
... .image_embedding.timm['img', 'vec'](model_name='resnet50') |
|
|
|
... .faiss_search['vec', 'results'](findex='./faiss/faiss.index') |
|
|
|
... .to_list() |
|
|
|
... ) |
|
|
|
[<Entity dict_keys(['path', 'img', 'vec', 'results'])>, |
|
|
|
<Entity dict_keys(['path', 'img', 'vec', 'results'])>] |
|
|
|
""" |
|
|
|
def __init__(self, findex, **kwargs): |
|
|
|
self.faiss_index = findex |
|
|
|