1603 lines
63 KiB
Python
1603 lines
63 KiB
Python
import logging
|
||
import threading
|
||
import time
|
||
|
||
import requests
|
||
from minio import Minio
|
||
|
||
from app.core.config import *
|
||
from app.service.design_fast.item import BodyItem, TopItem, BottomItem, AccessoriesItem
|
||
from app.service.design_fast.utils.organize import organize_body, organize_clothing, organize_accessories
|
||
from app.service.design_fast.utils.progress import final_progress, update_progress
|
||
from app.service.design_fast.utils.synthesis_item import synthesis, synthesis_single, update_base_size_priority
|
||
from app.service.utils.decorator import RunTime
|
||
|
||
id_lock = threading.Lock()
|
||
|
||
logger = logging.getLogger()
|
||
|
||
minio_client = Minio(MINIO_URL, access_key=MINIO_ACCESS, secret_key=MINIO_SECRET, secure=MINIO_SECURE)
|
||
|
||
|
||
def process_item(item, basic):
|
||
# 处理project中单个item
|
||
if item['type'] == "Body":
|
||
body_server = BodyItem(data=item, basic=basic, minio_client=minio_client)
|
||
item_data = body_server.process()
|
||
elif item['type'].lower() in ['blouse', 'outwear', 'dress', 'tops']:
|
||
top_server = TopItem(data=item, basic=basic, minio_client=minio_client)
|
||
item_data = top_server.process()
|
||
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)
|
||
item_data = bottom_server.process()
|
||
else:
|
||
raise NotImplementedError(f"Item type {item['type']} not implemented")
|
||
return item_data
|
||
|
||
|
||
def process_layer(item, layers):
|
||
# item处理结束后 对图层数据组装
|
||
if item['name'] == "mannequin":
|
||
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)
|
||
layers.append(front_layer)
|
||
layers.append(back_layer)
|
||
else:
|
||
front_layer, back_layer = organize_clothing(item)
|
||
layers.append(front_layer)
|
||
layers.append(back_layer)
|
||
|
||
|
||
@RunTime
|
||
def design_generate(request_data):
|
||
objects_data = request_data.dict()['objects']
|
||
process_id = request_data.dict()['process_id']
|
||
object_response = {}
|
||
threads = []
|
||
active_threads = 0
|
||
lock = threading.Lock()
|
||
total = len(objects_data)
|
||
|
||
def process_object(step, object):
|
||
nonlocal active_threads
|
||
basic = object['basic']
|
||
items_response = {'layers': [], 'objectSign': object['objectSign'] if 'objectSign' in object.keys() else ""}
|
||
if basic['single_overall'] == "overall":
|
||
item_results = []
|
||
for item in object['items']:
|
||
item_results.append(process_item(item, basic))
|
||
layers = []
|
||
body_size = None
|
||
for item in item_results:
|
||
body_size = process_layer(item, layers)
|
||
layers = sorted(layers, key=lambda s: s.get("priority", float('inf')))
|
||
|
||
layers, new_size = update_base_size_priority(layers, body_size)
|
||
|
||
for lay in layers:
|
||
items_response['layers'].append({
|
||
'image_category': "body" if lay['name'] == 'mannequin' else lay['name'],
|
||
'position': lay['position'],
|
||
'priority': lay.get("priority", None),
|
||
'resize_scale': lay['resize_scale'] if "resize_scale" in lay.keys() else None,
|
||
'image_size': lay['image'] if lay['image'] is None else lay['image'].size,
|
||
'gradient_string': lay['gradient_string'] if 'gradient_string' in lay.keys() else "",
|
||
'mask_url': lay['mask_url'],
|
||
'image_url': lay['image_url'] if 'image_url' in lay.keys() else None,
|
||
'pattern_image_url': lay['pattern_image_url'] if 'pattern_image_url' in lay.keys() else None,
|
||
# 'back_perspective_url': lay['back_perspective_url'] if 'back_perspective_url' in lay.keys() else None,
|
||
})
|
||
items_response['synthesis_url'] = synthesis(layers, new_size, basic)
|
||
else:
|
||
item_result = process_item(object['items'][0], basic)
|
||
items_response['layers'].append({
|
||
'image_category': f"{item_result['name']}_front",
|
||
'image_size': item_result['back_image'].size if item_result['back_image'] else None,
|
||
'position': None,
|
||
'priority': 0,
|
||
'image_url': item_result['front_image_url'],
|
||
'mask_url': item_result['mask_url'],
|
||
"gradient_string": item_result['gradient_string'] if 'gradient_string' in item_result.keys() else "",
|
||
'pattern_image_url': item_result['pattern_image_url'] if 'pattern_image_url' in item_result.keys() else None,
|
||
})
|
||
items_response['layers'].append({
|
||
'image_category': f"{item_result['name']}_back",
|
||
'image_size': item_result['front_image'].size if item_result['front_image'] else None,
|
||
'position': None,
|
||
'priority': 0,
|
||
'image_url': item_result['back_image_url'],
|
||
'mask_url': item_result['mask_url'],
|
||
"gradient_string": item_result['gradient_string'] if 'gradient_string' in item_result.keys() else "",
|
||
'pattern_image_url': item_result['pattern_image_url'] if 'pattern_image_url' in item_result.keys() else None,
|
||
})
|
||
items_response['synthesis_url'] = synthesis_single(item_result['front_image'], item_result['back_image'])
|
||
update_progress(process_id, total)
|
||
|
||
with lock:
|
||
object_response[step] = items_response
|
||
active_threads -= 1
|
||
|
||
for step, object in enumerate(objects_data):
|
||
t = threading.Thread(target=process_object, args=(step, object))
|
||
threads.append(t)
|
||
t.start()
|
||
with lock:
|
||
active_threads += 1
|
||
|
||
for t in threads:
|
||
t.join()
|
||
final_progress(process_id)
|
||
return object_response
|
||
|
||
|
||
@RunTime
|
||
def design_generate_v2(request_data):
|
||
objects_data = request_data.dict()['objects']
|
||
request_id = request_data.requestId
|
||
threads = []
|
||
|
||
def process_object(step, object):
|
||
basic = object['basic']
|
||
items_response = {
|
||
'layers': [],
|
||
'objectSign': object['objectSign'] if 'objectSign' in object.keys() else "",
|
||
'requestId': request_id
|
||
}
|
||
if basic['single_overall'] == "overall":
|
||
item_results = []
|
||
for item in object['items']:
|
||
item_results.append(process_item(item, basic))
|
||
layers = []
|
||
body_size = None
|
||
for item in item_results:
|
||
body_size = process_layer(item, layers)
|
||
layers = sorted(layers, key=lambda s: s.get("priority", float('inf')))
|
||
|
||
layers, new_size = update_base_size_priority(layers, body_size)
|
||
|
||
for lay in layers:
|
||
items_response['layers'].append({
|
||
'image_category': "body" if lay['name'] == 'mannequin' else lay['name'],
|
||
'position': lay['position'],
|
||
'priority': lay.get("priority", None),
|
||
'resize_scale': lay['resize_scale'] if "resize_scale" in lay.keys() else None,
|
||
'image_size': lay['image'] if lay['image'] is None else lay['image'].size,
|
||
'gradient_string': lay['gradient_string'] if 'gradient_string' in lay.keys() else "",
|
||
'mask_url': lay['mask_url'],
|
||
'image_url': lay['image_url'] if 'image_url' in lay.keys() else None,
|
||
'pattern_image_url': lay['pattern_image_url'] if 'pattern_image_url' in lay.keys() else None,
|
||
# 'back_perspective_url': lay['back_perspective_url'] if 'back_perspective_url' in lay.keys() else None,
|
||
})
|
||
items_response['synthesis_url'] = synthesis(layers, new_size, basic)
|
||
else:
|
||
item_result = process_item(object['items'][0], basic)
|
||
items_response['layers'].append({
|
||
'image_category': f"{item_result['name']}_front",
|
||
'image_size': item_result['back_image'].size if item_result['back_image'] else None,
|
||
'position': None,
|
||
'priority': 0,
|
||
'image_url': item_result['front_image_url'],
|
||
'mask_url': item_result['mask_url'],
|
||
"gradient_string": item_result['gradient_string'] if 'gradient_string' in item_result.keys() else "",
|
||
'pattern_image_url': item_result['pattern_image_url'] if 'pattern_image_url' in item_result.keys() else None,
|
||
})
|
||
items_response['layers'].append({
|
||
'image_category': f"{item_result['name']}_back",
|
||
'image_size': item_result['front_image'].size if item_result['front_image'] else None,
|
||
'position': None,
|
||
'priority': 0,
|
||
'image_url': item_result['back_image_url'],
|
||
'mask_url': item_result['mask_url'],
|
||
"gradient_string": item_result['gradient_string'] if 'gradient_string' in item_result.keys() else "",
|
||
'pattern_image_url': item_result['pattern_image_url'] if 'pattern_image_url' in item_result.keys() else None,
|
||
})
|
||
items_response['synthesis_url'] = synthesis_single(item_result['front_image'], item_result['back_image'])
|
||
# 发送结果给java端
|
||
url = JAVA_STREAM_API_URL
|
||
xu_pei_test_url = "https://137f6b5c3490.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"xupei java 回调 -> {xu_pei_test_url}")
|
||
logger.info(f"tianxiang java 回调 -> {tianxaing_test_url}")
|
||
|
||
headers = {
|
||
'Accept': "*/*",
|
||
'Accept-Encoding': "gzip, deflate, br",
|
||
'User-Agent': "PostmanRuntime-ApipostRuntime/1.1.0",
|
||
'Connection': "keep-alive",
|
||
'Content-Type': "application/json"
|
||
}
|
||
# logger.info(items_response)
|
||
response = post_request(url, json_data=items_response, headers=headers)
|
||
if response:
|
||
# 打印结果
|
||
logger.info(response.text)
|
||
|
||
test_xp_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)
|
||
|
||
if test_response:
|
||
# 打印结果
|
||
logger.info(f"tianxiang test response : {test_response.text}")
|
||
if test_xp_response:
|
||
logger.info(f"xupei test response : {test_xp_response.text}")
|
||
|
||
for step, object in enumerate(objects_data):
|
||
t = threading.Thread(target=process_object, args=(step, object))
|
||
threads.append(t)
|
||
t.start()
|
||
|
||
|
||
def post_request(url, data=None, json_data=None, headers=None, auth=None, timeout=5):
|
||
"""
|
||
发送POST请求的封装函数
|
||
|
||
:param url: 接口的URL地址
|
||
:param data: 要发送的数据(字典形式,用于表单数据等,会自动编码)
|
||
:param json_data: 要发送的JSON数据(字典形式,会自动转换为JSON字符串)
|
||
:param headers: 请求头字典
|
||
:param auth: 认证信息(如 ('username', 'password') 形式用于基本认证)
|
||
:param timeout: 超时时间,单位为秒
|
||
:return: 返回接口的响应对象
|
||
"""
|
||
try:
|
||
response = requests.post(
|
||
url,
|
||
data=data,
|
||
json=json_data,
|
||
headers=headers,
|
||
auth=auth,
|
||
timeout=timeout
|
||
)
|
||
response.raise_for_status() # 如果请求失败,抛出异常
|
||
return response
|
||
except requests.RequestException as e:
|
||
print(f"POST请求出错: {e}")
|
||
return None
|
||
|
||
|
||
if __name__ == '__main__':
|
||
object_data = {
|
||
"objects": [
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 98419,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/dress/0825000526.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Dress"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 98420,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/skirt/903000127.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Skirt"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 69140,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/blouse/0902001100.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Blouse"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 81604,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/outwear/outwear_p5_729.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Outwear"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 63964,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/outwear/0825001572.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Outwear"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 98421,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/blouse/blouse_506.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Blouse"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 98422,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/trousers/0628001244.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Trousers"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 79927,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/outwear/0825000378.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Outwear"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 67473,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/blouse/0825001350.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Blouse"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 80046,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/skirt/0628001443.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Skirt"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 84148,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/trousers/0628000751.jpeg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Trousers"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 97321,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/blouse/0902000222.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Blouse"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 90718,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/outwear/0825000314.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Outwear"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 86403,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/skirt/0902000231.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Skirt"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 87135,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/blouse/0902001315.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Blouse"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 87428,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/outwear/0902000566.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Outwear"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 98423,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/dress/0916001596.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Dress"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"basic": {
|
||
"body_point_test": {
|
||
"waistband_right": [
|
||
203,
|
||
249
|
||
],
|
||
"hand_point_right": [
|
||
229,
|
||
343
|
||
],
|
||
"waistband_left": [
|
||
119,
|
||
248
|
||
],
|
||
"hand_point_left": [
|
||
97,
|
||
343
|
||
],
|
||
"shoulder_left": [
|
||
108,
|
||
107
|
||
],
|
||
"shoulder_right": [
|
||
212,
|
||
107
|
||
]
|
||
},
|
||
"layer_order": False,
|
||
"scale_bag": 0.7,
|
||
"scale_earrings": 0.16,
|
||
"self_template": True,
|
||
"single_overall": "overall",
|
||
"switch_category": ""
|
||
},
|
||
"items": [
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 86345,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/outwear/0825000695.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Outwear"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 78743,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/blouse/0902001412.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Blouse"
|
||
},
|
||
{
|
||
"color": "28 26 26",
|
||
"icon": "none",
|
||
"image_id": 68988,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"path": "aida-sys-image/images/female/trousers/0825000403.jpg",
|
||
"print": {
|
||
"element": {
|
||
"element_angle_list": [],
|
||
"element_path_list": [],
|
||
"element_scale_list": [],
|
||
"location": []
|
||
},
|
||
"overall": {
|
||
"location": [
|
||
[
|
||
0.0,
|
||
0.0
|
||
]
|
||
],
|
||
"print_angle_list": [
|
||
0.0,
|
||
0.0
|
||
],
|
||
"print_path_list": [],
|
||
"print_scale_list": [
|
||
0.0,
|
||
0.0
|
||
]
|
||
},
|
||
"single": {
|
||
"location": [],
|
||
"print_angle_list": [],
|
||
"print_path_list": [],
|
||
"print_scale_list": []
|
||
}
|
||
},
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Trousers"
|
||
},
|
||
{
|
||
"body_path": "aida-sys-image/models/female/2e4815b9-1191-419d-94ed-5771239ca4a5.png",
|
||
"image_id": 67277,
|
||
"offset": [
|
||
1,
|
||
1
|
||
],
|
||
"resize_scale": [
|
||
1.0,
|
||
1.0
|
||
],
|
||
"type": "Body"
|
||
}
|
||
]
|
||
}
|
||
],
|
||
"process_id": "123"
|
||
}
|
||
start_time = time.time()
|
||
X = design_generate(object_data)
|
||
print(time.time() - start_time)
|
||
print(X)
|