feat 更新响应模板
fix
This commit is contained in:
@@ -23,11 +23,11 @@ DEBUG = False
|
||||
if DEBUG:
|
||||
LOGS_PATH = "logs/"
|
||||
CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv"
|
||||
FACE_CLASSIFIER = "service/generate_image/utils/haarcascade_frontalface_alt.xml"
|
||||
# FACE_CLASSIFIER = "service/generate_image/utils/haarcascade_frontalface_alt.xml"
|
||||
else:
|
||||
LOGS_PATH = "app/logs/"
|
||||
CATEGORY_PATH = "app/service/attribute/config/descriptor/category/category_dis.csv"
|
||||
FACE_CLASSIFIER = 'app/service/generate_image/utils/haarcascade_frontalface_alt.xml'
|
||||
# FACE_CLASSIFIER = 'app/service/generate_image/utils/haarcascade_frontalface_alt.xml'
|
||||
|
||||
# RABBITMQ_ENV = "" # 生产环境
|
||||
# RABBITMQ_ENV = "-dev" # 开发环境
|
||||
@@ -60,9 +60,9 @@ RABBITMQ_PARAMS = {
|
||||
}
|
||||
|
||||
# milvus 配置
|
||||
MILVUS_DB_HOST = "10.1.1.240"
|
||||
MILVUS_URL = "http://10.1.1.240:19530http://127.0.0.1:8000/docs#/design/design_api_design_post"
|
||||
MILVUS_TOKEN = "root:Milvus"
|
||||
MILVUS_ALIAS = "default"
|
||||
MILVUS_PORT = "19530"
|
||||
MILVUS_TABLE_KEYPOINT = "keypoint_cache"
|
||||
MILVUS_TABLE_SEG = "seg_cache"
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ class KeypointDetection(object):
|
||||
path here: abstract path
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.client = MilvusClient(
|
||||
uri="http://10.1.1.240:19530",
|
||||
token="root:Milvus",
|
||||
db_name=MILVUS_ALIAS
|
||||
)
|
||||
# def __init__(self):
|
||||
# self.client = MilvusClient(
|
||||
# uri="http://10.1.1.240:19530",
|
||||
# token="root:Milvus",
|
||||
# db_name=MILVUS_ALIAS
|
||||
# )
|
||||
|
||||
def __del__(self):
|
||||
# start_time = time.time()
|
||||
self.client.close()
|
||||
# print(f"client close time : {time.time() - start_time}")
|
||||
# def __del__(self):
|
||||
# start_time = time.time()
|
||||
# self.client.close()
|
||||
# print(f"client close time : {time.time() - start_time}")
|
||||
|
||||
# @ RunTime
|
||||
def __call__(self, result):
|
||||
@@ -69,24 +69,19 @@ class KeypointDetection(object):
|
||||
"keypoint_vector": result.tolist()
|
||||
}
|
||||
]
|
||||
client = MilvusClient(
|
||||
uri="http://10.1.1.240:19530",
|
||||
token="root:Milvus",
|
||||
db_name=MILVUS_ALIAS
|
||||
)
|
||||
try:
|
||||
client = MilvusClient(uri=MILVUS_URL, token=MILVUS_TOKEN, db_name=MILVUS_ALIAS)
|
||||
start_time = time.time()
|
||||
res = client.upsert(
|
||||
collection_name=MILVUS_TABLE_KEYPOINT,
|
||||
data=data,
|
||||
)
|
||||
# logging.info(f"save keypoint time : {time.time() - start_time}")
|
||||
client.close()
|
||||
return dict(zip(KEYPOINT_RESULT_TABLE_FIELD_SET, result.reshape(12, 2).astype(int).tolist()))
|
||||
except Exception as e:
|
||||
logging.info(f"save keypoint cache milvus error : {e}")
|
||||
return dict(zip(KEYPOINT_RESULT_TABLE_FIELD_SET, result.reshape(12, 2).astype(int).tolist()))
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
@staticmethod
|
||||
def update_keypoint_cache(keypoint_id, infer_result, search_result, site):
|
||||
@@ -102,12 +97,9 @@ class KeypointDetection(object):
|
||||
"keypoint_vector": result.tolist()
|
||||
}
|
||||
]
|
||||
client = MilvusClient(
|
||||
uri="http://10.1.1.240:19530",
|
||||
token="root:Milvus",
|
||||
db_name=MILVUS_ALIAS
|
||||
)
|
||||
|
||||
try:
|
||||
client = MilvusClient(uri=MILVUS_URL, token=MILVUS_TOKEN, db_name=MILVUS_ALIAS)
|
||||
# connections.connect(alias=MILVUS_ALIAS, host=MILVUS_DB_HOST, port=MILVUS_PORT)
|
||||
start_time = time.time()
|
||||
# collection = Collection(MILVUS_TABLE_KEYPOINT) # Get an existing collection.
|
||||
@@ -125,8 +117,9 @@ class KeypointDetection(object):
|
||||
# @ RunTime
|
||||
def keypoint_cache(self, result, site):
|
||||
try:
|
||||
client = MilvusClient(uri=MILVUS_URL, token=MILVUS_TOKEN, db_name=MILVUS_ALIAS)
|
||||
keypoint_id = result['image_id']
|
||||
res = self.client.query(
|
||||
res = client.query(
|
||||
collection_name=MILVUS_TABLE_KEYPOINT,
|
||||
# ids=[keypoint_id],
|
||||
filter=f"keypoint_id == {keypoint_id}",
|
||||
|
||||
Reference in New Issue
Block a user