From 9a00fce0eb7166ea30dfcfacc4a45c7b80cdbe54 Mon Sep 17 00:00:00 2001 From: zcr Date: Tue, 3 Feb 2026 16:43:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=B0=E8=8A=B1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=99=A4overall=E4=BB=A5=E5=A4=96=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=8D=B0=E8=8A=B1=E7=B1=BB=E5=9E=8B=20fix:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.backup.py | 235 ------------------ .../pipeline/no_seg_print_painting.py | 12 +- .../design_fast/pipeline/print_painting.py | 14 +- 3 files changed, 17 insertions(+), 244 deletions(-) delete mode 100644 app/core/config.backup.py diff --git a/app/core/config.backup.py b/app/core/config.backup.py deleted file mode 100644 index e6c7283..0000000 --- a/app/core/config.backup.py +++ /dev/null @@ -1,235 +0,0 @@ -import os - -import pika -from dotenv import load_dotenv -from pydantic import BaseSettings - -BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')) -load_dotenv(os.path.join(BASE_DIR, '.env')) - - -class Settings(BaseSettings): - PROJECT_NAME: str = 'FASTAPI BASE' - SECRET_KEY: str = '' - API_PREFIX: str = '' - BACKEND_CORS_ORIGINS: list[str] = ['*'] - DATABASE_URL: str = '' - ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days - SECURITY_ALGORITHM: str = 'HS256' - LOGGING_CONFIG_FILE: str = os.path.join(BASE_DIR, 'logging_env.py') - - -OSS = "minio" -DEBUG = False -if DEBUG: - LOGS_PATH = "logs/" - CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv" - SEG_CACHE_PATH = "../seg_cache/" - POSE_TRANSFORM_VIDEO_PATH = "../pose_transform_video/" - RECOMMEND_PATH_PREFIX = "service/recommend/" - CHROMADB_PATH = "./chromadb/" -else: - LOGS_PATH = "app/logs/" - CATEGORY_PATH = "app/service/attribute/config/descriptor/category/category_dis.csv" - SEG_CACHE_PATH = "/seg_cache/" - POSE_TRANSFORM_VIDEO_PATH = "/pose_transform_video/" - RECOMMEND_PATH_PREFIX = "app/service/recommend/" - CHROMADB_PATH = "/chromadb/" - -# RABBITMQ_ENV = "" # 生产环境 -RABBITMQ_ENV = os.getenv("RABBITMQ_ENV", "-dev") -# RABBITMQ_ENV = "-local" # 本地测试环境 - -if RABBITMQ_ENV == "-dev": - JAVA_STREAM_API_URL = f"https://develop.api.aida.com.hk/api/third/party/receiveDesignResults" -elif RABBITMQ_ENV == "-prod": - JAVA_STREAM_API_URL = f"https://api.aida.com.hk/api/third/party/receiveDesignResults" - -settings = Settings() - -# minio 配置 -MINIO_URL = "www.minio-api.aida.com.hk" -MINIO_ACCESS = 'vXKFLSJkYeEq2DrSZvkB' -MINIO_SECRET = 'uKTZT3x7C43WvPN9QTc99DiRkwddWZrG9Uh3JVlR' -MINIO_SECURE = True - -# S3 配置 -S3_ACCESS_KEY = "AKIAVD3OJIMF6UJFLSHZ" -S3_AWS_SECRET_ACCESS_KEY = "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" -S3_REGION_NAME = "ap-east-1" - -# redis 配置 -REDIS_HOST = "10.1.1.240" -REDIS_PORT = "6379" -REDIS_DB = "2" - -# rabbitmq config -RABBITMQ_PARAMS = { - "host": "18.167.251.121", - "port": 5672, - "credentials": pika.credentials.PlainCredentials(username='rabbit', password='123456'), - "virtual_host": "/" -} - -# milvus 配置 -MILVUS_URL = "http://10.1.1.240:19530" -MILVUS_TOKEN = "root:Milvus" -MILVUS_ALIAS = "default" -MILVUS_TABLE_KEYPOINT = "keypoint_cache_2" -MILVUS_TABLE_SEG = "seg_cache" - -# Mysql 配置 -DB_HOST = '18.167.251.121' # 数据库主机地址 -# DB_PORT = int( 33006) -DB_PORT = 33008 # 数据库端口 -DB_USERNAME = 'aida_con_python' # 数据库用户名 -DB_PASSWORD = '123456' # 数据库密码 -DB_NAME = 'aida' # 数据库库名 - -# openai -os.environ['SERPAPI_API_KEY'] = "a793513017b0718db7966207c31703d280d12435c982f1e67bbcbffa52e7632c" -OPENAI_STREAM = True -BUFFER_THRESHOLD = 6 # must be even number -SINGLE_TOKEN_THRESHOLD = 200 -TOKEN_THRESHOLD = 600 -OPENAI_TEMPERATURE = 0 - -# OPENAI_API_KEY = "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" -OPENAI_API_KEY = "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" -OPENAI_MODEL = "gpt-3.5-turbo-0613" -OPENAI_MODEL_LIST = {"gpt-3.5-turbo-0613", - "gpt-3.5-turbo-16k-0613", - "gpt-4-0314", - "gpt-4-32k-0314", - "gpt-4-0613", - "gpt-4-32k-0613", } - -# SR service config -SR_MODEL_NAME = "super_resolution" -SR_TRITON_URL = "10.1.1.240:10031" -SR_MINIO_BUCKET = "aida-users" -SR_RABBITMQ_QUEUES = f"SuperResolution{RABBITMQ_ENV}" - -# GenerateImage service config -FAST_GI_MODEL_URL = '10.1.1.243:10011' -FAST_GI_MODEL_NAME = 'stable_diffusion_xl' - -GI_MODEL_URL = '10.1.1.240:10061' -GI_MODEL_NAME = 'flux' - -GMV_MODEL_URL = '10.1.1.243:10081' -GMV_MODEL_NAME = 'multi_view' - -GMV_RABBITMQ_QUEUES = f"GenerateMultiView{RABBITMQ_ENV}" - -GI_MINIO_BUCKET = "aida-users" -GI_RABBITMQ_QUEUES = f"GenerateImage{RABBITMQ_ENV}" -GI_SYS_IMAGE_URL = "aida-sys-image/generate_image/white_image.jpg" - -# SLOGAN service config -SLOGAN_RABBITMQ_QUEUES = f"Slogan{RABBITMQ_ENV}" - -# Generate Single Logo service config -GSL_MODEL_URL = '10.1.1.243:10041' -GSL_MINIO_BUCKET = "aida-users" -GSL_MODEL_NAME = 'stable_diffusion_xl_transparent' -GEN_SINGLE_LOGO_RABBITMQ_QUEUES = f"GenSingleLogo{RABBITMQ_ENV}" - -# Generate Product service config -# GPI_RABBITMQ_QUEUES = os.getenv("GEN_PRODUCT_IMAGE_RABBITMQ_QUEUES", f"ToProductImage{RABBITMQ_ENV}") -# GPI_MODEL_NAME_OVERALL = 'sdxl_ensemble_all' -# GPI_MODEL_URL = '10.1.1.243:10051' - -# Generate Product service config 旧版product img 模型 -GPI_RABBITMQ_QUEUES = f"ToProductImage{RABBITMQ_ENV}" -BATCH_GPI_RABBITMQ_QUEUES = f"BatchToProductImage{RABBITMQ_ENV}" -GPI_MODEL_NAME_OVERALL = 'diffusion_ensemble_all' -GPI_MODEL_NAME_SINGLE = 'stable_diffusion_1_5_cnet' -GPI_MODEL_URL = '10.1.1.243:10051' - -# Generate Single Logo service config -GRI_RABBITMQ_QUEUES = f"Relight{RABBITMQ_ENV}" -BATCH_GRI_RABBITMQ_QUEUES = f"BatchRelight{RABBITMQ_ENV}" -GRI_MODEL_NAME_OVERALL = 'diffusion_relight_ensemble' -GRI_MODEL_NAME_SINGLE = 'stable_diffusion_1_5_relight' -GRI_MODEL_URL = '10.1.1.240:10051' - -# Pose Transform service config - -PS_RABBITMQ_QUEUES = f"PoseTransform{RABBITMQ_ENV}" -BATCH_PS_RABBITMQ_QUEUES = f"BatchPoseTransform{RABBITMQ_ENV}" -PT_MODEL_URL = '10.1.1.243:10061' - -# SEG service config -SEGMENTATION = { - "new_model_name": "seg_knet", - "name": "seg_ocrnet_hr18", - "input": "seg_input__0", - "output": "seg_output__0", -} -# ollama config -OLLAMA_URL = "http://10.1.1.240:11434/api/embeddings" - -# design batch -BATCH_DESIGN_RABBITMQ_QUEUES = f"DesignBatch{RABBITMQ_ENV}" - -# DESIGN config -DESIGN_MODEL_URL = '10.1.1.240:10000' -AIDA_CLOTHING = "aida-clothing" -KEYPOINT_RESULT_TABLE_FIELD_SET = ('neckline_left', 'neckline_right', 'shoulder_left', 'shoulder_right', 'armpit_left', 'armpit_right', - 'cuff_left_in', 'cuff_left_out', 'cuff_right_in', 'cuff_right_out', 'waistband_left', 'waistband_right') - -# DESIGN 预处理 -IF_DEBUG_SHOW = False - -# 优先级 -PRIORITY_DICT = { - 'earring_front': 99, - 'bag_front': 98, - 'hairstyle_front': 97, - 'outwear_front': 20, - 'tops_front': 19, - 'dress_front': 18, - 'blouse_front': 17, - 'skirt_front': 16, - 'trousers_front': 15, - 'bottoms_front': 14, - 'shoes_right': 1, - 'shoes_left': 1, - 'body': 0, - 'bottoms_back': -14, - 'trousers_back': -15, - 'skirt_back': -16, - 'blouse_back': -17, - 'dress_back': -18, - 'tops_back': -19, - 'outwear_back': -20, - 'hairstyle_back': -97, - 'bag_back': -98, - 'earring_back': -99, -} - -QWEN_API_KEY = "sk-f31c29e61ac2498ba5e307aaa6dc10e0" - -DB_CONFIG = { - "host": "18.167.251.121", - "port": 3306, - "user": "root", - "password": "QWa998345", - "database": "aida", - "charset": "utf8mb4" -} - -TABLE_CATEGORIES = { - "female_dress": "female/dress", - "female_outwear": "female/outwear", - "female_trousers": "female/trousers", - "female_skirt": "female/skirt", - "female_blouse": "female/blouse", - "male_tops": "male/tops", - "male_bottoms": "male/bottoms", - "male_outwear": "male/outwear" -} - -# --- ComfyUI 配置信息 --- -COMFYUI_SERVER_ADDRESS = "10.1.2.227:8080" # 替换为您的 ComfyUI 服务器地址 diff --git a/app/service/design_fast/pipeline/no_seg_print_painting.py b/app/service/design_fast/pipeline/no_seg_print_painting.py index 0cf8cf1..3341c81 100644 --- a/app/service/design_fast/pipeline/no_seg_print_painting.py +++ b/app/service/design_fast/pipeline/no_seg_print_painting.py @@ -12,9 +12,13 @@ class NoSegPrintPainting: self.minio_client = minio_client def __call__(self, result): - single_print = result['print']['single'] + # single_print = [result['print']['single']] overall_print = result['print']['overall'] - element_print = result['print']['element'] + # element_print = result['print']['element' + + single_print = None + element_print = None + result['single_image'] = None result['print_image'] = None @@ -25,7 +29,7 @@ class NoSegPrintPainting: result['no_seg_sketch_overall'] = result['no_seg_sketch_print'] = self.printpaint(result, painting_dict, print_=True) result['pattern_image'] = result['no_seg_sketch_overall'] - if single_print['print_path_list']: + if single_print: 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) for i in range(len(single_print['print_path_list'])): @@ -65,7 +69,7 @@ class NoSegPrintPainting: single_image = cv2.add(tmp1, tmp2) result['no_seg_sketch_print'] = single_image - if element_print['element_path_list']: + if element_print: 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) for i in range(len(element_print['element_path_list'])): diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index 8464762..fd54c59 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -12,10 +12,14 @@ class PrintPainting: self.minio_client = minio_client def __call__(self, result): - single_print = result['print']['single'] + # single_print = result['print']['single'] overall_print = result['print']['overall'] - element_print = result['print']['element'] - partial_path = result['print']['partial'] if 'partial' in result['print'] else None + # element_print = result['print']['element'] + # partial_path = result['print']['partial'] if 'partial' in result['print'] else None + + single_print = None + element_print = None + partial_path = None result['single_image'] = None result['print_image'] = None # TODO 给result['pattern_image'] resize 到resize_scale的大小 @@ -43,7 +47,7 @@ class PrintPainting: result['print_image'] = self.printpaint(result, painting_dict, print_=True) result['single_image'] = result['final_image'] = result['pattern_image'] = result['print_image'] - if single_print['print_path_list']: + if single_print: # 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) @@ -84,7 +88,7 @@ class PrintPainting: tmp2 = (result['final_image'] * (temp_fg / 255)).astype(np.uint8) result['single_image'] = cv2.add(tmp1, tmp2) - if element_print['element_path_list']: + if element_print: # 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)