From 75bedfbeacddd5868e0b465471d819a90ab6682c Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Thu, 28 Mar 2024 10:46:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?attribute=20=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index fbb75cb..f4b7583 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -34,14 +34,14 @@ ATT_TRITON_IP = "10.1.1.240" ATT_TRITON_PORT = "10020" # service env -# LOGS_PATH = "app/logs/errors.log" -# FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json" -# FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json" +LOGS_PATH = "app/logs/errors.log" +FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json" +FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json" # pycharm debug -LOGS_PATH = "logs/errors.log" -FASHION_CATEGORIES = "service/outfit_matcher/config/fashion_categories.json" -FASHION_CATEGORIES_MAPPING = "service/outfit_matcher/config/fashion_category_mapping.json" +# LOGS_PATH = "logs/errors.log" +# FASHION_CATEGORIES = "service/outfit_matcher/config/fashion_categories.json" +# FASHION_CATEGORIES_MAPPING = "service/outfit_matcher/config/fashion_category_mapping.json" # LOGS_PATH = "app/logs/errors.log" From 145b0d0f8cfe2c9333f32e07cddf3e6b42fbdcc3 Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Thu, 28 Mar 2024 13:27:00 +0800 Subject: [PATCH 2/6] =?UTF-8?q?attribute=20=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/attribute_recognition/service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/service/attribute_recognition/service.py b/app/service/attribute_recognition/service.py index 5ca5927..df6e295 100644 --- a/app/service/attribute_recognition/service.py +++ b/app/service/attribute_recognition/service.py @@ -111,7 +111,7 @@ class AttributeRecognition: attr_dict = {} category = 'bottom' attr_dict['Item'] = category - attr_dict['BTM_Type'] = ['Pants'] + attr_dict['Type'] = ['Pants'] for i in range(len(args.bottom_discription_list)): attr_description = args.bottom_discription_list[i] attr_model_path = args.bottom_model_list[i] @@ -119,7 +119,7 @@ class AttributeRecognition: attr_dict = Merge(attr_dict, present_dict) elif category == 'skirt': - attr_dict = {'BTM_Type': ['Skirt']} + attr_dict = {'Type': ['Skirt']} category = 'bottom' attr_dict['Item'] = category for i in range(len(args.bottom_discription_list)): From 39dae92ea05137e33a2124c42033801a921c8d5c Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Thu, 28 Mar 2024 14:14:35 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=90=AD=E9=85=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../outfit_matcher/outfit_evaluator.py | 287 +++++++++++------- 1 file changed, 176 insertions(+), 111 deletions(-) diff --git a/app/service/outfit_matcher/outfit_evaluator.py b/app/service/outfit_matcher/outfit_evaluator.py index 0392414..564c350 100644 --- a/app/service/outfit_matcher/outfit_evaluator.py +++ b/app/service/outfit_matcher/outfit_evaluator.py @@ -13,6 +13,105 @@ from app.service.outfit_matcher.foco import extract_main_colors from app.service.utils.decorator import RunTime +class Backbone(object): + def __init__(self): + self.tritonclient = httpclient.InferenceServerClient(url=f"{OM_TRITON_IP}:{OM_TRITON_PORT}") + self.minio_client = Minio( + f"{MINIO_IP}:{MINIO_PORT}", + access_key=MINIO_ACCESS, + secret_key=MINIO_SECRET, + secure=MINIO_SECURE) + + @RunTime + # TODO 用多线程读图片 + def load_image(self, img_path): + try: + # 从 MinIO 中获取对象(图像文件) + image_data = self.minio_client.get_object(img_path.split("/", 1)[0], img_path.split("/", 1)[1]) + + # 读取图像数据并转换为 PIL 图像对象 + pil_image = Image.open(io.BytesIO(image_data.data)).convert("RGB") + + # 将 PIL 图像转换为 NumPy 数组 + # image_array = np.array(pil_image) + + return pil_image + except Exception as e: + print(f"An error occurred: {e}") + return None + + @staticmethod + def resize_image(img): + """ + Args: + img: ndarray (height, width, channel) + """ + image_transforms = transforms.Compose([ + transforms.Resize(112), + transforms.CenterCrop(112), + transforms.ToTensor(), + transforms.Normalize(mean=[0.485, 0.456, 0.406], + std=[0.229, 0.224, 0.225]), + ]) + resized_img = image_transforms(img).numpy() + return resized_img + + def preprocess(self, items): + images = [] + for item in items: + image = self.load_image(item["image_path"]) + image = self.resize_image(image) + images.append(image) + images = np.stack(images, axis=0) + return images + + @RunTime + def get_result(self, items): + """Input items and output features for similiarity. + Args: + items: images of fashion items + Example: + [ + { + "item_name": "MSE_57987", + "semantic_category": "BOTTOM/PANTS", + "image_path": "D:\\PhD_Study\\MIXI\\mitu\\image\\2024 SS\\MSE_57987.jpg", + "mapped_cate": "bottoms" + }, + { + "item_name": "MPO_SP7712", + "semantic_category": "TOP/TANK", + "image_path": "D:\\PhD_Study\\MIXI\\mitu\\image\\2024 SS\\MPO_SP7712.jpg", + "mapped_cate": "tops" + }, + { + "item_name": "MWSS27195", + "semantic_category": "OUTERWEAR/GILET", + "image_path": "D:\\PhD_Study\\MIXI\\mitu\\image\\2024 SS\\MWSS27195.jpg", + "mapped_cate": "outerwear" + } + ] + Returns: + scores: List of image features + """ + image = self.preprocess(items) + client = httpclient.InferenceServerClient(url=f"{OM_TRITON_IP}:{OM_TRITON_PORT}") + # 输入集 + inputs = [ + httpclient.InferInput("input__0", image.shape, datatype="FP32"), + ] + inputs[0].set_data_from_numpy(image.astype(np.float32), binary_data=True) + # 输出集 + outputs = [ + httpclient.InferRequestedOutput("output__0", binary_data=True), + ] + results = client.infer(model_name="outfit_matcher_backbone", inputs=inputs, outputs=outputs) + # 推理 + # 取结果 + features = results.as_numpy("output__0") # Shape (N, 64) + return features + + class OutfitMatcher(object): def __init__(self): self.tritonclient = httpclient.InferenceServerClient(url=f"{OM_TRITON_IP}:{OM_TRITON_PORT}") @@ -22,6 +121,22 @@ class OutfitMatcher(object): secret_key=MINIO_SECRET, secure=MINIO_SECURE) + def load_image(self, img_path): + try: + # 从 MinIO 中获取对象(图像文件) + image_data = self.minio_client.get_object(img_path.split("/", 1)[0], img_path.split("/", 1)[1]) + + # 读取图像数据并转换为 PIL 图像对象 + pil_image = Image.open(io.BytesIO(image_data.data)).convert("RGB") + + # 将 PIL 图像转换为 NumPy 数组 + # image_array = np.array(pil_image) + + return pil_image + except Exception as e: + print(f"An error occurred: {e}") + return None + @staticmethod def pad_array(input_value, value=0): """pad List of Array into same batch size @@ -77,51 +192,48 @@ class OutfitMatcher(object): @RunTime def visualize(self, outfits, scores, topk=5, best=True, output_path=None): # 将outfits和scores按照scores的值进行排序 - sorted_indices = np.argsort(-scores.flatten() if best else scores.flatten())[:topk] # 使用负号进行降序排序 + # sorted_indices = np.argsort(-scores if best else scores)[:topk] # for HON + sorted_indices = np.argsort(scores if best else -scores)[:topk] # type-aware outfits = [outfits[i] for i in sorted_indices] # 最好或最差的五个 scores = scores[sorted_indices] # 这五个的分数 - # 是否画出来 + # 设置子图的行列数 + 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)) + + title = f"Best {topk} Outfits" if best else f"Worst {topk} Outfits" + fig.suptitle(title, fontsize=16) + + # 遍历每套outfit并将其显示在对应的子图中 + for i, (outfit, score) in enumerate(zip(outfits, scores)): + # 显示分数 + axes[i, 0].text(0.1, 0.5, f"Score: {score:.4f}", fontsize=12) + axes[i, 0].axis("off") + # 显示图片 + for j, item in enumerate(outfit): + img = self.load_image(item['image_path']) # 读取图片 + axes[i, j + 1].imshow(img) # 在对应的子图中显示图片 + axes[i, j + 1].axis('off') # 关闭坐标轴 + axes[i, j + 1].set_title(item["semantic_category"], fontsize=10) + for j in range(len(outfit), num_cols): + axes[i, j].axis("off") + + # 在每一行的底部添加一条横线 + axes[i, 0].axhline(y=0, color='black', linewidth=1) + # 隐藏最后一行的横线 + axes[-1, 0].axhline(y=0, color='white', linewidth=1) + + # 调整布局 + plt.subplots_adjust(wspace=0.1, hspace=0.1) + plt.tight_layout() + if output_path: - # 设置子图的行列数 - 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)) - - title = f"Best {topk} Outfits" if best else f"Worst {topk} Outfits" - fig.suptitle(title, fontsize=16) - - # 遍历每套outfit并将其显示在对应的子图中 - for i, (outfit, score) in enumerate(zip(outfits, scores)): - # 显示分数 - axes[i, 0].text(0.1, 0.5, f"Score: {score[0]:.4f}", fontsize=12) - axes[i, 0].axis("off") - # 显示图片 - for j, item in enumerate(outfit): - img = mpimg.imread(item['image_path']) # 读取图片 - axes[i, j + 1].imshow(img) # 在对应的子图中显示图片 - axes[i, j + 1].axis('off') # 关闭坐标轴 - axes[i, j + 1].set_title(item["semantic_category"], fontsize=10) - for j in range(len(outfit), num_cols): - axes[i, j].axis("off") - - # 在每一行的底部添加一条横线 - axes[i, 0].axhline(y=0, color='black', linewidth=1) - # 隐藏最后一行的横线 - axes[-1, 0].axhline(y=0, color='white', linewidth=1) - - # 调整布局 - plt.subplots_adjust(wspace=0.1, hspace=0.1) - plt.tight_layout() - - if output_path: - plt.savefig(output_path) - else: - plt.show() + plt.savefig(output_path) else: - return outfits, scores.numpy().flatten().tolist() + plt.show() class OutfitMatcherHon(OutfitMatcher): @@ -216,60 +328,17 @@ class OutfitMaterTypeAware(OutfitMatcher): 'outerwear', 'scarves', 'shoes', 'sunglasses', 'tops' ] - @RunTime def __init__(self): super().__init__() - @RunTime - # TODO 用多线程读图片 - def load_image(self, img_path): - try: - # 从 MinIO 中获取对象(图像文件) - image_data = self.minio_client.get_object(img_path.split("/", 1)[0], img_path.split("/", 1)[1]) - - # 读取图像数据并转换为 PIL 图像对象 - pil_image = Image.open(io.BytesIO(image_data.data)).convert("RGB") - - # 将 PIL 图像转换为 NumPy 数组 - # image_array = np.array(pil_image) - - return pil_image - except Exception as e: - print(f"An error occurred: {e}") - return None - # if 'http' in img_path: - # file = requests.get(img_path) - # image = cv2.imdecode(np.fromstring(file.content, np.uint8), 1) - # image = Image.fromarray(image.astype('uint8'), 'RGB') - # else: - # image = Image.open(img_path).convert('RGB') - # return np.array(image) - - @staticmethod - def resize_image(img): - """ - Args: - img: ndarray (height, width, channel) - """ - image_transforms = transforms.Compose([ - transforms.Resize(112), - transforms.CenterCrop(112), - transforms.ToTensor(), - transforms.Normalize(mean=[0.485, 0.456, 0.406], - std=[0.229, 0.224, 0.225]), - ]) - resized_img = image_transforms(img).numpy() - return resized_img - - def preprocess(self, outfits): + def preprocess(self, outfits, features): outfit_images = [] outfit_categories = [] for outfit in outfits: images = [] categories = [] for item in outfit: - image = self.load_image(item["image_path"]) - image = self.resize_image(image) + image = features[item["item_name"]] images.append(image) category = self.base_fashion_categories.index(item["mapped_cate"]) categories.append(category) @@ -277,12 +346,10 @@ class OutfitMaterTypeAware(OutfitMatcher): outfit_images.append(images) # List[(items, 3, 224, 224)] categories = np.array(categories) outfit_categories.append(categories) # List[(items)] - outfit_images, mask = self.pad_array(outfit_images, value=0) - outfit_categories, _ = self.pad_array(outfit_categories, value=len(self.base_fashion_categories)) - return outfit_images, outfit_categories, mask + return outfit_images, outfit_categories @RunTime - def get_result(self, outfits): + def get_result(self, outfits, features): """Input outfits structure and output scores. Args: outfits: outfits to be evaluated. @@ -310,29 +377,27 @@ class OutfitMaterTypeAware(OutfitMatcher): ], ... ] + features: dict(item_name = np.Array) image features of those items Returns: scores: List of float """ - image, category, mask = self.preprocess(outfits) - client = httpclient.InferenceServerClient(url=f"{OM_TRITON_IP}:{OM_TRITON_PORT}") - # 输入集 - inputs = [ - httpclient.InferInput("input__0", image.shape, datatype="FP32"), - httpclient.InferInput("input__1", category.shape, datatype="INT16"), - httpclient.InferInput("input__2", mask.shape, datatype="FP32"), - ] - inputs[0].set_data_from_numpy(image.astype(np.float32), binary_data=True) - inputs[1].set_data_from_numpy(category.astype(np.int16), binary_data=True) - inputs[2].set_data_from_numpy(mask.astype(np.float32), binary_data=True) - # 输出集 - outputs = [ - httpclient.InferRequestedOutput("output__0", binary_data=True), - httpclient.InferRequestedOutput("output__1", binary_data=True) - ] - results = client.infer(model_name="outfit_matcher_type_aware", inputs=inputs, outputs=outputs) - # 推理 - # 取结果 - scores = torch.from_numpy(results.as_numpy("output__0")) # Shape (N, 1) - features = torch.from_numpy(results.as_numpy("output__1")) # Shape (N, 64) + outfit_images, outfit_categories = self.preprocess(outfits, features) + scores = [] + for images, categories in zip(outfit_images, outfit_categories): + client = httpclient.InferenceServerClient(url=f"{OM_TRITON_IP}:{OM_TRITON_PORT}") + # 输入集 + inputs = [ + httpclient.InferInput("input__0", images.shape, datatype="FP32"), + httpclient.InferInput("input__1", categories.shape, datatype="INT16") + ] + inputs[0].set_data_from_numpy(images.astype(np.float32), binary_data=True) + inputs[1].set_data_from_numpy(categories.astype(np.int16), binary_data=True) + # 输出集 + outputs = [ + httpclient.InferRequestedOutput("output__0", binary_data=True), + ] + results = client.infer(model_name="outfit_matcher_type_aware", inputs=inputs, outputs=outputs) + scores.append(results.as_numpy("output__0")) # Shape (N, 1) - return scores, features + scores = np.stack(scores, axis=0) + return scores.flatten() From eb9351dc8706fcaf91a7b5cb4785e31f7d8a4c09 Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Thu, 28 Mar 2024 17:22:51 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=90=AD=E9=85=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/api_attribute.py | 1 - app/api/api_outfit_matcher.py | 27 +++++-- app/core/config.py | 28 +++---- .../outfit_matcher/outfit_evaluator.py | 74 ++++++++++--------- app/service/outfit_matcher/service.py | 66 +++++++++++------ 5 files changed, 117 insertions(+), 79 deletions(-) diff --git a/app/api/api_attribute.py b/app/api/api_attribute.py index 972ccd3..213a1a9 100644 --- a/app/api/api_attribute.py +++ b/app/api/api_attribute.py @@ -15,5 +15,4 @@ router = APIRouter() def attribute(request_data: AttributeModel): service = AttributeRecognition() response = service.attribute(const, request_data) - logger.info("test") return {"code": 200, "message": "ok", "data": response} diff --git a/app/api/api_outfit_matcher.py b/app/api/api_outfit_matcher.py index 24a6337..4532b0c 100644 --- a/app/api/api_outfit_matcher.py +++ b/app/api/api_outfit_matcher.py @@ -1,10 +1,13 @@ import logging import time +from copy import deepcopy from fastapi import APIRouter +from pymilvus import MilvusClient + from app.schemas.outfit_matcher import OutfitMatcher 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 logger = logging.getLogger() @@ -19,16 +22,28 @@ def outfit_matcher(request_item: OutfitMatcher): request_item['query'][i] = dict(request_item['query'][i]) for i in range(len(request_item['database'])): request_item['database'][i] = dict(request_item['database'][i]) - - # try: fashion_dataset = FashionDataset(request_item['database']) + backbone_service = Backbone() 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 = [] start_time = time.time() for item in request_item['query']: outfits = fashion_dataset.generate_outfit(item, request_item["topk"], request_item["max_outfits"]) - scores, features = service.get_result(outfits) - # save features in databases + scores = service.get_result(outfits, prepared_feature) if request_item['is_best']: best_outfits, best_scores = service.visualize(outfits, scores, request_item["topk"], best=True, @@ -44,4 +59,4 @@ def outfit_matcher(request_item: OutfitMatcher): return {"message": "ok", "data": result} # except Exception as e: # logger.warning(e) - # return {"message": f"{e}", "data": e} \ No newline at end of file + # return {"message": f"{e}", "data": e} diff --git a/app/core/config.py b/app/core/config.py index f4b7583..8338d65 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -33,17 +33,19 @@ OM_TRITON_PORT = "10010" ATT_TRITON_IP = "10.1.1.240" ATT_TRITON_PORT = "10020" -# service env -LOGS_PATH = "app/logs/errors.log" -FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json" -FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json" +DEBUG = 1 +# service env : 1 +# pycharm debug : 2 -# pycharm debug -# LOGS_PATH = "logs/errors.log" -# FASHION_CATEGORIES = "service/outfit_matcher/config/fashion_categories.json" -# FASHION_CATEGORIES_MAPPING = "service/outfit_matcher/config/fashion_category_mapping.json" - - -# LOGS_PATH = "app/logs/errors.log" -# FASHION_CATEGORIES = "./config/fashion_categories.json" -# FASHION_CATEGORIES_MAPPING = "./config/fashion_category_mapping.json" \ No newline at end of file +if DEBUG == 1: + LOGS_PATH = "app/logs/errors.log" + FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json" + FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json" +elif DEBUG == 2: + LOGS_PATH = "logs/errors.log" + 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" diff --git a/app/service/outfit_matcher/outfit_evaluator.py b/app/service/outfit_matcher/outfit_evaluator.py index 564c350..a35155e 100644 --- a/app/service/outfit_matcher/outfit_evaluator.py +++ b/app/service/outfit_matcher/outfit_evaluator.py @@ -197,43 +197,45 @@ class OutfitMatcher(object): outfits = [outfits[i] for i in sorted_indices] # 最好或最差的五个 scores = scores[sorted_indices] # 这五个的分数 - # 设置子图的行列数 - num_rows = len(outfits) - num_cols = max([len(x) for x in outfits]) + 1 # 一个是图片,一个是分数 + return outfits, scores.tolist() - # 创建一个新的图像,并指定子图的行列数 - fig, axes = plt.subplots(num_rows, num_cols, figsize=(8, 15)) - - title = f"Best {topk} Outfits" if best else f"Worst {topk} Outfits" - fig.suptitle(title, fontsize=16) - - # 遍历每套outfit并将其显示在对应的子图中 - for i, (outfit, score) in enumerate(zip(outfits, scores)): - # 显示分数 - axes[i, 0].text(0.1, 0.5, f"Score: {score:.4f}", fontsize=12) - axes[i, 0].axis("off") - # 显示图片 - for j, item in enumerate(outfit): - img = self.load_image(item['image_path']) # 读取图片 - axes[i, j + 1].imshow(img) # 在对应的子图中显示图片 - axes[i, j + 1].axis('off') # 关闭坐标轴 - axes[i, j + 1].set_title(item["semantic_category"], fontsize=10) - for j in range(len(outfit), num_cols): - axes[i, j].axis("off") - - # 在每一行的底部添加一条横线 - axes[i, 0].axhline(y=0, color='black', linewidth=1) - # 隐藏最后一行的横线 - axes[-1, 0].axhline(y=0, color='white', linewidth=1) - - # 调整布局 - plt.subplots_adjust(wspace=0.1, hspace=0.1) - plt.tight_layout() - - if output_path: - plt.savefig(output_path) - else: - plt.show() + # # 设置子图的行列数 + # 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)) + # + # title = f"Best {topk} Outfits" if best else f"Worst {topk} Outfits" + # fig.suptitle(title, fontsize=16) + # + # # 遍历每套outfit并将其显示在对应的子图中 + # for i, (outfit, score) in enumerate(zip(outfits, scores)): + # # 显示分数 + # axes[i, 0].text(0.1, 0.5, f"Score: {score:.4f}", fontsize=12) + # axes[i, 0].axis("off") + # # 显示图片 + # for j, item in enumerate(outfit): + # img = self.load_image(item['image_path']) # 读取图片 + # axes[i, j + 1].imshow(img) # 在对应的子图中显示图片 + # axes[i, j + 1].axis('off') # 关闭坐标轴 + # axes[i, j + 1].set_title(item["semantic_category"], fontsize=10) + # for j in range(len(outfit), num_cols): + # axes[i, j].axis("off") + # + # # 在每一行的底部添加一条横线 + # axes[i, 0].axhline(y=0, color='black', linewidth=1) + # # 隐藏最后一行的横线 + # axes[-1, 0].axhline(y=0, color='white', linewidth=1) + # + # # 调整布局 + # plt.subplots_adjust(wspace=0.1, hspace=0.1) + # plt.tight_layout() + # + # if output_path: + # plt.savefig(output_path) + # else: + # plt.show() class OutfitMatcherHon(OutfitMatcher): diff --git a/app/service/outfit_matcher/service.py b/app/service/outfit_matcher/service.py index 59961cb..b99af95 100644 --- a/app/service/outfit_matcher/service.py +++ b/app/service/outfit_matcher/service.py @@ -1,37 +1,57 @@ import json import os from pprint import pprint +import numpy as np 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 if __name__ == '__main__': with open("./test_param/recommendation_test.json", "r") as f: param = json.load(f) fashion_dataset = FashionDataset(param["database"]) + backbone_service = Backbone() service = OutfitMaterTypeAware() - best_list = [] - bad_list = [] + + # read feature from vector database + all_items = param["query"] + param["database"] + unextracted_item = [] + prepared_feature = {} + + # 拿到所有需要提取特征的图片 + for item in all_items: + if f'{item["item_name"]}.npy' not in os.listdir("feature"): + unextracted_item.append(item) + if len(unextracted_item) > 0: + # 通过backbone模型提取图片特征 + extracted_features = backbone_service.get_result(unextracted_item) + for i, item in enumerate(unextracted_item): + # save features + # 链接milvus + # TODO + np.save(f'feature/{item["item_name"]}.npy', extracted_features[i]) + # 存入数据库 + # 关闭链接 + + # TODO 读取本次任务需要的图片特征 + for item in all_items: + if item["item_name"] not in prepared_feature.keys(): + prepared_feature[item["item_name"]] = np.load(f'feature/{item["item_name"]}.npy') + + # 开始服装搭配任务 for item in param["query"]: + # 根据一定规则生成outfit outfits = fashion_dataset.generate_outfit(item, param["topk"], param["max_outfits"]) - scores, features = service.get_result(outfits) - # save features + # 根据模型对生成的outfit打分 + scores = service.get_result(outfits, prepared_feature) + # 对评分排序,拿到最好的topk个outfit输出 + sorted_indices = np.argsort(scores)[:param["topk"]] # type-aware + best_outfits = [outfits[i] for i in sorted_indices] # 最好的五个 - # 链接milvus - - # 存入数据库 - # 关闭链接 - - # print(scores) - # print(len(scores)) - best_outfits, best_scores = service.visualize(outfits, scores, param["topk"], best=True, - # output_path=os.path.join(r"E:\workspace\outfit_matcher\2024 SS Outfit", f"{item['item_name']}_best_{param['topk']}.png") - ) - bad_outfits, bad_scores = service.visualize(outfits, scores, param["topk"], best=False, - # output_path=os.path.join(r"E:\workspace\outfit_matcher\2024 SS Outfit", f"{item['item_name']}_worst_{param['topk']}.png") - ) - best_list.append({"best_outfits": best_outfits, "best_scores": best_scores}) - bad_list.append({"bad_outfits": bad_outfits, "bad_scores": bad_scores}) - - pprint(best_list) - pprint(bad_list) + # 结果可视化 + # service.visualize(outfits, scores, param["topk"], best=True, + # output_path=os.path.join(r"D:\PhD_Study\MIXI\mitu\image\123", + # f"{item['item_name']}_best_{param['topk']}.png")) + # service.visualize(outfits, scores, param["topk"], best=False, + # output_path=os.path.join(r"D:\PhD_Study\MIXI\mitu\image\123", + # f"{item['item_name']}_worst_{param['topk']}.png")) From 216edee0c2ef361aa492ec6804356e18db843428 Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Tue, 2 Apr 2024 16:15:10 +0800 Subject: [PATCH 5/6] =?UTF-8?q?discriptor=20=E9=85=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../discriptor/bottom/2_bottom_subtype.csv | 40 +++++++++---------- .../discriptor/bottom/7_bottom_OPType.csv | 10 ++--- .../discriptor/bottom/ori9_bottom_OPType.csv | 10 ++--- .../discriptor/dress/11_top_OPType.csv | 8 ++-- .../discriptor/dress/3_top_Sleeve_length.csv | 10 ++--- .../discriptor/dress/4_top_Sleeve_shape.csv | 16 ++++---- .../dress/5_top_Sleeve_shoulder.csv | 8 ++-- .../discriptor/dress/ori11_dress_OPType.csv | 8 ++-- .../dress/ori2_dress_Sleeve_length.csv | 10 ++--- .../dress/ori3_dress_Sleeve_shape.csv | 16 ++++---- .../dress/ori4_dress_Sleeve_shoulder.csv | 8 ++-- .../jumpsuit/11_jumpsuit_OPType.csv | 8 ++-- .../jumpsuit/2_jumpsuit_Sleeve_length.csv | 10 ++--- .../jumpsuit/3_jumpsuit_Sleeve_shape.csv | 16 ++++---- .../jumpsuit/4_jumpsuit_Sleeve_shoulder.csv | 8 ++-- .../discriptor/outwear/11_outer_opening.csv | 4 +- .../discriptor/outwear/12_outer_OPType.csv | 8 ++-- .../discriptor/outwear/2_outer_type.csv | 2 +- .../outwear/3_outer_sleeve_length.csv | 10 ++--- .../outwear/4_outer_sleeve_shape.csv | 16 ++++---- .../outwear/5_outer_sleeve_shoulder.csv | 10 ++--- .../discriptor/top/11_top_OPType.csv | 8 ++-- .../discriptor/top/3_top_Sleeve_length.csv | 10 ++--- .../discriptor/top/4_top_Sleeve_shape.csv | 16 ++++---- .../discriptor/top/5_top_Sleeve_shoulder.csv | 8 ++-- .../discriptor/top/ori12_top_OPType.csv | 8 ++-- .../discriptor/top/ori3_top_Sleeve_length.csv | 10 ++--- .../discriptor/top/ori4_top_Sleeve_shape.csv | 16 ++++---- .../top/ori5_top_Sleeve_shoulder.csv | 8 ++-- 29 files changed, 160 insertions(+), 160 deletions(-) diff --git a/app/service/attribute_recognition/discriptor/bottom/2_bottom_subtype.csv b/app/service/attribute_recognition/discriptor/bottom/2_bottom_subtype.csv index 7cb9fb2..dd7de88 100644 --- a/app/service/attribute_recognition/discriptor/bottom/2_bottom_subtype.csv +++ b/app/service/attribute_recognition/discriptor/bottom/2_bottom_subtype.csv @@ -1,21 +1,21 @@ labelName,join_attr,taskName,taskId -A Line Skirt,bottom_Sub-Type_1,Sub_Type,2 -Bodycon Skirt,bottom_Sub-Type_2,Sub_Type,2 -Boot-Cut,bottom_Sub-Type_3,Sub_Type,2 -Bubble skirt,bottom_Sub-Type_4,Sub_Type,2 -Cargo Pants,bottom_Sub-Type_5,Sub_Type,2 -Culottes,bottom_Sub-Type_6,Sub_Type,2 -Handkerchief Skirt,bottom_Sub-Type_7,Sub_Type,2 -Jeans,bottom_Sub-Type_8,Sub_Type,2 -Joggers,bottom_Sub-Type_9,Sub_Type,2 -Leather pants,bottom_Sub-Type_10,Sub_Type,2 -Leggings,bottom_Sub-Type_11,Sub_Type,2 -Mermaid,bottom_Sub-Type_12,Sub_Type,2 -Pattened pants,bottom_Sub-Type_13,Sub_Type,2 -Peg leg Pants-Cigarette Pants,bottom_Sub-Type_14,Sub_Type,2 -Pencil Skirt,bottom_Sub-Type_15,Sub_Type,2 -Pleated Skirt,bottom_Sub-Type_16,Sub_Type,2 -Shorts,bottom_Sub-Type_17,Sub_Type,2 -Skater Skirt,bottom_Sub-Type_18,Sub_Type,2 -Suit Trousers,bottom_Sub-Type_19,Sub_Type,2 -Tier Skirt,bottom_Sub-Type_20,Sub_Type,2 +A Line Skirt,bottom_Sub-Type_1,Sub type2 +Bodycon Skirt,bottom_Sub-Type_2,Sub type2 +Boot-Cut,bottom_Sub-Type_3,Sub type2 +Bubble skirt,bottom_Sub-Type_4,Sub type2 +Cargo Pants,bottom_Sub-Type_5,Sub type2 +Culottes,bottom_Sub-Type_6,Sub type2 +Handkerchief Skirt,bottom_Sub-Type_7,Sub type2 +Jeans,bottom_Sub-Type_8,Sub type2 +Joggers,bottom_Sub-Type_9,Sub type2 +Leather pants,bottom_Sub-Type_10,Sub type2 +Leggings,bottom_Sub-Type_11,Sub type2 +Mermaid,bottom_Sub-Type_12,Sub type2 +Pattened pants,bottom_Sub-Type_13,Sub type2 +Peg leg Pants-Cigarette Pants,bottom_Sub-Type_14,Sub type2 +Pencil Skirt,bottom_Sub-Type_15,Sub type2 +Pleated Skirt,bottom_Sub-Type_16,Sub type2 +Shorts,bottom_Sub-Type_17,Sub type2 +Skater Skirt,bottom_Sub-Type_18,Sub type2 +Suit Trousers,bottom_Sub-Type_19,Sub type2 +Tier Skirt,bottom_Sub-Type_20,Sub type2 diff --git a/app/service/attribute_recognition/discriptor/bottom/7_bottom_OPType.csv b/app/service/attribute_recognition/discriptor/bottom/7_bottom_OPType.csv index 008d981..d699ba9 100644 --- a/app/service/attribute_recognition/discriptor/bottom/7_bottom_OPType.csv +++ b/app/service/attribute_recognition/discriptor/bottom/7_bottom_OPType.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_B_1,Opening_Type,7 -Zipper,attr_OPType_B_2,Opening_Type,7 -Thread,attr_OPType_B_3,Opening_Type,7 -Hook,attr_OPType_B_4,Opening_Type,7 -Elastic,attr_OPType_B_5,Opening_Type,7 +Button,attr_OPType_B_1,Opening type,7 +Zipper,attr_OPType_B_2,Opening type,7 +Thread,attr_OPType_B_3,Opening type,7 +Hook,attr_OPType_B_4,Opening type,7 +Elastic,attr_OPType_B_5,Opening type,7 diff --git a/app/service/attribute_recognition/discriptor/bottom/ori9_bottom_OPType.csv b/app/service/attribute_recognition/discriptor/bottom/ori9_bottom_OPType.csv index 5aaef17..2530262 100644 --- a/app/service/attribute_recognition/discriptor/bottom/ori9_bottom_OPType.csv +++ b/app/service/attribute_recognition/discriptor/bottom/ori9_bottom_OPType.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_B_1,Opening_Type,9 -Zipper,attr_OPType_B_2,Opening_Type,9 -Thread,attr_OPType_B_3,Opening_Type,9 -Hook,attr_OPType_B_4,Opening_Type,9 -Elastic,attr_OPType_B_5,Opening_Type,9 +Button,attr_OPType_B_1,Opening type,9 +Zipper,attr_OPType_B_2,Opening type,9 +Thread,attr_OPType_B_3,Opening type,9 +Hook,attr_OPType_B_4,Opening type,9 +Elastic,attr_OPType_B_5,Opening type,9 diff --git a/app/service/attribute_recognition/discriptor/dress/11_top_OPType.csv b/app/service/attribute_recognition/discriptor/dress/11_top_OPType.csv index 870631b..34a3934 100644 --- a/app/service/attribute_recognition/discriptor/dress/11_top_OPType.csv +++ b/app/service/attribute_recognition/discriptor/dress/11_top_OPType.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_U_1,Opening_Type,11 -Zipper,attr_OPType_U_2,Opening_Type,11 -Thread,attr_OPType_U_3,Opening_Type,11 -Hook,attr_OPType_U_4,Opening_Type,11 +Button,attr_OPType_U_1,Opening type,11 +Zipper,attr_OPType_U_2,Opening type,11 +Thread,attr_OPType_U_3,Opening type,11 +Hook,attr_OPType_U_4,Opening type,11 diff --git a/app/service/attribute_recognition/discriptor/dress/3_top_Sleeve_length.csv b/app/service/attribute_recognition/discriptor/dress/3_top_Sleeve_length.csv index 1f2a0f3..cb9e969 100644 --- a/app/service/attribute_recognition/discriptor/dress/3_top_Sleeve_length.csv +++ b/app/service/attribute_recognition/discriptor/dress/3_top_Sleeve_length.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Sleeveless,attr_Sleeve_length_1,Sleeve_Length,3 -Short,attr_Sleeve_length_2,Sleeve_Length,3 -Middle,attr_Sleeve_length_3,Sleeve_Length,3 -Seven,attr_Sleeve_length_4,Sleeve_Length,3 -Long,attr_Sleeve_length_5,Sleeve_Length,3 +Sleeveless,attr_Sleeve_length_1,Sleeve length,3 +Short,attr_Sleeve_length_2,Sleeve length,3 +Middle,attr_Sleeve_length_3,Sleeve length,3 +Seven,attr_Sleeve_length_4,Sleeve length,3 +Long,attr_Sleeve_length_5,Sleeve length,3 diff --git a/app/service/attribute_recognition/discriptor/dress/4_top_Sleeve_shape.csv b/app/service/attribute_recognition/discriptor/dress/4_top_Sleeve_shape.csv index d429c11..2c53b12 100644 --- a/app/service/attribute_recognition/discriptor/dress/4_top_Sleeve_shape.csv +++ b/app/service/attribute_recognition/discriptor/dress/4_top_Sleeve_shape.csv @@ -1,9 +1,9 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shape_1,Sleeve_Shape,4 -Slim,attr_Sleeve_shape_2,Sleeve_Shape,4 -Puff,attr_Sleeve_shape_3,Sleeve_Shape,4 -Bell,attr_Sleeve_shape_4,Sleeve_Shape,4 -Batwing,attr_Sleeve_shape_5,Sleeve_Shape,4 -Shirt,attr_Sleeve_shape_6,Sleeve_Shape,4 -Rib,attr_Sleeve_shape_7,Sleeve_Shape,4 -Raglan,attr_Sleeve_shape_8,Sleeve_Shape,4 +Regular,attr_Sleeve_shape_1,Sleeve shape,4 +Slim,attr_Sleeve_shape_2,Sleeve shape,4 +Puff,attr_Sleeve_shape_3,Sleeve shape,4 +Bell,attr_Sleeve_shape_4,Sleeve shape,4 +Batwing,attr_Sleeve_shape_5,Sleeve shape,4 +Shirt,attr_Sleeve_shape_6,Sleeve shape,4 +Rib,attr_Sleeve_shape_7,Sleeve shape,4 +Raglan,attr_Sleeve_shape_8,Sleeve shape,4 diff --git a/app/service/attribute_recognition/discriptor/dress/5_top_Sleeve_shoulder.csv b/app/service/attribute_recognition/discriptor/dress/5_top_Sleeve_shoulder.csv index c31e7ea..7997bd5 100644 --- a/app/service/attribute_recognition/discriptor/dress/5_top_Sleeve_shoulder.csv +++ b/app/service/attribute_recognition/discriptor/dress/5_top_Sleeve_shoulder.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shoulder_1,Sleeve_Shoulder,5 -Cold,attr_Sleeve_shoulder_2,Sleeve_Shoulder,5 -Tucked,attr_Sleeve_shoulder_3,Sleeve_Shoulder,5 -Balmain,attr_Sleeve_shoulder_4,Sleeve_Shoulder,5 +Regular,attr_Sleeve_shoulder_1,Sleeve shoulder,5 +Cold,attr_Sleeve_shoulder_2,Sleeve shoulder,5 +Tucked,attr_Sleeve_shoulder_3,Sleeve shoulder,5 +Balmain,attr_Sleeve_shoulder_4,Sleeve shoulder,5 diff --git a/app/service/attribute_recognition/discriptor/dress/ori11_dress_OPType.csv b/app/service/attribute_recognition/discriptor/dress/ori11_dress_OPType.csv index 34be31e..46d7e52 100644 --- a/app/service/attribute_recognition/discriptor/dress/ori11_dress_OPType.csv +++ b/app/service/attribute_recognition/discriptor/dress/ori11_dress_OPType.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_D_1,Opening_Type,11 -Zipper,attr_OPType_D_2,Opening_Type,11 -Thread,attr_OPType_D_3,Opening_Type,11 -Hook,attr_OPType_D_4,Opening_Type,11 +Button,attr_OPType_D_1,Opening type,11 +Zipper,attr_OPType_D_2,Opening type,11 +Thread,attr_OPType_D_3,Opening type,11 +Hook,attr_OPType_D_4,Opening type,11 diff --git a/app/service/attribute_recognition/discriptor/dress/ori2_dress_Sleeve_length.csv b/app/service/attribute_recognition/discriptor/dress/ori2_dress_Sleeve_length.csv index 14a2dc5..0617b9f 100644 --- a/app/service/attribute_recognition/discriptor/dress/ori2_dress_Sleeve_length.csv +++ b/app/service/attribute_recognition/discriptor/dress/ori2_dress_Sleeve_length.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Sleeveless,attr_Sleeve_length_D_1,Sleeve_Length,2 -Short,attr_Sleeve_length_D_2,Sleeve_Length,2 -Middle,attr_Sleeve_length_D_3,Sleeve_Length,2 -Seven,attr_Sleeve_length_D_4,Sleeve_Length,2 -Long,attr_Sleeve_length_D_5,Sleeve_Length,2 +Sleeveless,attr_Sleeve_length_D_1,Sleeve length,2 +Short,attr_Sleeve_length_D_2,Sleeve length,2 +Middle,attr_Sleeve_length_D_3,Sleeve length,2 +Seven,attr_Sleeve_length_D_4,Sleeve length,2 +Long,attr_Sleeve_length_D_5,Sleeve length,2 diff --git a/app/service/attribute_recognition/discriptor/dress/ori3_dress_Sleeve_shape.csv b/app/service/attribute_recognition/discriptor/dress/ori3_dress_Sleeve_shape.csv index 7277acf..d82300f 100644 --- a/app/service/attribute_recognition/discriptor/dress/ori3_dress_Sleeve_shape.csv +++ b/app/service/attribute_recognition/discriptor/dress/ori3_dress_Sleeve_shape.csv @@ -1,9 +1,9 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shape_D_1,Sleeve_Shape,3 -Slim,attr_Sleeve_shape_D_2,Sleeve_Shape,3 -Puff,attr_Sleeve_shape_D_3,Sleeve_Shape,3 -Bell,attr_Sleeve_shape_D_4,Sleeve_Shape,3 -Batwing,attr_Sleeve_shape_D_5,Sleeve_Shape,3 -Shirt,attr_Sleeve_shape_D_6,Sleeve_Shape,3 -Rib,attr_Sleeve_shape_D_7,Sleeve_Shape,3 -Raglan,attr_Sleeve_shape_D_8,Sleeve_Shape,3 +Regular,attr_Sleeve_shape_D_1,Sleeve shape,3 +Slim,attr_Sleeve_shape_D_2,Sleeve shape,3 +Puff,attr_Sleeve_shape_D_3,Sleeve shape,3 +Bell,attr_Sleeve_shape_D_4,Sleeve shape,3 +Batwing,attr_Sleeve_shape_D_5,Sleeve shape,3 +Shirt,attr_Sleeve_shape_D_6,Sleeve shape,3 +Rib,attr_Sleeve_shape_D_7,Sleeve shape,3 +Raglan,attr_Sleeve_shape_D_8,Sleeve shape,3 diff --git a/app/service/attribute_recognition/discriptor/dress/ori4_dress_Sleeve_shoulder.csv b/app/service/attribute_recognition/discriptor/dress/ori4_dress_Sleeve_shoulder.csv index 36656f8..3e7b813 100644 --- a/app/service/attribute_recognition/discriptor/dress/ori4_dress_Sleeve_shoulder.csv +++ b/app/service/attribute_recognition/discriptor/dress/ori4_dress_Sleeve_shoulder.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shoulder_D_1,Sleeve_Shoulder,4 -Cold,attr_Sleeve_shoulder_D_2,Sleeve_Shoulder,4 -Tucked,attr_Sleeve_shoulder_D_3,Sleeve_Shoulder,4 -Balmain,attr_Sleeve_shoulder_D_4,Sleeve_Shoulder,4 +Regular,attr_Sleeve_shoulder_D_1,Sleeve shoulder,4 +Cold,attr_Sleeve_shoulder_D_2,Sleeve shoulder,4 +Tucked,attr_Sleeve_shoulder_D_3,Sleeve shoulder,4 +Balmain,attr_Sleeve_shoulder_D_4,Sleeve shoulder,4 diff --git a/app/service/attribute_recognition/discriptor/jumpsuit/11_jumpsuit_OPType.csv b/app/service/attribute_recognition/discriptor/jumpsuit/11_jumpsuit_OPType.csv index 7e8fa63..b5a296c 100644 --- a/app/service/attribute_recognition/discriptor/jumpsuit/11_jumpsuit_OPType.csv +++ b/app/service/attribute_recognition/discriptor/jumpsuit/11_jumpsuit_OPType.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_J_1,Opening_Type,11 -Zipper,attr_OPType_J_2,Opening_Type,11 -Thread,attr_OPType_J_3,Opening_Type,11 -Hook,attr_OPType_J_4,Opening_Type,11 +Button,attr_OPType_J_1,Opening type,11 +Zipper,attr_OPType_J_2,Opening type,11 +Thread,attr_OPType_J_3,Opening type,11 +Hook,attr_OPType_J_4,Opening type,11 diff --git a/app/service/attribute_recognition/discriptor/jumpsuit/2_jumpsuit_Sleeve_length.csv b/app/service/attribute_recognition/discriptor/jumpsuit/2_jumpsuit_Sleeve_length.csv index 7d77d7a..8c2f510 100644 --- a/app/service/attribute_recognition/discriptor/jumpsuit/2_jumpsuit_Sleeve_length.csv +++ b/app/service/attribute_recognition/discriptor/jumpsuit/2_jumpsuit_Sleeve_length.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Sleeveless,attr_Sleeve_length_J_1,Sleeve_Length,2 -Short,attr_Sleeve_length_J_2,Sleeve_Length,2 -Middle,attr_Sleeve_length_J_3,Sleeve_Length,2 -Seven,attr_Sleeve_length_J_4,Sleeve_Length,2 -Long,attr_Sleeve_length_J_5,Sleeve_Length,2 +Sleeveless,attr_Sleeve_length_J_1,Sleeve length,2 +Short,attr_Sleeve_length_J_2,Sleeve length,2 +Middle,attr_Sleeve_length_J_3,Sleeve length,2 +Seven,attr_Sleeve_length_J_4,Sleeve length,2 +Long,attr_Sleeve_length_J_5,Sleeve length,2 diff --git a/app/service/attribute_recognition/discriptor/jumpsuit/3_jumpsuit_Sleeve_shape.csv b/app/service/attribute_recognition/discriptor/jumpsuit/3_jumpsuit_Sleeve_shape.csv index c1a9cce..101fcb4 100644 --- a/app/service/attribute_recognition/discriptor/jumpsuit/3_jumpsuit_Sleeve_shape.csv +++ b/app/service/attribute_recognition/discriptor/jumpsuit/3_jumpsuit_Sleeve_shape.csv @@ -1,9 +1,9 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shape_J_1,Sleeve_Shape,3 -Slim,attr_Sleeve_shape_J_2,Sleeve_Shape,3 -Puff,attr_Sleeve_shape_J_3,Sleeve_Shape,3 -Bell,attr_Sleeve_shape_J_4,Sleeve_Shape,3 -Batwing,attr_Sleeve_shape_J_5,Sleeve_Shape,3 -Shirt,attr_Sleeve_shape_J_6,Sleeve_Shape,3 -Rib,attr_Sleeve_shape_J_7,Sleeve_Shape,3 -Raglan,attr_Sleeve_shape_J_8,Sleeve_Shape,3 +Regular,attr_Sleeve_shape_J_1,Sleeve shape,3 +Slim,attr_Sleeve_shape_J_2,Sleeve shape,3 +Puff,attr_Sleeve_shape_J_3,Sleeve shape,3 +Bell,attr_Sleeve_shape_J_4,Sleeve shape,3 +Batwing,attr_Sleeve_shape_J_5,Sleeve shape,3 +Shirt,attr_Sleeve_shape_J_6,Sleeve shape,3 +Rib,attr_Sleeve_shape_J_7,Sleeve shape,3 +Raglan,attr_Sleeve_shape_J_8,Sleeve shape,3 diff --git a/app/service/attribute_recognition/discriptor/jumpsuit/4_jumpsuit_Sleeve_shoulder.csv b/app/service/attribute_recognition/discriptor/jumpsuit/4_jumpsuit_Sleeve_shoulder.csv index 47e067a..4f98a9f 100644 --- a/app/service/attribute_recognition/discriptor/jumpsuit/4_jumpsuit_Sleeve_shoulder.csv +++ b/app/service/attribute_recognition/discriptor/jumpsuit/4_jumpsuit_Sleeve_shoulder.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shoulder_J_1,Sleeve_Shoulder,4 -Cold,attr_Sleeve_shoulder_J_2,Sleeve_Shoulder,4 -Tucked,attr_Sleeve_shoulder_J_3,Sleeve_Shoulder,4 -Balmain,attr_Sleeve_shoulder_J_4,Sleeve_Shoulder,4 +Regular,attr_Sleeve_shoulder_J_1,Sleeve shoulder,4 +Cold,attr_Sleeve_shoulder_J_2,Sleeve shoulder,4 +Tucked,attr_Sleeve_shoulder_J_3,Sleeve shoulder,4 +Balmain,attr_Sleeve_shoulder_J_4,Sleeve shoulder,4 diff --git a/app/service/attribute_recognition/discriptor/outwear/11_outer_opening.csv b/app/service/attribute_recognition/discriptor/outwear/11_outer_opening.csv index d8c5372..53d0d42 100644 --- a/app/service/attribute_recognition/discriptor/outwear/11_outer_opening.csv +++ b/app/service/attribute_recognition/discriptor/outwear/11_outer_opening.csv @@ -1,3 +1,3 @@ labelName,join_attr,taskName,taskId -Full,attr_Opening_O_1,Opening_Type,11 -Half,attr_Opening_O_2,Opening_Type,11 +Full,attr_Opening_O_1,Opening,11 +Half,attr_Opening_O_2,Opening,11 diff --git a/app/service/attribute_recognition/discriptor/outwear/12_outer_OPType.csv b/app/service/attribute_recognition/discriptor/outwear/12_outer_OPType.csv index 3e4ee2c..8750eb1 100644 --- a/app/service/attribute_recognition/discriptor/outwear/12_outer_OPType.csv +++ b/app/service/attribute_recognition/discriptor/outwear/12_outer_OPType.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_O_1,Opening_Type,12 -Zipper,attr_OPType_O_2,Opening_Type,12 -Thread,attr_OPType_O_3,Opening_Type,12 -Hook,attr_OPType_O_4,Opening_Type,12 +Button,attr_OPType_O_1,Opening type,12 +Zipper,attr_OPType_O_2,Opening type,12 +Thread,attr_OPType_O_3,Opening type,12 +Hook,attr_OPType_O_4,Opening type,12 diff --git a/app/service/attribute_recognition/discriptor/outwear/2_outer_type.csv b/app/service/attribute_recognition/discriptor/outwear/2_outer_type.csv index 60b6ae5..8542302 100644 --- a/app/service/attribute_recognition/discriptor/outwear/2_outer_type.csv +++ b/app/service/attribute_recognition/discriptor/outwear/2_outer_type.csv @@ -15,4 +15,4 @@ Biker jacket,attr_Outer_type_13,Type,2 Pea coat,attr_Outer_type_14,Type,2 Shacket,attr_Outer_type_15,Type,2 Denim jacket,attr_Outer_type_16,Type,2 -Raincoat,attr_Outer_type_17,Type,2 +Raincoat,attr_Outer_type_17,Type,2 \ No newline at end of file diff --git a/app/service/attribute_recognition/discriptor/outwear/3_outer_sleeve_length.csv b/app/service/attribute_recognition/discriptor/outwear/3_outer_sleeve_length.csv index 8e35b85..eaed7aa 100644 --- a/app/service/attribute_recognition/discriptor/outwear/3_outer_sleeve_length.csv +++ b/app/service/attribute_recognition/discriptor/outwear/3_outer_sleeve_length.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Sleeveless,attr_sleeve_length_1,Sleeve_Length,3 -Short,attr_sleeve_length_2,Sleeve_Length,3 -Middle,attr_sleeve_length_3,Sleeve_Length,3 -Seven,attr_sleeve_length_4,Sleeve_Length,3 -Long,attr_sleeve_length_5,Sleeve_Length,3 +Sleeveless,attr_sleeve_length_1,Sleeve length,3 +Short,attr_sleeve_length_2,Sleeve length,3 +Middle,attr_sleeve_length_3,Sleeve length,3 +Seven,attr_sleeve_length_4,Sleeve length,3 +Long,attr_sleeve_length_5,Sleeve length,3 diff --git a/app/service/attribute_recognition/discriptor/outwear/4_outer_sleeve_shape.csv b/app/service/attribute_recognition/discriptor/outwear/4_outer_sleeve_shape.csv index 4e8f770..cfaf579 100644 --- a/app/service/attribute_recognition/discriptor/outwear/4_outer_sleeve_shape.csv +++ b/app/service/attribute_recognition/discriptor/outwear/4_outer_sleeve_shape.csv @@ -1,9 +1,9 @@ labelName,join_attr,taskName,taskId -Regular,attr_sleeve_shape_O_1,Sleeve_Shape,4 -Slim,attr_sleeve_shape_O_2,Sleeve_Shape,4 -Puff,attr_sleeve_shape_O_3,Sleeve_Shape,4 -Bell,attr_sleeve_shape_O_4,Sleeve_Shape,4 -Batwing,attr_sleeve_shape_O_5,Sleeve_Shape,4 -Shirt,attr_sleeve_shape_O_6,Sleeve_Shape,4 -Rib,attr_sleeve_shape_O_7,Sleeve_Shape,4 -Raglan,attr_sleeve_shape_O_8,Sleeve_Shape,4 +Regular,attr_sleeve_shape_O_1,Sleeve shape,4 +Slim,attr_sleeve_shape_O_2,Sleeve shape,4 +Puff,attr_sleeve_shape_O_3,Sleeve shape,4 +Bell,attr_sleeve_shape_O_4,Sleeve shape,4 +Batwing,attr_sleeve_shape_O_5,Sleeve shape,4 +Shirt,attr_sleeve_shape_O_6,Sleeve shape,4 +Rib,attr_sleeve_shape_O_7,Sleeve shape,4 +Raglan,attr_sleeve_shape_O_8,Sleeve shape,4 diff --git a/app/service/attribute_recognition/discriptor/outwear/5_outer_sleeve_shoulder.csv b/app/service/attribute_recognition/discriptor/outwear/5_outer_sleeve_shoulder.csv index 3e421d0..512d9de 100644 --- a/app/service/attribute_recognition/discriptor/outwear/5_outer_sleeve_shoulder.csv +++ b/app/service/attribute_recognition/discriptor/outwear/5_outer_sleeve_shoulder.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Regular,attr_sleeve_shoulder_O_1,Sleeve_Shoulder,5 -Cold,attr_sleeve_shoulder_O_2,Sleeve_Shoulder,5 -Tucked,attr_sleeve_shoulder_O_3,Sleeve_Shoulder,5 -Balmain,attr_sleeve_shoulder_O_4,Sleeve_Shoulder,5 -Drop Shoulder,attr_sleeve_shoulder_O_5,Sleeve_Shoulder,5 +Regular,attr_sleeve_shoulder_O_1,Sleeve shoulder,5 +Cold,attr_sleeve_shoulder_O_2,Sleeve shoulder,5 +Tucked,attr_sleeve_shoulder_O_3,Sleeve shoulder,5 +Balmain,attr_sleeve_shoulder_O_4,Sleeve shoulder,5 +Drop Shoulder,attr_sleeve_shoulder_O_5,Sleeve shoulder,5 diff --git a/app/service/attribute_recognition/discriptor/top/11_top_OPType.csv b/app/service/attribute_recognition/discriptor/top/11_top_OPType.csv index 870631b..34a3934 100644 --- a/app/service/attribute_recognition/discriptor/top/11_top_OPType.csv +++ b/app/service/attribute_recognition/discriptor/top/11_top_OPType.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_U_1,Opening_Type,11 -Zipper,attr_OPType_U_2,Opening_Type,11 -Thread,attr_OPType_U_3,Opening_Type,11 -Hook,attr_OPType_U_4,Opening_Type,11 +Button,attr_OPType_U_1,Opening type,11 +Zipper,attr_OPType_U_2,Opening type,11 +Thread,attr_OPType_U_3,Opening type,11 +Hook,attr_OPType_U_4,Opening type,11 diff --git a/app/service/attribute_recognition/discriptor/top/3_top_Sleeve_length.csv b/app/service/attribute_recognition/discriptor/top/3_top_Sleeve_length.csv index 1f2a0f3..cb9e969 100644 --- a/app/service/attribute_recognition/discriptor/top/3_top_Sleeve_length.csv +++ b/app/service/attribute_recognition/discriptor/top/3_top_Sleeve_length.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Sleeveless,attr_Sleeve_length_1,Sleeve_Length,3 -Short,attr_Sleeve_length_2,Sleeve_Length,3 -Middle,attr_Sleeve_length_3,Sleeve_Length,3 -Seven,attr_Sleeve_length_4,Sleeve_Length,3 -Long,attr_Sleeve_length_5,Sleeve_Length,3 +Sleeveless,attr_Sleeve_length_1,Sleeve length,3 +Short,attr_Sleeve_length_2,Sleeve length,3 +Middle,attr_Sleeve_length_3,Sleeve length,3 +Seven,attr_Sleeve_length_4,Sleeve length,3 +Long,attr_Sleeve_length_5,Sleeve length,3 diff --git a/app/service/attribute_recognition/discriptor/top/4_top_Sleeve_shape.csv b/app/service/attribute_recognition/discriptor/top/4_top_Sleeve_shape.csv index d429c11..2c53b12 100644 --- a/app/service/attribute_recognition/discriptor/top/4_top_Sleeve_shape.csv +++ b/app/service/attribute_recognition/discriptor/top/4_top_Sleeve_shape.csv @@ -1,9 +1,9 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shape_1,Sleeve_Shape,4 -Slim,attr_Sleeve_shape_2,Sleeve_Shape,4 -Puff,attr_Sleeve_shape_3,Sleeve_Shape,4 -Bell,attr_Sleeve_shape_4,Sleeve_Shape,4 -Batwing,attr_Sleeve_shape_5,Sleeve_Shape,4 -Shirt,attr_Sleeve_shape_6,Sleeve_Shape,4 -Rib,attr_Sleeve_shape_7,Sleeve_Shape,4 -Raglan,attr_Sleeve_shape_8,Sleeve_Shape,4 +Regular,attr_Sleeve_shape_1,Sleeve shape,4 +Slim,attr_Sleeve_shape_2,Sleeve shape,4 +Puff,attr_Sleeve_shape_3,Sleeve shape,4 +Bell,attr_Sleeve_shape_4,Sleeve shape,4 +Batwing,attr_Sleeve_shape_5,Sleeve shape,4 +Shirt,attr_Sleeve_shape_6,Sleeve shape,4 +Rib,attr_Sleeve_shape_7,Sleeve shape,4 +Raglan,attr_Sleeve_shape_8,Sleeve shape,4 diff --git a/app/service/attribute_recognition/discriptor/top/5_top_Sleeve_shoulder.csv b/app/service/attribute_recognition/discriptor/top/5_top_Sleeve_shoulder.csv index c31e7ea..7997bd5 100644 --- a/app/service/attribute_recognition/discriptor/top/5_top_Sleeve_shoulder.csv +++ b/app/service/attribute_recognition/discriptor/top/5_top_Sleeve_shoulder.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shoulder_1,Sleeve_Shoulder,5 -Cold,attr_Sleeve_shoulder_2,Sleeve_Shoulder,5 -Tucked,attr_Sleeve_shoulder_3,Sleeve_Shoulder,5 -Balmain,attr_Sleeve_shoulder_4,Sleeve_Shoulder,5 +Regular,attr_Sleeve_shoulder_1,Sleeve shoulder,5 +Cold,attr_Sleeve_shoulder_2,Sleeve shoulder,5 +Tucked,attr_Sleeve_shoulder_3,Sleeve shoulder,5 +Balmain,attr_Sleeve_shoulder_4,Sleeve shoulder,5 diff --git a/app/service/attribute_recognition/discriptor/top/ori12_top_OPType.csv b/app/service/attribute_recognition/discriptor/top/ori12_top_OPType.csv index 98e65c6..6bda0ed 100644 --- a/app/service/attribute_recognition/discriptor/top/ori12_top_OPType.csv +++ b/app/service/attribute_recognition/discriptor/top/ori12_top_OPType.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Button,attr_OPType_U_1,Opening_Type,12 -Zipper,attr_OPType_U_2,Opening_Type,12 -Thread,attr_OPType_U_3,Opening_Type,12 -Hook,attr_OPType_U_4,Opening_Type,12 +Button,attr_OPType_U_1,Opening type,12 +Zipper,attr_OPType_U_2,Opening type,12 +Thread,attr_OPType_U_3,Opening type,12 +Hook,attr_OPType_U_4,Opening type,12 diff --git a/app/service/attribute_recognition/discriptor/top/ori3_top_Sleeve_length.csv b/app/service/attribute_recognition/discriptor/top/ori3_top_Sleeve_length.csv index 3549164..b76a721 100644 --- a/app/service/attribute_recognition/discriptor/top/ori3_top_Sleeve_length.csv +++ b/app/service/attribute_recognition/discriptor/top/ori3_top_Sleeve_length.csv @@ -1,6 +1,6 @@ labelName,join_attr,taskName,taskId -Sleeveless,attr_Sleeve_length_U_1,Sleeve_Length,3 -Short,attr_Sleeve_length_U_2,Sleeve_Length,3 -Middle,attr_Sleeve_length_U_3,Sleeve_Length,3 -Seven,attr_Sleeve_length_U_4,Sleeve_Length,3 -Long,attr_Sleeve_length_U_5,Sleeve_Length,3 +Sleeveless,attr_Sleeve_length_U_1,Sleeve length,3 +Short,attr_Sleeve_length_U_2,Sleeve length,3 +Middle,attr_Sleeve_length_U_3,Sleeve length,3 +Seven,attr_Sleeve_length_U_4,Sleeve length,3 +Long,attr_Sleeve_length_U_5,Sleeve length,3 diff --git a/app/service/attribute_recognition/discriptor/top/ori4_top_Sleeve_shape.csv b/app/service/attribute_recognition/discriptor/top/ori4_top_Sleeve_shape.csv index 15517c5..1f75415 100644 --- a/app/service/attribute_recognition/discriptor/top/ori4_top_Sleeve_shape.csv +++ b/app/service/attribute_recognition/discriptor/top/ori4_top_Sleeve_shape.csv @@ -1,9 +1,9 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shape_U_1,Sleeve_Shape,4 -Slim,attr_Sleeve_shape_U_2,Sleeve_Shape,4 -Puff,attr_Sleeve_shape_U_3,Sleeve_Shape,4 -Bell,attr_Sleeve_shape_U_4,Sleeve_Shape,4 -Batwing,attr_Sleeve_shape_U_5,Sleeve_Shape,4 -Shirt,attr_Sleeve_shape_U_6,Sleeve_Shape,4 -Rib,attr_Sleeve_shape_U_7,Sleeve_Shape,4 -Raglan,attr_Sleeve_shape_U_8,Sleeve_Shape,4 +Regular,attr_Sleeve_shape_U_1,Sleeve shape,4 +Slim,attr_Sleeve_shape_U_2,Sleeve shape,4 +Puff,attr_Sleeve_shape_U_3,Sleeve shape,4 +Bell,attr_Sleeve_shape_U_4,Sleeve shape,4 +Batwing,attr_Sleeve_shape_U_5,Sleeve shape,4 +Shirt,attr_Sleeve_shape_U_6,Sleeve shape,4 +Rib,attr_Sleeve_shape_U_7,Sleeve shape,4 +Raglan,attr_Sleeve_shape_U_8,Sleeve shape,4 diff --git a/app/service/attribute_recognition/discriptor/top/ori5_top_Sleeve_shoulder.csv b/app/service/attribute_recognition/discriptor/top/ori5_top_Sleeve_shoulder.csv index 9a051a1..97b8bcd 100644 --- a/app/service/attribute_recognition/discriptor/top/ori5_top_Sleeve_shoulder.csv +++ b/app/service/attribute_recognition/discriptor/top/ori5_top_Sleeve_shoulder.csv @@ -1,5 +1,5 @@ labelName,join_attr,taskName,taskId -Regular,attr_Sleeve_shoulder_U_1,Sleeve_Shoulder,5 -Cold,attr_Sleeve_shoulder_U_2,Sleeve_Shoulder,5 -Tucked,attr_Sleeve_shoulder_U_3,Sleeve_Shoulder,5 -Balmain,attr_Sleeve_shoulder_U_4,Sleeve_Shoulder,5 +Regular,attr_Sleeve_shoulder_U_1,Sleeve shoulder,5 +Cold,attr_Sleeve_shoulder_U_2,Sleeve shoulder,5 +Tucked,attr_Sleeve_shoulder_U_3,Sleeve shoulder,5 +Balmain,attr_Sleeve_shoulder_U_4,Sleeve shoulder,5 From fbf0da2ef1a62eb3d47f6024bc6dcffb146b260f Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Wed, 3 Apr 2024 14:46:36 +0800 Subject: [PATCH 6/6] =?UTF-8?q?discriptor=20=E9=85=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b3dfd4d..f659040 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: "3" services: trinity_mixi: - image: "trinity_client_mixi:latest" container_name: trinity_mixi + build: . volumes: - ./trinity_client_mixi:/trinity ports: