12 Commits
local ... fix

Author SHA1 Message Date
zhh
05045dda76 feat(新功能): fix(修复bug): : refactor(重构): test(增加测试): 徐佩design测试 2025-09-23 11:38:33 +08:00
zhh
30f9a99df2 Merge branch 'develop'
# Conflicts:
#	app/service/design_fast/pipeline/split.py
2025-09-22 17:56:18 +08:00
zhh
79865d9a96 feat(新功能): fix(修复bug): : refactor(重构): test(增加测试): 2025-09-22 11:17:59 +08:00
zhh
a9a5964127 feat(新功能): fix(修复bug): : refactor(重构): test(增加测试): 2025-09-22 11:16:37 +08:00
zhh
47e991cd76 feat(新功能): fix(修复bug): : refactor(重构): test(增加测试): 2025-09-22 10:53:46 +08:00
zhh
8bc1ea576e feat(新功能):
fix(修复bug):  overall 坐标算法新增比例参数
docs(文档变更):
refactor(重构):
test(增加测试):
2025-09-22 10:48:58 +08:00
zhh
31e848e8bb feat(新功能): 灰色sketch图使print颜色变暗 解决方案测试
fix(修复bug):
docs(文档变更):
refactor(重构):
test(增加测试):
2025-09-22 10:41:09 +08:00
zhh
6da3712a76 feat(新功能):
fix(修复bug):  印花坐标计算方式新增sketch拉伸比例
docs(文档变更):
refactor(重构):
test(增加测试):
2025-09-19 10:40:21 +08:00
zhh
e6da512a31 feat(新功能):
fix(修复bug):  pattern_image (上色无印花sketch图),修改为不拉伸
docs(文档变更):
refactor(重构):
test(增加测试):
2025-09-18 15:33:01 +08:00
zhh
16d4844cca feat(新功能):
fix(修复bug):  pattern_image (上色无印花sketch图),修改为不拉伸
docs(文档变更):
refactor(重构):
test(增加测试):
2025-09-18 15:17:51 +08:00
zhh
978e0d998d feat(新功能):
fix(修复bug):  pattern_image (上色无印花sketch图),修改为不拉伸
docs(文档变更):
refactor(重构):
test(增加测试):
2025-09-18 15:05:31 +08:00
zhh
3932b8359a feat(新功能):
fix(修复bug):
docs(文档变更):
refactor(重构):
test(增加测试):  mask 使用原尺寸测试
2025-09-17 16:43:26 +08:00
6 changed files with 34 additions and 16 deletions

View File

@@ -37,7 +37,7 @@ else:
CHROMADB_PATH = "/chromadb/" CHROMADB_PATH = "/chromadb/"
# RABBITMQ_ENV = "" # 生产环境 # RABBITMQ_ENV = "" # 生产环境
RABBITMQ_ENV = os.getenv("RABBITMQ_ENV", "-dev") RABBITMQ_ENV = os.getenv("RABBITMQ_ENV", "-prod")
# RABBITMQ_ENV = "-local" # 本地测试环境 # RABBITMQ_ENV = "-local" # 本地测试环境
if RABBITMQ_ENV == "-dev": if RABBITMQ_ENV == "-dev":

View File

