from pymilvus import connections, Collection
|
|
import qwen_ollama
|
|
config = {}
|
with open('./conf.txt', 'r', encoding='utf-8') as file:
|
for line in file:
|
# 去除每行的首尾空白字符(包括换行符)
|
line = line.strip()
|
# 跳过空行
|
if not line:
|
continue
|
# 分割键和值
|
if '=' in line:
|
key, value = line.split('=', 1)
|
# 去除键和值的首尾空白字符
|
key = key.strip()
|
value = value.strip()
|
# 将键值对添加到字典中
|
config[key] = value
|
|
# 初始化Milvus集合
|
connections.connect("default", host=config.get("milvusurl"), port=config.get("milvusport"))
|
# 加载集合
|
collection = Collection(name="smartobject")
|
collection.load()
|
|
detect = qwen_ollama.detect_tasks()
|
detect._thread_name = f"1" # 设置名称
|
detect.init_logging(f"1")
|
# 初始化Milvus集合
|
detect.collection = collection
|
camera_data = [458671636370953916,458671636370953918,458671636370953922,458671636370953977]
|
for image_id in camera_data:
|
print(detect.tark_do(image_id, config.get("ollamaurl"), config.get("ragurl"),config.get("ollamamode")))
|