feat: 印花逻辑修改 默认不处理除overall以外所有印花类型
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
fix:
This commit is contained in:
@@ -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 = "LNIwFFB27/QedtZ+Q/viVUoX9F5x1DbuM8N0DkD8"
|
|
||||||
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 服务器地址
|
|
||||||
@@ -12,9 +12,13 @@ class NoSegPrintPainting:
|
|||||||
self.minio_client = minio_client
|
self.minio_client = minio_client
|
||||||
|
|
||||||
def __call__(self, result):
|
def __call__(self, result):
|
||||||
single_print = result['print']['single']
|
# single_print = [result['print']['single']]
|
||||||
overall_print = result['print']['overall']
|
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['single_image'] = None
|
||||||
result['print_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['no_seg_sketch_overall'] = result['no_seg_sketch_print'] = self.printpaint(result, painting_dict, print_=True)
|
||||||
result['pattern_image'] = result['no_seg_sketch_overall']
|
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)
|
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'])):
|
||||||
@@ -65,7 +69,7 @@ class NoSegPrintPainting:
|
|||||||
single_image = cv2.add(tmp1, tmp2)
|
single_image = cv2.add(tmp1, tmp2)
|
||||||
result['no_seg_sketch_print'] = single_image
|
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)
|
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'])):
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ class PrintPainting:
|
|||||||
self.minio_client = minio_client
|
self.minio_client = minio_client
|
||||||
|
|
||||||
def __call__(self, result):
|
def __call__(self, result):
|
||||||
single_print = result['print']['single']
|
# single_print = result['print']['single']
|
||||||
overall_print = result['print']['overall']
|
overall_print = result['print']['overall']
|
||||||
element_print = result['print']['element']
|
# element_print = result['print']['element']
|
||||||
partial_path = result['print']['partial'] if 'partial' in result['print'] else None
|
# 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['single_image'] = None
|
||||||
result['print_image'] = None
|
result['print_image'] = None
|
||||||
# TODO 给result['pattern_image'] resize 到resize_scale的大小
|
# TODO 给result['pattern_image'] resize 到resize_scale的大小
|
||||||
@@ -43,7 +47,7 @@ class PrintPainting:
|
|||||||
result['print_image'] = self.printpaint(result, painting_dict, print_=True)
|
result['print_image'] = self.printpaint(result, painting_dict, print_=True)
|
||||||
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:
|
||||||
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
|
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
|
||||||
sketch_resize_scale = result['resize_scale']
|
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)
|
||||||
@@ -84,7 +88,7 @@ class PrintPainting:
|
|||||||
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)
|
||||||
|
|
||||||
if element_print['element_path_list']:
|
if element_print:
|
||||||
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
|
# 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整
|
||||||
sketch_resize_scale = result['resize_scale']
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user