attribute 模型名称错误
This commit is contained in:
@@ -8,7 +8,7 @@ from matplotlib import pyplot as plt, image as mpimg
|
||||
from minio import Minio
|
||||
from torchvision import transforms
|
||||
|
||||
from app.core.config import MINIO_IP, MINIO_ACCESS, MINIO_SECRET, MINIO_SECURE, MINIO_PORT, OM_TRITON_PORT, OM_TRITON_IP
|
||||
from app.core.config import *
|
||||
from app.service.outfit_matcher.foco import extract_main_colors
|
||||
from app.service.utils.decorator import RunTime
|
||||
|
||||
|
||||
19
app/service/outfit_matcher/test_param/test.json
Normal file
19
app/service/outfit_matcher/test_param/test.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"topk": 1,
|
||||
"max_outfits": 5,
|
||||
"is_best": true,
|
||||
"query": [
|
||||
{
|
||||
"image_path": "mi-tu/26/BOTTOM/PANTS/MKTS27000_0BLK.jpg/3f4676db-98a1-44d4-947f-9d1f59828629.jpg",
|
||||
"item_name": "MKTS27000",
|
||||
"semantic_category": "BOTTOM/PANTS"
|
||||
}
|
||||
],
|
||||
"database": [
|
||||
{
|
||||
"image_path": "mi-tu/26/TOP/BLOUSE/MKTS27002_0WHT.jpg/131cc29e-8f70-4134-a0e8-82f826b00058.jpg",
|
||||
"item_name": "MKTS27002",
|
||||
"semantic_category": "TOP/BLOUSE"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -10,6 +10,8 @@ from pymilvus import MilvusClient
|
||||
from app.core.config import *
|
||||
from torchvision import transforms
|
||||
|
||||
from app.service.utils.decorator import RunTime
|
||||
|
||||
|
||||
class SimilarMatch:
|
||||
def __init__(self):
|
||||
@@ -77,19 +79,20 @@ class SimilarMatch:
|
||||
features = results.as_numpy("output__1") # Shape (N, 64)
|
||||
return features
|
||||
|
||||
@RunTime
|
||||
def match_features(self, features):
|
||||
# 连接milvus
|
||||
# 连接milvus
|
||||
client = MilvusClient(uri="http://10.1.1.240:19530", db_name="mixi")
|
||||
try:
|
||||
res = client.search(
|
||||
search_response = client.search(
|
||||
collection_name="mixi_outfit", # Replace with the actual name of your collection
|
||||
# Replace with your query vector
|
||||
data=[features[0]],
|
||||
limit=5, # Max. number of search results to return
|
||||
output_fields=["id", "image_path"], # Search parameters
|
||||
)
|
||||
return res
|
||||
return search_response
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
@@ -97,6 +100,6 @@ class SimilarMatch:
|
||||
if __name__ == '__main__':
|
||||
service = SimilarMatch()
|
||||
features = service.get_features(img_path="test/2024 SS/MKTS27000.jpg")
|
||||
res = service.match_features(features)
|
||||
search_response = service.match_features(features)
|
||||
|
||||
print(json.dumps(res, indent=4))
|
||||
print(json.dumps(search_response, indent=4))
|
||||
|
||||
@@ -9,6 +9,7 @@ def RunTime(func):
|
||||
t2 = time.time()
|
||||
if t2 - t1 > 0.05:
|
||||
logging.info(f"function:【{func.__name__}】,runtime:【{str(t2 - t1)}】s")
|
||||
print(f"function:【{func.__name__}】,runtime:【{str(t2 - t1)}】s")
|
||||
return res
|
||||
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user