@@ -201,10 +201,10 @@ def design_generate_v2(request_data):
# 发送结果给java端 # 发送结果给java端
url = JAVA_STREAM_API_URL url = JAVA_STREAM_API_URL
# xu_pei_test_url = "https://cd21b9110505.ngrok-free.app/api/third/party/receiveDesignResults" # xu_pei_test_url = "https://cd21b9110505.ngrok-free.app/api/third/party/receiveDesignResults"
tianxaing_test_url = "https://c2ae520723c9.ngrok-free.app/api/third/party/receiveDesignResults" # tianxaing_test_url = "https://c2ae520723c9.ngrok-free.app/api/third/party/receiveDesignResults"
logger.info(f"java 回调 -> {url}") logger.info(f"java 回调 -> {url}")
# logger.info(f"xupei java 回调 -> {xu_pei_test_url}") # logger.info(f"xupei java 回调 -> {xu_pei_test_url}")
logger.info(f"tianxiang java 回调 -> {tianxaing_test_url}") # logger.info(f"tianxiang java 回调 -> {tianxaing_test_url}")
headers = { headers = {
'Accept': "*/*", 'Accept': "*/*",
@@ -220,12 +220,12 @@ def design_generate_v2(request_data):
logger.info(response.text) logger.info(response.text)
# test_response = post_request(xu_pei_test_url, json_data=items_response, headers=headers) # test_response = post_request(xu_pei_test_url, json_data=items_response, headers=headers)
test_response = post_request(tianxaing_test_url, json_data=items_response, headers=headers) # test_response = post_request(tianxaing_test_url, json_data=items_response, headers=headers)
if test_response: # if test_response:
# 打印结果 # 打印结果
# logger.info(f"xupei test response : {test_response.text}") # logger.info(f"xupei test response : {test_response.text}")
logger.info(f"tianxiang test response : {test_response.text}") # logger.info(f"tianxiang test response : {test_response.text}")
for step, object in enumerate(objects_data): for step, object in enumerate(objects_data):
t = threading.Thread(target=process_object, args=(step, object)) t = threading.Thread(target=process_object, args=(step, object))

View File

@@ -22,7 +22,7 @@ class Color:
resize_pattern = cv2.resize(pattern, (dim_image_w, dim_image_h), interpolation=cv2.INTER_AREA) resize_pattern = cv2.resize(pattern, (dim_image_w, dim_image_h), interpolation=cv2.INTER_AREA)
# 无色 # 无色
elif "color" not in result.keys() or result['color'] == "": elif "color" not in result.keys() or result['color'] == "":
result['final_image'] = result['pattern_image'] = result['single_image'] = result['image'] result['no_seg_sketch'] = result['final_image'] = result['pattern_image'] = result['single_image'] = result['image']
result['alpha'] = 100 / 255.0 result['alpha'] = 100 / 255.0
return result return result
# 正常颜色 # 正常颜色
@@ -59,6 +59,8 @@ class Color:
tmp2 = (result['final_image'] * (temp_fg / 255)).astype(np.uint8) tmp2 = (result['final_image'] * (temp_fg / 255)).astype(np.uint8)
result['single_image'] = cv2.add(tmp1, tmp2) result['single_image'] = cv2.add(tmp1, tmp2)
result['alpha'] = 100 / 255.0 result['alpha'] = 100 / 255.0
result['no_seg_sketch'] = result['final_image'].copy()
return result return result
def get_gradient(self, bucket_name, object_name): def get_gradient(self, bucket_name, object_name):

View File

@@ -24,6 +24,7 @@ class PrintPainting:
if result['resize_scale'][0] == 1.0 and result['resize_scale'][1] == 1.0: if result['resize_scale'][0] == 1.0 and result['resize_scale'][1] == 1.0:
pass pass
else: else:
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
height, width = result['pattern_image'].shape[:2] height, width = result['pattern_image'].shape[:2]
new_width = int(width * result['resize_scale'][0]) new_width = int(width * result['resize_scale'][0])
new_height = int(height * result['resize_scale'][1]) new_height = int(height * result['resize_scale'][1])
@@ -34,6 +35,7 @@ class PrintPainting:
result['gray'] = cv2.resize(result['gray'], (new_width, new_height)) result['gray'] = cv2.resize(result['gray'], (new_width, new_height))
if overall_print['print_path_list']: if overall_print['print_path_list']:
overall_print['location'][0] = [x * y for x, y in zip(overall_print['location'][0], result['resize_scale'])]
painting_dict = {'dim_image_h': result['pattern_image'].shape[0], 'dim_image_w': result['pattern_image'].shape[1]} painting_dict = {'dim_image_h': result['pattern_image'].shape[0], 'dim_image_w': result['pattern_image'].shape[1]}
result['print_image'] = result['pattern_image'] result['print_image'] = result['pattern_image']
if "print_angle_list" in overall_print.keys() and overall_print['print_angle_list'][0] != 0: if "print_angle_list" in overall_print.keys() and overall_print['print_angle_list'][0] != 0:
@@ -50,6 +52,9 @@ class PrintPainting:
result['single_image'] = result['final_image'] = result['pattern_image'] = result['print_image'] result['single_image'] = result['final_image'] = result['pattern_image'] = result['print_image']
if single_print['print_path_list']: if single_print['print_path_list']:
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
sketch_resize_scale = result['resize_scale']
print_background = np.zeros((result['pattern_image'].shape[0], result['pattern_image'].shape[1], 3), dtype=np.uint8) print_background = np.zeros((result['pattern_image'].shape[0], result['pattern_image'].shape[1], 3), dtype=np.uint8)
mask_background = np.zeros((result['pattern_image'].shape[0], result['pattern_image'].shape[1], 3), dtype=np.uint8) mask_background = np.zeros((result['pattern_image'].shape[0], result['pattern_image'].shape[1], 3), dtype=np.uint8)
for i in range(len(single_print['print_path_list'])): for i in range(len(single_print['print_path_list'])):
@@ -67,8 +72,8 @@ class PrintPainting:
rotated_resized_source_mask = resized_source_mask.rotate(-single_print['print_angle_list'][i]) rotated_resized_source_mask = resized_source_mask.rotate(-single_print['print_angle_list'][i])
source_image_pil = Image.fromarray(cv2.cvtColor(print_background, cv2.COLOR_BGR2RGB)) source_image_pil = Image.fromarray(cv2.cvtColor(print_background, cv2.COLOR_BGR2RGB))
source_image_pil_mask = Image.fromarray(cv2.cvtColor(mask_background, cv2.COLOR_BGR2RGB)) source_image_pil_mask = Image.fromarray(cv2.cvtColor(mask_background, cv2.COLOR_BGR2RGB))
source_image_pil.paste(rotated_resized_source, (int(single_print['location'][i][0]), int(single_print['location'][i][1])), rotated_resized_source) source_image_pil.paste(rotated_resized_source, (int(single_print['location'][i][0] * sketch_resize_scale[0]), int(single_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source)
source_image_pil_mask.paste(rotated_resized_source_mask, (int(single_print['location'][i][0]), int(single_print['location'][i][1])), rotated_resized_source_mask) source_image_pil_mask.paste(rotated_resized_source_mask, (int(single_print['location'][i][0] * sketch_resize_scale[0]), int(single_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source_mask)
print_background = cv2.cvtColor(np.array(source_image_pil), cv2.COLOR_RGBA2BGR) print_background = cv2.cvtColor(np.array(source_image_pil), cv2.COLOR_RGBA2BGR)
mask_background = cv2.cvtColor(np.array(source_image_pil_mask), cv2.COLOR_RGBA2BGR) mask_background = cv2.cvtColor(np.array(source_image_pil_mask), cv2.COLOR_RGBA2BGR)
ret, mask_background = cv2.threshold(mask_background, 124, 255, cv2.THRESH_BINARY) ret, mask_background = cv2.threshold(mask_background, 124, 255, cv2.THRESH_BINARY)
@@ -146,7 +151,9 @@ class PrintPainting:
img_bg = cv2.bitwise_and(result['pattern_image'], result['pattern_image'], mask=cv2.bitwise_not(print_mask)) img_bg = cv2.bitwise_and(result['pattern_image'], result['pattern_image'], mask=cv2.bitwise_not(print_mask))
mask_mo = np.expand_dims(print_mask, axis=2).repeat(3, axis=2) mask_mo = np.expand_dims(print_mask, axis=2).repeat(3, axis=2)
gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2) gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2)
img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) # 当sketch 图像为灰色时(非纯白) 印花*灰度图像会导致印花在sketch上颜色变暗
# img_fg = (img_fg * (mask_mo / 255) ).astype(np.uint8) # 不过灰度图像
result['final_image'] = cv2.add(img_bg, img_fg) result['final_image'] = cv2.add(img_bg, img_fg)
canvas = np.full_like(result['final_image'], 255) canvas = np.full_like(result['final_image'], 255)
temp_bg = np.expand_dims(cv2.bitwise_not(result['mask']), axis=2).repeat(3, axis=2) temp_bg = np.expand_dims(cv2.bitwise_not(result['mask']), axis=2).repeat(3, axis=2)
@@ -156,6 +163,9 @@ class PrintPainting:
result['single_image'] = cv2.add(tmp1, tmp2) result['single_image'] = cv2.add(tmp1, tmp2)
if element_print['element_path_list']: if element_print['element_path_list']:
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
sketch_resize_scale = result['resize_scale']
print_background = np.zeros((result['final_image'].shape[0], result['final_image'].shape[1], 3), dtype=np.uint8) print_background = np.zeros((result['final_image'].shape[0], result['final_image'].shape[1], 3), dtype=np.uint8)
mask_background = np.zeros((result['final_image'].shape[0], result['final_image'].shape[1], 3), dtype=np.uint8) mask_background = np.zeros((result['final_image'].shape[0], result['final_image'].shape[1], 3), dtype=np.uint8)
for i in range(len(element_print['element_path_list'])): for i in range(len(element_print['element_path_list'])):
@@ -173,8 +183,8 @@ class PrintPainting:
source_image_pil = Image.fromarray(cv2.cvtColor(print_background, cv2.COLOR_BGR2RGB)) source_image_pil = Image.fromarray(cv2.cvtColor(print_background, cv2.COLOR_BGR2RGB))
source_image_pil_mask = Image.fromarray(cv2.cvtColor(mask_background, cv2.COLOR_BGR2RGB)) source_image_pil_mask = Image.fromarray(cv2.cvtColor(mask_background, cv2.COLOR_BGR2RGB))
source_image_pil.paste(rotated_resized_source, (int(element_print['location'][i][0]), int(element_print['location'][i][1])), rotated_resized_source) source_image_pil.paste(rotated_resized_source, (int(element_print['location'][i][0] * sketch_resize_scale[0]), int(element_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source)
source_image_pil_mask.paste(rotated_resized_source_mask, (int(element_print['location'][i][0]), int(element_print['location'][i][1])), rotated_resized_source_mask) source_image_pil_mask.paste(rotated_resized_source_mask, (int(element_print['location'][i][0] * sketch_resize_scale[1]), int(element_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source_mask)
print_background = cv2.cvtColor(np.array(source_image_pil), cv2.COLOR_RGBA2BGR) print_background = cv2.cvtColor(np.array(source_image_pil), cv2.COLOR_RGBA2BGR)
mask_background = cv2.cvtColor(np.array(source_image_pil_mask), cv2.COLOR_RGBA2BGR) mask_background = cv2.cvtColor(np.array(source_image_pil_mask), cv2.COLOR_RGBA2BGR)

View File

@@ -67,7 +67,6 @@ class Split(object):
# mask_image = np.zeros((height, width, 3)) # mask_image = np.zeros((height, width, 3))
# mask_image[front_mask != 0] = [0, 0, 255] # mask_image[front_mask != 0] = [0, 0, 255]
# 切换为原始图片尺寸------------------------------- # 切换为原始图片尺寸-------------------------------
height, width = ori_front_mask.shape height, width = ori_front_mask.shape
mask_image = np.zeros((height, width, 3)) mask_image = np.zeros((height, width, 3))
@@ -113,7 +112,6 @@ class Split(object):
# mask_image[back_mask != 0] = [0, 255, 0] # mask_image[back_mask != 0] = [0, 255, 0]
mask_image[ori_back_mask != 0] = [0, 255, 0] mask_image[ori_back_mask != 0] = [0, 255, 0]
rbga_mask = rgb_to_rgba(mask_image, ori_front_mask + ori_back_mask) rbga_mask = rgb_to_rgba(mask_image, ori_front_mask + ori_back_mask)
mask_pil = Image.fromarray(cvtColor(rbga_mask.astype(np.uint8), COLOR_BGR2RGBA)) mask_pil = Image.fromarray(cvtColor(rbga_mask.astype(np.uint8), COLOR_BGR2RGBA))
image_data = io.BytesIO() image_data = io.BytesIO()
@@ -124,7 +122,7 @@ class Split(object):
result['mask_url'] = req.bucket_name + "/" + req.object_name result['mask_url'] = req.bucket_name + "/" + req.object_name
# 创建中间图层 # 创建中间图层
result_pattern_image_rgba = rgb_to_rgba(result['pattern_image'], result['mask']) result_pattern_image_rgba = rgb_to_rgba(result['no_seg_sketch'], ori_front_mask + ori_back_mask)
result_pattern_image_pil = Image.fromarray(cvtColor(result_pattern_image_rgba, COLOR_BGR2RGBA)) result_pattern_image_pil = Image.fromarray(cvtColor(result_pattern_image_rgba, COLOR_BGR2RGBA))
result['pattern_image'], result['pattern_image_url'], _ = upload_png_mask(self.minio_client, result_pattern_image_pil, f'{generate_uuid()}') result['pattern_image'], result['pattern_image_url'], _ = upload_png_mask(self.minio_client, result_pattern_image_pil, f'{generate_uuid()}')
return result return result

View File

@@ -57,7 +57,15 @@ def organize_clothing(layer):
def organize_accessories(layer): def organize_accessories(layer):
# 起始坐标 # 起始坐标
start_point = calculate_start_point(layer['keypoint'], layer['scale'], {'accessories_left': [0, 0]}, {'accessories_left': [0, 0]}, layer["offset"], layer["resize_scale"]) start_point = (0, 0)
layer['clothes_keypoint'] = {
'accessories_left': [0, 0]
}
layer['body_point_test'] = {
'accessories_left': [0, 0]
}
start_point = calculate_start_point(layer['keypoint'], layer['scale'], layer['clothes_keypoint'], layer['body_point_test'], layer["offset"], layer["resize_scale"])
# 前片数据 # 前片数据
front_layer = dict(priority=layer['priority'] if layer.get("layer_order", False) else PRIORITY_DICT.get(f'{layer["name"].lower()}_front', None), front_layer = dict(priority=layer['priority'] if layer.get("layer_order", False) else PRIORITY_DICT.get(f'{layer["name"].lower()}_front', None),