关于保存特征的一些代码
This commit is contained in:
23
test/outfit_matcher_milvus/3.create index.py
Normal file
23
test/outfit_matcher_milvus/3.create index.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from pymilvus import MilvusClient, Collection
|
||||
|
||||
client = MilvusClient(
|
||||
uri="http://10.1.1.240:19530",
|
||||
token="root:Milvus",
|
||||
db_name="mixi"
|
||||
)
|
||||
|
||||
index_params = client.prepare_index_params()
|
||||
index_params.add_index(
|
||||
field_name="id",
|
||||
index_type="STL_SORT"
|
||||
)
|
||||
index_params.add_index(
|
||||
field_name="vector",
|
||||
index_type="IVF_FLAT",
|
||||
metric_type="L2",
|
||||
params={"nlist": 1024}
|
||||
)
|
||||
client.create_index(
|
||||
collection_name="mixi_outfit",
|
||||
index_params=index_params
|
||||
)
|
||||
Reference in New Issue
Block a user