Merge remote-tracking branch 'origin/develop'
# Conflicts: # app/api/api_attribute.py # app/core/config.py # app/service/outfit_matcher/outfit_evaluator.py # app/service/outfit_matcher/service.py
This commit is contained in:
@@ -14,6 +14,5 @@ router = APIRouter()
|
|||||||
@router.post("")
|
@router.post("")
|
||||||
def attribute(request_data: AttributeModel):
|
def attribute(request_data: AttributeModel):
|
||||||
service = AttributeRecognition()
|
service = AttributeRecognition()
|
||||||
response = service.attribute(const_debug, request_data)
|
response = service.attribute(const, request_data)
|
||||||
logger.info("test")
|
|
||||||
return {"code": 200, "message": "ok", "data": response}
|
return {"code": 200, "message": "ok", "data": response}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
from pymilvus import MilvusClient
|
||||||
|
|
||||||
from app.schemas.outfit_matcher import OutfitMatcher
|
from app.schemas.outfit_matcher import OutfitMatcher
|
||||||
from app.service.outfit_matcher.dataset import FashionDataset
|
from app.service.outfit_matcher.dataset import FashionDataset
|
||||||
from app.service.outfit_matcher.outfit_evaluator import OutfitMaterTypeAware
|
from app.service.outfit_matcher.outfit_evaluator import OutfitMaterTypeAware, Backbone
|
||||||
from app.service.utils.decorator import RunTime
|
from app.service.utils.decorator import RunTime
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
@@ -19,16 +22,28 @@ def outfit_matcher(request_item: OutfitMatcher):
|
|||||||
request_item['query'][i] = dict(request_item['query'][i])
|
request_item['query'][i] = dict(request_item['query'][i])
|
||||||
for i in range(len(request_item['database'])):
|
for i in range(len(request_item['database'])):
|
||||||
request_item['database'][i] = dict(request_item['database'][i])
|
request_item['database'][i] = dict(request_item['database'][i])
|
||||||
|
|
||||||
# try:
|
|
||||||
fashion_dataset = FashionDataset(request_item['database'])
|
fashion_dataset = FashionDataset(request_item['database'])
|
||||||
|
backbone_service = Backbone()
|
||||||
service = OutfitMaterTypeAware()
|
service = OutfitMaterTypeAware()
|
||||||
|
all_items = request_item["query"] + request_item["database"]
|
||||||
|
prepared_feature = {}
|
||||||
|
extracted_features = backbone_service.get_result(all_items)
|
||||||
|
data = deepcopy(all_items) # 做深拷贝 , all_items 是list 可变数组
|
||||||
|
for i, feature in enumerate(extracted_features):
|
||||||
|
data[i]['features'] = feature
|
||||||
|
if 'mapped_cate' in data[i].keys():
|
||||||
|
del data[i]['mapped_cate']
|
||||||
|
|
||||||
|
client = MilvusClient(uri="http://10.1.1.240:19530", token="root:Milvus", db_name="mixi")
|
||||||
|
res = client.insert(collection_name="mixi_outfit", data=data)
|
||||||
|
client.close()
|
||||||
|
for d in data:
|
||||||
|
prepared_feature[d['item_name']] = d['features']
|
||||||
result = []
|
result = []
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
for item in request_item['query']:
|
for item in request_item['query']:
|
||||||
outfits = fashion_dataset.generate_outfit(item, request_item["topk"], request_item["max_outfits"])
|
outfits = fashion_dataset.generate_outfit(item, request_item["topk"], request_item["max_outfits"])
|
||||||
scores, features = service.get_result(outfits)
|
scores = service.get_result(outfits, prepared_feature)
|
||||||
# save features in databases
|
|
||||||
|
|
||||||
if request_item['is_best']:
|
if request_item['is_best']:
|
||||||
best_outfits, best_scores = service.visualize(outfits, scores, request_item["topk"], best=True,
|
best_outfits, best_scores = service.visualize(outfits, scores, request_item["topk"], best=True,
|
||||||
|
|||||||
@@ -27,23 +27,25 @@ MINIO_SECURE = False
|
|||||||
MINIO_ACCESS = "e8zc55mzDOh4IzRrZ9Oa"
|
MINIO_ACCESS = "e8zc55mzDOh4IzRrZ9Oa"
|
||||||
MINIO_SECRET = "uHfqJ7UkwA1PTDGfnA44Hp9ux5YkZTkzZLjeOYhE"
|
MINIO_SECRET = "uHfqJ7UkwA1PTDGfnA44Hp9ux5YkZTkzZLjeOYhE"
|
||||||
|
|
||||||
OM_TRITON_IP = "127.0.0.1"
|
OM_TRITON_IP = "10.1.1.240"
|
||||||
OM_TRITON_PORT = "8000"
|
OM_TRITON_PORT = "10010"
|
||||||
# OM_TRITON_IP = "10.1.1.240"
|
|
||||||
# OM_TRITON_PORT = "10010"
|
|
||||||
|
|
||||||
ATT_TRITON_IP = "10.1.1.240"
|
ATT_TRITON_IP = "10.1.1.240"
|
||||||
ATT_TRITON_PORT = "10020"
|
ATT_TRITON_PORT = "10020"
|
||||||
|
|
||||||
# service env
|
DEBUG = 1
|
||||||
# LOGS_PATH = "app/logs/errors.log"
|
# service env : 1
|
||||||
# FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json"
|
# pycharm debug : 2
|
||||||
# FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json"
|
|
||||||
|
|
||||||
# pycharm debug
|
if DEBUG == 1:
|
||||||
LOGSPATH = "logs/errors.log"
|
LOGS_PATH = "app/logs/errors.log"
|
||||||
FASHION_CATEGORIES = "config/fashion_categories.json"
|
FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json"
|
||||||
FASHION_CATEGORIES_MAPPING = "config/fashion_category_mapping.json"
|
FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json"
|
||||||
# LOGS_PATH = "logs/errors.log"
|
elif DEBUG == 2:
|
||||||
# FASHION_CATEGORIES = "service/outfit_matcher/config/fashion_categories.json"
|
LOGS_PATH = "logs/errors.log"
|
||||||
# FASHION_CATEGORIES_MAPPING = "service/outfit_matcher/config/fashion_category_mapping.json"
|
FASHION_CATEGORIES = "service/outfit_matcher/config/fashion_categories.json"
|
||||||
|
FASHION_CATEGORIES_MAPPING = "service/outfit_matcher/config/fashion_category_mapping.json"
|
||||||
|
elif DEBUG == 3:
|
||||||
|
LOGS_PATH = "app/logs/errors.log"
|
||||||
|
FASHION_CATEGORIES = "./config/fashion_categories.json"
|
||||||
|
FASHION_CATEGORIES_MAPPING = "./config/fashion_category_mapping.json"
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
A Line Skirt,bottom_Sub-Type_1,Sub_Type,2
|
A Line Skirt,bottom_Sub-Type_1,Sub type2
|
||||||
Bodycon Skirt,bottom_Sub-Type_2,Sub_Type,2
|
Bodycon Skirt,bottom_Sub-Type_2,Sub type2
|
||||||
Boot-Cut,bottom_Sub-Type_3,Sub_Type,2
|
Boot-Cut,bottom_Sub-Type_3,Sub type2
|
||||||
Bubble skirt,bottom_Sub-Type_4,Sub_Type,2
|
Bubble skirt,bottom_Sub-Type_4,Sub type2
|
||||||
Cargo Pants,bottom_Sub-Type_5,Sub_Type,2
|
Cargo Pants,bottom_Sub-Type_5,Sub type2
|
||||||
Culottes,bottom_Sub-Type_6,Sub_Type,2
|
Culottes,bottom_Sub-Type_6,Sub type2
|
||||||
Handkerchief Skirt,bottom_Sub-Type_7,Sub_Type,2
|
Handkerchief Skirt,bottom_Sub-Type_7,Sub type2
|
||||||
Jeans,bottom_Sub-Type_8,Sub_Type,2
|
Jeans,bottom_Sub-Type_8,Sub type2
|
||||||
Joggers,bottom_Sub-Type_9,Sub_Type,2
|
Joggers,bottom_Sub-Type_9,Sub type2
|
||||||
Leather pants,bottom_Sub-Type_10,Sub_Type,2
|
Leather pants,bottom_Sub-Type_10,Sub type2
|
||||||
Leggings,bottom_Sub-Type_11,Sub_Type,2
|
Leggings,bottom_Sub-Type_11,Sub type2
|
||||||
Mermaid,bottom_Sub-Type_12,Sub_Type,2
|
Mermaid,bottom_Sub-Type_12,Sub type2
|
||||||
Pattened pants,bottom_Sub-Type_13,Sub_Type,2
|
Pattened pants,bottom_Sub-Type_13,Sub type2
|
||||||
Peg leg Pants-Cigarette Pants,bottom_Sub-Type_14,Sub_Type,2
|
Peg leg Pants-Cigarette Pants,bottom_Sub-Type_14,Sub type2
|
||||||
Pencil Skirt,bottom_Sub-Type_15,Sub_Type,2
|
Pencil Skirt,bottom_Sub-Type_15,Sub type2
|
||||||
Pleated Skirt,bottom_Sub-Type_16,Sub_Type,2
|
Pleated Skirt,bottom_Sub-Type_16,Sub type2
|
||||||
Shorts,bottom_Sub-Type_17,Sub_Type,2
|
Shorts,bottom_Sub-Type_17,Sub type2
|
||||||
Skater Skirt,bottom_Sub-Type_18,Sub_Type,2
|
Skater Skirt,bottom_Sub-Type_18,Sub type2
|
||||||
Suit Trousers,bottom_Sub-Type_19,Sub_Type,2
|
Suit Trousers,bottom_Sub-Type_19,Sub type2
|
||||||
Tier Skirt,bottom_Sub-Type_20,Sub_Type,2
|
Tier Skirt,bottom_Sub-Type_20,Sub type2
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_B_1,Opening_Type,7
|
Button,attr_OPType_B_1,Opening type,7
|
||||||
Zipper,attr_OPType_B_2,Opening_Type,7
|
Zipper,attr_OPType_B_2,Opening type,7
|
||||||
Thread,attr_OPType_B_3,Opening_Type,7
|
Thread,attr_OPType_B_3,Opening type,7
|
||||||
Hook,attr_OPType_B_4,Opening_Type,7
|
Hook,attr_OPType_B_4,Opening type,7
|
||||||
Elastic,attr_OPType_B_5,Opening_Type,7
|
Elastic,attr_OPType_B_5,Opening type,7
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_B_1,Opening_Type,9
|
Button,attr_OPType_B_1,Opening type,9
|
||||||
Zipper,attr_OPType_B_2,Opening_Type,9
|
Zipper,attr_OPType_B_2,Opening type,9
|
||||||
Thread,attr_OPType_B_3,Opening_Type,9
|
Thread,attr_OPType_B_3,Opening type,9
|
||||||
Hook,attr_OPType_B_4,Opening_Type,9
|
Hook,attr_OPType_B_4,Opening type,9
|
||||||
Elastic,attr_OPType_B_5,Opening_Type,9
|
Elastic,attr_OPType_B_5,Opening type,9
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_U_1,Opening_Type,11
|
Button,attr_OPType_U_1,Opening type,11
|
||||||
Zipper,attr_OPType_U_2,Opening_Type,11
|
Zipper,attr_OPType_U_2,Opening type,11
|
||||||
Thread,attr_OPType_U_3,Opening_Type,11
|
Thread,attr_OPType_U_3,Opening type,11
|
||||||
Hook,attr_OPType_U_4,Opening_Type,11
|
Hook,attr_OPType_U_4,Opening type,11
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Sleeveless,attr_Sleeve_length_1,Sleeve_Length,3
|
Sleeveless,attr_Sleeve_length_1,Sleeve length,3
|
||||||
Short,attr_Sleeve_length_2,Sleeve_Length,3
|
Short,attr_Sleeve_length_2,Sleeve length,3
|
||||||
Middle,attr_Sleeve_length_3,Sleeve_Length,3
|
Middle,attr_Sleeve_length_3,Sleeve length,3
|
||||||
Seven,attr_Sleeve_length_4,Sleeve_Length,3
|
Seven,attr_Sleeve_length_4,Sleeve length,3
|
||||||
Long,attr_Sleeve_length_5,Sleeve_Length,3
|
Long,attr_Sleeve_length_5,Sleeve length,3
|
||||||
|
|||||||
|
@@ -1,9 +1,9 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shape_1,Sleeve_Shape,4
|
Regular,attr_Sleeve_shape_1,Sleeve shape,4
|
||||||
Slim,attr_Sleeve_shape_2,Sleeve_Shape,4
|
Slim,attr_Sleeve_shape_2,Sleeve shape,4
|
||||||
Puff,attr_Sleeve_shape_3,Sleeve_Shape,4
|
Puff,attr_Sleeve_shape_3,Sleeve shape,4
|
||||||
Bell,attr_Sleeve_shape_4,Sleeve_Shape,4
|
Bell,attr_Sleeve_shape_4,Sleeve shape,4
|
||||||
Batwing,attr_Sleeve_shape_5,Sleeve_Shape,4
|
Batwing,attr_Sleeve_shape_5,Sleeve shape,4
|
||||||
Shirt,attr_Sleeve_shape_6,Sleeve_Shape,4
|
Shirt,attr_Sleeve_shape_6,Sleeve shape,4
|
||||||
Rib,attr_Sleeve_shape_7,Sleeve_Shape,4
|
Rib,attr_Sleeve_shape_7,Sleeve shape,4
|
||||||
Raglan,attr_Sleeve_shape_8,Sleeve_Shape,4
|
Raglan,attr_Sleeve_shape_8,Sleeve shape,4
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shoulder_1,Sleeve_Shoulder,5
|
Regular,attr_Sleeve_shoulder_1,Sleeve shoulder,5
|
||||||
Cold,attr_Sleeve_shoulder_2,Sleeve_Shoulder,5
|
Cold,attr_Sleeve_shoulder_2,Sleeve shoulder,5
|
||||||
Tucked,attr_Sleeve_shoulder_3,Sleeve_Shoulder,5
|
Tucked,attr_Sleeve_shoulder_3,Sleeve shoulder,5
|
||||||
Balmain,attr_Sleeve_shoulder_4,Sleeve_Shoulder,5
|
Balmain,attr_Sleeve_shoulder_4,Sleeve shoulder,5
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_D_1,Opening_Type,11
|
Button,attr_OPType_D_1,Opening type,11
|
||||||
Zipper,attr_OPType_D_2,Opening_Type,11
|
Zipper,attr_OPType_D_2,Opening type,11
|
||||||
Thread,attr_OPType_D_3,Opening_Type,11
|
Thread,attr_OPType_D_3,Opening type,11
|
||||||
Hook,attr_OPType_D_4,Opening_Type,11
|
Hook,attr_OPType_D_4,Opening type,11
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Sleeveless,attr_Sleeve_length_D_1,Sleeve_Length,2
|
Sleeveless,attr_Sleeve_length_D_1,Sleeve length,2
|
||||||
Short,attr_Sleeve_length_D_2,Sleeve_Length,2
|
Short,attr_Sleeve_length_D_2,Sleeve length,2
|
||||||
Middle,attr_Sleeve_length_D_3,Sleeve_Length,2
|
Middle,attr_Sleeve_length_D_3,Sleeve length,2
|
||||||
Seven,attr_Sleeve_length_D_4,Sleeve_Length,2
|
Seven,attr_Sleeve_length_D_4,Sleeve length,2
|
||||||
Long,attr_Sleeve_length_D_5,Sleeve_Length,2
|
Long,attr_Sleeve_length_D_5,Sleeve length,2
|
||||||
|
|||||||
|
@@ -1,9 +1,9 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shape_D_1,Sleeve_Shape,3
|
Regular,attr_Sleeve_shape_D_1,Sleeve shape,3
|
||||||
Slim,attr_Sleeve_shape_D_2,Sleeve_Shape,3
|
Slim,attr_Sleeve_shape_D_2,Sleeve shape,3
|
||||||
Puff,attr_Sleeve_shape_D_3,Sleeve_Shape,3
|
Puff,attr_Sleeve_shape_D_3,Sleeve shape,3
|
||||||
Bell,attr_Sleeve_shape_D_4,Sleeve_Shape,3
|
Bell,attr_Sleeve_shape_D_4,Sleeve shape,3
|
||||||
Batwing,attr_Sleeve_shape_D_5,Sleeve_Shape,3
|
Batwing,attr_Sleeve_shape_D_5,Sleeve shape,3
|
||||||
Shirt,attr_Sleeve_shape_D_6,Sleeve_Shape,3
|
Shirt,attr_Sleeve_shape_D_6,Sleeve shape,3
|
||||||
Rib,attr_Sleeve_shape_D_7,Sleeve_Shape,3
|
Rib,attr_Sleeve_shape_D_7,Sleeve shape,3
|
||||||
Raglan,attr_Sleeve_shape_D_8,Sleeve_Shape,3
|
Raglan,attr_Sleeve_shape_D_8,Sleeve shape,3
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shoulder_D_1,Sleeve_Shoulder,4
|
Regular,attr_Sleeve_shoulder_D_1,Sleeve shoulder,4
|
||||||
Cold,attr_Sleeve_shoulder_D_2,Sleeve_Shoulder,4
|
Cold,attr_Sleeve_shoulder_D_2,Sleeve shoulder,4
|
||||||
Tucked,attr_Sleeve_shoulder_D_3,Sleeve_Shoulder,4
|
Tucked,attr_Sleeve_shoulder_D_3,Sleeve shoulder,4
|
||||||
Balmain,attr_Sleeve_shoulder_D_4,Sleeve_Shoulder,4
|
Balmain,attr_Sleeve_shoulder_D_4,Sleeve shoulder,4
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_J_1,Opening_Type,11
|
Button,attr_OPType_J_1,Opening type,11
|
||||||
Zipper,attr_OPType_J_2,Opening_Type,11
|
Zipper,attr_OPType_J_2,Opening type,11
|
||||||
Thread,attr_OPType_J_3,Opening_Type,11
|
Thread,attr_OPType_J_3,Opening type,11
|
||||||
Hook,attr_OPType_J_4,Opening_Type,11
|
Hook,attr_OPType_J_4,Opening type,11
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Sleeveless,attr_Sleeve_length_J_1,Sleeve_Length,2
|
Sleeveless,attr_Sleeve_length_J_1,Sleeve length,2
|
||||||
Short,attr_Sleeve_length_J_2,Sleeve_Length,2
|
Short,attr_Sleeve_length_J_2,Sleeve length,2
|
||||||
Middle,attr_Sleeve_length_J_3,Sleeve_Length,2
|
Middle,attr_Sleeve_length_J_3,Sleeve length,2
|
||||||
Seven,attr_Sleeve_length_J_4,Sleeve_Length,2
|
Seven,attr_Sleeve_length_J_4,Sleeve length,2
|
||||||
Long,attr_Sleeve_length_J_5,Sleeve_Length,2
|
Long,attr_Sleeve_length_J_5,Sleeve length,2
|
||||||
|
|||||||
|
@@ -1,9 +1,9 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shape_J_1,Sleeve_Shape,3
|
Regular,attr_Sleeve_shape_J_1,Sleeve shape,3
|
||||||
Slim,attr_Sleeve_shape_J_2,Sleeve_Shape,3
|
Slim,attr_Sleeve_shape_J_2,Sleeve shape,3
|
||||||
Puff,attr_Sleeve_shape_J_3,Sleeve_Shape,3
|
Puff,attr_Sleeve_shape_J_3,Sleeve shape,3
|
||||||
Bell,attr_Sleeve_shape_J_4,Sleeve_Shape,3
|
Bell,attr_Sleeve_shape_J_4,Sleeve shape,3
|
||||||
Batwing,attr_Sleeve_shape_J_5,Sleeve_Shape,3
|
Batwing,attr_Sleeve_shape_J_5,Sleeve shape,3
|
||||||
Shirt,attr_Sleeve_shape_J_6,Sleeve_Shape,3
|
Shirt,attr_Sleeve_shape_J_6,Sleeve shape,3
|
||||||
Rib,attr_Sleeve_shape_J_7,Sleeve_Shape,3
|
Rib,attr_Sleeve_shape_J_7,Sleeve shape,3
|
||||||
Raglan,attr_Sleeve_shape_J_8,Sleeve_Shape,3
|
Raglan,attr_Sleeve_shape_J_8,Sleeve shape,3
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shoulder_J_1,Sleeve_Shoulder,4
|
Regular,attr_Sleeve_shoulder_J_1,Sleeve shoulder,4
|
||||||
Cold,attr_Sleeve_shoulder_J_2,Sleeve_Shoulder,4
|
Cold,attr_Sleeve_shoulder_J_2,Sleeve shoulder,4
|
||||||
Tucked,attr_Sleeve_shoulder_J_3,Sleeve_Shoulder,4
|
Tucked,attr_Sleeve_shoulder_J_3,Sleeve shoulder,4
|
||||||
Balmain,attr_Sleeve_shoulder_J_4,Sleeve_Shoulder,4
|
Balmain,attr_Sleeve_shoulder_J_4,Sleeve shoulder,4
|
||||||
|
|||||||
|
@@ -1,3 +1,3 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Full,attr_Opening_O_1,Opening_Type,11
|
Full,attr_Opening_O_1,Opening,11
|
||||||
Half,attr_Opening_O_2,Opening_Type,11
|
Half,attr_Opening_O_2,Opening,11
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_O_1,Opening_Type,12
|
Button,attr_OPType_O_1,Opening type,12
|
||||||
Zipper,attr_OPType_O_2,Opening_Type,12
|
Zipper,attr_OPType_O_2,Opening type,12
|
||||||
Thread,attr_OPType_O_3,Opening_Type,12
|
Thread,attr_OPType_O_3,Opening type,12
|
||||||
Hook,attr_OPType_O_4,Opening_Type,12
|
Hook,attr_OPType_O_4,Opening type,12
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Sleeveless,attr_sleeve_length_1,Sleeve_Length,3
|
Sleeveless,attr_sleeve_length_1,Sleeve length,3
|
||||||
Short,attr_sleeve_length_2,Sleeve_Length,3
|
Short,attr_sleeve_length_2,Sleeve length,3
|
||||||
Middle,attr_sleeve_length_3,Sleeve_Length,3
|
Middle,attr_sleeve_length_3,Sleeve length,3
|
||||||
Seven,attr_sleeve_length_4,Sleeve_Length,3
|
Seven,attr_sleeve_length_4,Sleeve length,3
|
||||||
Long,attr_sleeve_length_5,Sleeve_Length,3
|
Long,attr_sleeve_length_5,Sleeve length,3
|
||||||
|
|||||||
|
@@ -1,9 +1,9 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_sleeve_shape_O_1,Sleeve_Shape,4
|
Regular,attr_sleeve_shape_O_1,Sleeve shape,4
|
||||||
Slim,attr_sleeve_shape_O_2,Sleeve_Shape,4
|
Slim,attr_sleeve_shape_O_2,Sleeve shape,4
|
||||||
Puff,attr_sleeve_shape_O_3,Sleeve_Shape,4
|
Puff,attr_sleeve_shape_O_3,Sleeve shape,4
|
||||||
Bell,attr_sleeve_shape_O_4,Sleeve_Shape,4
|
Bell,attr_sleeve_shape_O_4,Sleeve shape,4
|
||||||
Batwing,attr_sleeve_shape_O_5,Sleeve_Shape,4
|
Batwing,attr_sleeve_shape_O_5,Sleeve shape,4
|
||||||
Shirt,attr_sleeve_shape_O_6,Sleeve_Shape,4
|
Shirt,attr_sleeve_shape_O_6,Sleeve shape,4
|
||||||
Rib,attr_sleeve_shape_O_7,Sleeve_Shape,4
|
Rib,attr_sleeve_shape_O_7,Sleeve shape,4
|
||||||
Raglan,attr_sleeve_shape_O_8,Sleeve_Shape,4
|
Raglan,attr_sleeve_shape_O_8,Sleeve shape,4
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_sleeve_shoulder_O_1,Sleeve_Shoulder,5
|
Regular,attr_sleeve_shoulder_O_1,Sleeve shoulder,5
|
||||||
Cold,attr_sleeve_shoulder_O_2,Sleeve_Shoulder,5
|
Cold,attr_sleeve_shoulder_O_2,Sleeve shoulder,5
|
||||||
Tucked,attr_sleeve_shoulder_O_3,Sleeve_Shoulder,5
|
Tucked,attr_sleeve_shoulder_O_3,Sleeve shoulder,5
|
||||||
Balmain,attr_sleeve_shoulder_O_4,Sleeve_Shoulder,5
|
Balmain,attr_sleeve_shoulder_O_4,Sleeve shoulder,5
|
||||||
Drop Shoulder,attr_sleeve_shoulder_O_5,Sleeve_Shoulder,5
|
Drop Shoulder,attr_sleeve_shoulder_O_5,Sleeve shoulder,5
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_U_1,Opening_Type,11
|
Button,attr_OPType_U_1,Opening type,11
|
||||||
Zipper,attr_OPType_U_2,Opening_Type,11
|
Zipper,attr_OPType_U_2,Opening type,11
|
||||||
Thread,attr_OPType_U_3,Opening_Type,11
|
Thread,attr_OPType_U_3,Opening type,11
|
||||||
Hook,attr_OPType_U_4,Opening_Type,11
|
Hook,attr_OPType_U_4,Opening type,11
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Sleeveless,attr_Sleeve_length_1,Sleeve_Length,3
|
Sleeveless,attr_Sleeve_length_1,Sleeve length,3
|
||||||
Short,attr_Sleeve_length_2,Sleeve_Length,3
|
Short,attr_Sleeve_length_2,Sleeve length,3
|
||||||
Middle,attr_Sleeve_length_3,Sleeve_Length,3
|
Middle,attr_Sleeve_length_3,Sleeve length,3
|
||||||
Seven,attr_Sleeve_length_4,Sleeve_Length,3
|
Seven,attr_Sleeve_length_4,Sleeve length,3
|
||||||
Long,attr_Sleeve_length_5,Sleeve_Length,3
|
Long,attr_Sleeve_length_5,Sleeve length,3
|
||||||
|
|||||||
|
@@ -1,9 +1,9 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shape_1,Sleeve_Shape,4
|
Regular,attr_Sleeve_shape_1,Sleeve shape,4
|
||||||
Slim,attr_Sleeve_shape_2,Sleeve_Shape,4
|
Slim,attr_Sleeve_shape_2,Sleeve shape,4
|
||||||
Puff,attr_Sleeve_shape_3,Sleeve_Shape,4
|
Puff,attr_Sleeve_shape_3,Sleeve shape,4
|
||||||
Bell,attr_Sleeve_shape_4,Sleeve_Shape,4
|
Bell,attr_Sleeve_shape_4,Sleeve shape,4
|
||||||
Batwing,attr_Sleeve_shape_5,Sleeve_Shape,4
|
Batwing,attr_Sleeve_shape_5,Sleeve shape,4
|
||||||
Shirt,attr_Sleeve_shape_6,Sleeve_Shape,4
|
Shirt,attr_Sleeve_shape_6,Sleeve shape,4
|
||||||
Rib,attr_Sleeve_shape_7,Sleeve_Shape,4
|
Rib,attr_Sleeve_shape_7,Sleeve shape,4
|
||||||
Raglan,attr_Sleeve_shape_8,Sleeve_Shape,4
|
Raglan,attr_Sleeve_shape_8,Sleeve shape,4
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shoulder_1,Sleeve_Shoulder,5
|
Regular,attr_Sleeve_shoulder_1,Sleeve shoulder,5
|
||||||
Cold,attr_Sleeve_shoulder_2,Sleeve_Shoulder,5
|
Cold,attr_Sleeve_shoulder_2,Sleeve shoulder,5
|
||||||
Tucked,attr_Sleeve_shoulder_3,Sleeve_Shoulder,5
|
Tucked,attr_Sleeve_shoulder_3,Sleeve shoulder,5
|
||||||
Balmain,attr_Sleeve_shoulder_4,Sleeve_Shoulder,5
|
Balmain,attr_Sleeve_shoulder_4,Sleeve shoulder,5
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Button,attr_OPType_U_1,Opening_Type,12
|
Button,attr_OPType_U_1,Opening type,12
|
||||||
Zipper,attr_OPType_U_2,Opening_Type,12
|
Zipper,attr_OPType_U_2,Opening type,12
|
||||||
Thread,attr_OPType_U_3,Opening_Type,12
|
Thread,attr_OPType_U_3,Opening type,12
|
||||||
Hook,attr_OPType_U_4,Opening_Type,12
|
Hook,attr_OPType_U_4,Opening type,12
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Sleeveless,attr_Sleeve_length_U_1,Sleeve_Length,3
|
Sleeveless,attr_Sleeve_length_U_1,Sleeve length,3
|
||||||
Short,attr_Sleeve_length_U_2,Sleeve_Length,3
|
Short,attr_Sleeve_length_U_2,Sleeve length,3
|
||||||
Middle,attr_Sleeve_length_U_3,Sleeve_Length,3
|
Middle,attr_Sleeve_length_U_3,Sleeve length,3
|
||||||
Seven,attr_Sleeve_length_U_4,Sleeve_Length,3
|
Seven,attr_Sleeve_length_U_4,Sleeve length,3
|
||||||
Long,attr_Sleeve_length_U_5,Sleeve_Length,3
|
Long,attr_Sleeve_length_U_5,Sleeve length,3
|
||||||
|
|||||||
|
@@ -1,9 +1,9 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shape_U_1,Sleeve_Shape,4
|
Regular,attr_Sleeve_shape_U_1,Sleeve shape,4
|
||||||
Slim,attr_Sleeve_shape_U_2,Sleeve_Shape,4
|
Slim,attr_Sleeve_shape_U_2,Sleeve shape,4
|
||||||
Puff,attr_Sleeve_shape_U_3,Sleeve_Shape,4
|
Puff,attr_Sleeve_shape_U_3,Sleeve shape,4
|
||||||
Bell,attr_Sleeve_shape_U_4,Sleeve_Shape,4
|
Bell,attr_Sleeve_shape_U_4,Sleeve shape,4
|
||||||
Batwing,attr_Sleeve_shape_U_5,Sleeve_Shape,4
|
Batwing,attr_Sleeve_shape_U_5,Sleeve shape,4
|
||||||
Shirt,attr_Sleeve_shape_U_6,Sleeve_Shape,4
|
Shirt,attr_Sleeve_shape_U_6,Sleeve shape,4
|
||||||
Rib,attr_Sleeve_shape_U_7,Sleeve_Shape,4
|
Rib,attr_Sleeve_shape_U_7,Sleeve shape,4
|
||||||
Raglan,attr_Sleeve_shape_U_8,Sleeve_Shape,4
|
Raglan,attr_Sleeve_shape_U_8,Sleeve shape,4
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
labelName,join_attr,taskName,taskId
|
labelName,join_attr,taskName,taskId
|
||||||
Regular,attr_Sleeve_shoulder_U_1,Sleeve_Shoulder,5
|
Regular,attr_Sleeve_shoulder_U_1,Sleeve shoulder,5
|
||||||
Cold,attr_Sleeve_shoulder_U_2,Sleeve_Shoulder,5
|
Cold,attr_Sleeve_shoulder_U_2,Sleeve shoulder,5
|
||||||
Tucked,attr_Sleeve_shoulder_U_3,Sleeve_Shoulder,5
|
Tucked,attr_Sleeve_shoulder_U_3,Sleeve shoulder,5
|
||||||
Balmain,attr_Sleeve_shoulder_U_4,Sleeve_Shoulder,5
|
Balmain,attr_Sleeve_shoulder_U_4,Sleeve shoulder,5
|
||||||
|
|||||||
|
@@ -111,7 +111,7 @@ class AttributeRecognition:
|
|||||||
attr_dict = {}
|
attr_dict = {}
|
||||||
category = 'bottom'
|
category = 'bottom'
|
||||||
attr_dict['Item'] = category
|
attr_dict['Item'] = category
|
||||||
attr_dict['BTM_Type'] = ['Pants']
|
attr_dict['Type'] = ['Pants']
|
||||||
for i in range(len(args.bottom_discription_list)):
|
for i in range(len(args.bottom_discription_list)):
|
||||||
attr_description = args.bottom_discription_list[i]
|
attr_description = args.bottom_discription_list[i]
|
||||||
attr_model_path = args.bottom_model_list[i]
|
attr_model_path = args.bottom_model_list[i]
|
||||||
@@ -119,7 +119,7 @@ class AttributeRecognition:
|
|||||||
attr_dict = Merge(attr_dict, present_dict)
|
attr_dict = Merge(attr_dict, present_dict)
|
||||||
|
|
||||||
elif category == 'skirt':
|
elif category == 'skirt':
|
||||||
attr_dict = {'BTM_Type': ['Skirt']}
|
attr_dict = {'Type': ['Skirt']}
|
||||||
category = 'bottom'
|
category = 'bottom'
|
||||||
attr_dict['Item'] = category
|
attr_dict['Item'] = category
|
||||||
for i in range(len(args.bottom_discription_list)):
|
for i in range(len(args.bottom_discription_list)):
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class Backbone(object):
|
|||||||
access_key=MINIO_ACCESS,
|
access_key=MINIO_ACCESS,
|
||||||
secret_key=MINIO_SECRET,
|
secret_key=MINIO_SECRET,
|
||||||
secure=MINIO_SECURE)
|
secure=MINIO_SECURE)
|
||||||
|
|
||||||
@RunTime
|
@RunTime
|
||||||
# TODO 用多线程读图片
|
# TODO 用多线程读图片
|
||||||
def load_image(self, img_path):
|
def load_image(self, img_path):
|
||||||
@@ -38,6 +39,7 @@ class Backbone(object):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An error occurred: {e}")
|
print(f"An error occurred: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resize_image(img):
|
def resize_image(img):
|
||||||
"""
|
"""
|
||||||
@@ -195,43 +197,45 @@ class OutfitMatcher(object):
|
|||||||
outfits = [outfits[i] for i in sorted_indices] # 最好或最差的五个
|
outfits = [outfits[i] for i in sorted_indices] # 最好或最差的五个
|
||||||
scores = scores[sorted_indices] # 这五个的分数
|
scores = scores[sorted_indices] # 这五个的分数
|
||||||
|
|
||||||
# 设置子图的行列数
|
return outfits, scores.tolist()
|
||||||
num_rows = len(outfits)
|
|
||||||
num_cols = max([len(x) for x in outfits]) + 1 # 一个是图片,一个是分数
|
|
||||||
|
|
||||||
# 创建一个新的图像,并指定子图的行列数
|
# # 设置子图的行列数
|
||||||
fig, axes = plt.subplots(num_rows, num_cols, figsize=(8, 15))
|
# num_rows = len(outfits)
|
||||||
|
# num_cols = max([len(x) for x in outfits]) + 1 # 一个是图片,一个是分数
|
||||||
title = f"Best {topk} Outfits" if best else f"Worst {topk} Outfits"
|
#
|
||||||
fig.suptitle(title, fontsize=16)
|
# # 创建一个新的图像,并指定子图的行列数
|
||||||
|
# fig, axes = plt.subplots(num_rows, num_cols, figsize=(8, 15))
|
||||||
# 遍历每套outfit并将其显示在对应的子图中
|
#
|
||||||
for i, (outfit, score) in enumerate(zip(outfits, scores)):
|
# title = f"Best {topk} Outfits" if best else f"Worst {topk} Outfits"
|
||||||
# 显示分数
|
# fig.suptitle(title, fontsize=16)
|
||||||
axes[i, 0].text(0.1, 0.5, f"Score: {score:.4f}", fontsize=12)
|
#
|
||||||
axes[i, 0].axis("off")
|
# # 遍历每套outfit并将其显示在对应的子图中
|
||||||
# 显示图片
|
# for i, (outfit, score) in enumerate(zip(outfits, scores)):
|
||||||
for j, item in enumerate(outfit):
|
# # 显示分数
|
||||||
img = self.load_image(item['image_path']) # 读取图片
|
# axes[i, 0].text(0.1, 0.5, f"Score: {score:.4f}", fontsize=12)
|
||||||
axes[i, j + 1].imshow(img) # 在对应的子图中显示图片
|
# axes[i, 0].axis("off")
|
||||||
axes[i, j + 1].axis('off') # 关闭坐标轴
|
# # 显示图片
|
||||||
axes[i, j + 1].set_title(item["semantic_category"], fontsize=10)
|
# for j, item in enumerate(outfit):
|
||||||
for j in range(len(outfit), num_cols):
|
# img = self.load_image(item['image_path']) # 读取图片
|
||||||
axes[i, j].axis("off")
|
# axes[i, j + 1].imshow(img) # 在对应的子图中显示图片
|
||||||
|
# axes[i, j + 1].axis('off') # 关闭坐标轴
|
||||||
# 在每一行的底部添加一条横线
|
# axes[i, j + 1].set_title(item["semantic_category"], fontsize=10)
|
||||||
axes[i, 0].axhline(y=0, color='black', linewidth=1)
|
# for j in range(len(outfit), num_cols):
|
||||||
# 隐藏最后一行的横线
|
# axes[i, j].axis("off")
|
||||||
axes[-1, 0].axhline(y=0, color='white', linewidth=1)
|
#
|
||||||
|
# # 在每一行的底部添加一条横线
|
||||||
# 调整布局
|
# axes[i, 0].axhline(y=0, color='black', linewidth=1)
|
||||||
plt.subplots_adjust(wspace=0.1, hspace=0.1)
|
# # 隐藏最后一行的横线
|
||||||
plt.tight_layout()
|
# axes[-1, 0].axhline(y=0, color='white', linewidth=1)
|
||||||
|
#
|
||||||
if output_path:
|
# # 调整布局
|
||||||
plt.savefig(output_path)
|
# plt.subplots_adjust(wspace=0.1, hspace=0.1)
|
||||||
else:
|
# plt.tight_layout()
|
||||||
plt.show()
|
#
|
||||||
|
# if output_path:
|
||||||
|
# plt.savefig(output_path)
|
||||||
|
# else:
|
||||||
|
# plt.show()
|
||||||
|
|
||||||
|
|
||||||
class OutfitMatcherHon(OutfitMatcher):
|
class OutfitMatcherHon(OutfitMatcher):
|
||||||
|
|||||||
@@ -49,11 +49,9 @@ if __name__ == '__main__':
|
|||||||
best_outfits = [outfits[i] for i in sorted_indices] # 最好的五个
|
best_outfits = [outfits[i] for i in sorted_indices] # 最好的五个
|
||||||
|
|
||||||
# 结果可视化
|
# 结果可视化
|
||||||
service.visualize(outfits, scores, param["topk"], best=True,
|
# service.visualize(outfits, scores, param["topk"], best=True,
|
||||||
output_path=os.path.join(r"D:\PhD_Study\MIXI\mitu\image\123",
|
# output_path=os.path.join(r"D:\PhD_Study\MIXI\mitu\image\123",
|
||||||
f"{item['item_name']}_best_{param['topk']}.png"))
|
# f"{item['item_name']}_best_{param['topk']}.png"))
|
||||||
service.visualize(outfits, scores, param["topk"], best=False,
|
# service.visualize(outfits, scores, param["topk"], best=False,
|
||||||
output_path=os.path.join(r"D:\PhD_Study\MIXI\mitu\image\123",
|
# output_path=os.path.join(r"D:\PhD_Study\MIXI\mitu\image\123",
|
||||||
f"{item['item_name']}_worst_{param['topk']}.png"))
|
# f"{item['item_name']}_worst_{param['topk']}.png"))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
trinity_mixi:
|
trinity_mixi:
|
||||||
image: "trinity_client_mixi:latest"
|
|
||||||
container_name: trinity_mixi
|
container_name: trinity_mixi
|
||||||
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- ./trinity_client_mixi:/trinity
|
- ./trinity_client_mixi:/trinity
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user