feat(新功能):
fix(修复bug): accessories 替换为 others docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -5,9 +5,9 @@ from celery import Celery
|
||||
from minio import Minio
|
||||
|
||||
from app.core.config import *
|
||||
from app.service.design_batch.item import BodyItem, TopItem, BottomItem, AccessoriesItem
|
||||
from app.service.design_batch.item import BodyItem, TopItem, BottomItem, OthersItem
|
||||
from app.service.design_batch.utils.MQ import publish_status
|
||||
from app.service.design_batch.utils.organize import organize_body, organize_clothing, organize_accessories
|
||||
from app.service.design_batch.utils.organize import organize_body, organize_clothing, organize_others
|
||||
from app.service.design_batch.utils.save_json import oss_upload_json
|
||||
from app.service.design_batch.utils.synthesis_item import update_base_size_priority, synthesis, synthesis_single
|
||||
|
||||
@@ -33,8 +33,8 @@ def process_item(item, basic):
|
||||
elif item['type'].lower() in ['skirt', 'trousers', 'bottoms']:
|
||||
bottom_server = BottomItem(data=item, basic=basic, minio_client=minio_client)
|
||||
item_data = bottom_server.process()
|
||||
elif item['type'].lower() in ['accessories']:
|
||||
bottom_server = AccessoriesItem(data=item, basic=basic, minio_client=minio_client)
|
||||
elif item['type'].lower() in ['others']:
|
||||
bottom_server = OthersItem(data=item, basic=basic, minio_client=minio_client)
|
||||
item_data = bottom_server.process()
|
||||
else:
|
||||
raise NotImplementedError(f"Item type {item['type']} not implemented")
|
||||
@@ -47,8 +47,8 @@ def process_layer(item, layers):
|
||||
body_layer = organize_body(item)
|
||||
layers.append(body_layer)
|
||||
return item['body_image'].size
|
||||
elif item['name'] == 'accessories':
|
||||
front_layer, back_layer = organize_accessories(item)
|
||||
elif item['name'] == 'others':
|
||||
front_layer, back_layer = organize_others(item)
|
||||
layers.append(front_layer)
|
||||
layers.append(back_layer)
|
||||
else:
|
||||
|
||||
@@ -9,10 +9,10 @@ class BaseItem:
|
||||
self.result.update(basic)
|
||||
|
||||
|
||||
class AccessoriesItem(BaseItem):
|
||||
class OthersItem(BaseItem):
|
||||
def __init__(self, data, basic, minio_client):
|
||||
super().__init__(data, basic)
|
||||
self.Accessories_pipeline = [
|
||||
self.Others_pipeline = [
|
||||
LoadImage(minio_client),
|
||||
# KeyPoint(),
|
||||
ContourDetection(),
|
||||
@@ -25,7 +25,7 @@ class AccessoriesItem(BaseItem):
|
||||
]
|
||||
|
||||
def process(self):
|
||||
for item in self.Accessories_pipeline:
|
||||
for item in self.Others_pipeline:
|
||||
self.result = item(self.result)
|
||||
return self.result
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ class LoadImage:
|
||||
keypoint = 'head_point'
|
||||
elif name == 'earring':
|
||||
keypoint = 'ear_point'
|
||||
elif name == 'accessories':
|
||||
keypoint = "accessories"
|
||||
elif name == 'others':
|
||||
keypoint = "others"
|
||||
else:
|
||||
raise KeyError(f"{name} does not belong to item category list: blouse, outwear, dress, trousers, skirt, "
|
||||
f"bag, shoes, hairstyle, earring.")
|
||||
|
||||
@@ -46,7 +46,7 @@ class Scaling:
|
||||
result['scale'] = result['scale_bag']
|
||||
elif result['keypoint'] == 'ear_point':
|
||||
result['scale'] = result['scale_earrings']
|
||||
elif result['keypoint'] == 'accessories':
|
||||
elif result['keypoint'] == 'others':
|
||||
# 由于没有识别配饰keypoint的模型 所以统一将配饰的两个关键点设定为 (0,0) (0,img.width)
|
||||
# 模特的关键点设定为(0,0) (0,320/2) 距离比例简写为 160 / img.width
|
||||
distance_clo = result['img_shape'][1]
|
||||
|
||||
@@ -21,7 +21,7 @@ class Split(object):
|
||||
def __call__(self, result):
|
||||
try:
|
||||
|
||||
if result['name'] in ('outwear', 'dress', 'blouse', 'skirt', 'trousers', 'tops', 'bottoms', 'accessories'):
|
||||
if result['name'] in ('outwear', 'dress', 'blouse', 'skirt', 'trousers', 'tops', 'bottoms', 'others'):
|
||||
|
||||
if result['resize_scale'][0] == 1.0 and result['resize_scale'][1] == 1.0:
|
||||
front_mask = result['front_mask']
|
||||
|
||||
@@ -55,7 +55,7 @@ def organize_clothing(layer):
|
||||
return front_layer, back_layer
|
||||
|
||||
|
||||
def organize_accessories(layer):
|
||||
def organize_others(layer):
|
||||
# 起始坐标
|
||||
start_point = (0, 0)
|
||||
# 前片数据
|
||||
|
||||
Reference in New Issue
Block a user