From bf9c27c24ee64f7ecc6e1386324b6abcf655deb4 Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Tue, 16 Apr 2024 15:54:31 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat=20generate=20=E5=8D=87=E7=BA=A7=20attr?= =?UTF-8?q?ibute=20retrieve=20=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- app/core/config.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c577312..0e94af1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ LABEL maintainer="zchengrong@yeah.net" \ name="trinity_aida" -CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app" , "-e", "SR_RABBITMQ_QUEUES=SuperResolution-dev" ,"-e", "GI_RABBITMQ_QUEUES=GenerateImage-dev"] \ No newline at end of file +CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app" , "-e", "SR_RABBITMQ_QUEUES=SuperResolution" ,"-e", "GI_RABBITMQ_QUEUES=GenerateImage"] \ No newline at end of file diff --git a/app/core/config.py b/app/core/config.py index 23ff405..bf3f4fc 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -27,8 +27,8 @@ else: LOGS_PATH = "app/logs/" CATEGORY_PATH = "app/service/attribute/config/descriptor/category/category_dis.csv" -# RABBITMQ_ENV = "" # 生产环境 -RABBITMQ_ENV = "-dev" # 开发环境 +RABBITMQ_ENV = "" # 生产环境 +# RABBITMQ_ENV = "-dev" # 开发环境 # RABBITMQ_ENV = "-local" # 本地测试环境 settings = Settings() From ed0eba0eea4f6b26100b721870e0fad2f565496c Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Mon, 22 Apr 2024 14:32:45 +0800 Subject: [PATCH 2/5] feat --- app/core/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 4889db8..e645328 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -27,9 +27,9 @@ else: LOGS_PATH = "app/logs/" CATEGORY_PATH = "app/service/attribute/config/descriptor/category/category_dis.csv" -# RABBITMQ_ENV = "" # 生产环境 +RABBITMQ_ENV = "" # 生产环境 # RABBITMQ_ENV = "-dev" # 开发环境 -RABBITMQ_ENV = "-local" # 本地测试环境 +# RABBITMQ_ENV = "-local" # 本地测试环境 settings = Settings() From 22a5eb2b1b38bf98a30a1ecc201a98bfe26eced6 Mon Sep 17 00:00:00 2001 From: LiaoFJ <50604988+LiaoFJ@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:19:37 +0800 Subject: [PATCH 3/5] add function "adjust_contrast" in the function callback for better image displaying. --- app/service/generate_image/service.py | 3 +- .../generate_image/utils/adjust_contrast.py | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 app/service/generate_image/utils/adjust_contrast.py diff --git a/app/service/generate_image/service.py b/app/service/generate_image/service.py index d0bda9a..45346bf 100644 --- a/app/service/generate_image/service.py +++ b/app/service/generate_image/service.py @@ -23,7 +23,7 @@ from tritonclient.utils import np_to_triton_dtype from app.core.config import * from app.schemas.generate_image import GenerateImageModel from app.service.generate_image.utils.upload_sd_image import upload_png_sd - +from app.service.generate_image.utils.adjust_contrast import adjust_contrast logger = logging.getLogger() @@ -71,6 +71,7 @@ class GenerateImage: self.redis_client.set(self.tasks_id, json.dumps(self.generate_data)) else: image_result = result.as_numpy("generated_image")[0] + image_result = adjust_contrast(image_result) image_url = upload_png_sd(image_result, user_id=self.user_id, category=f"{self.category}", object_name=f"{self.tasks_id}.png") self.generate_data['status'] = "SUCCESS" self.generate_data['message'] = "success" diff --git a/app/service/generate_image/utils/adjust_contrast.py b/app/service/generate_image/utils/adjust_contrast.py new file mode 100644 index 0000000..4ed110e --- /dev/null +++ b/app/service/generate_image/utils/adjust_contrast.py @@ -0,0 +1,31 @@ +import cv2 + +def adjust_contrast(image, alpha=1.5, beta=-60): + """ + 调整图像的对比度和亮度。 + + 参数: + image_path (numpy): 图像的路径。 + alpha (float): 控制对比度的系数。alpha > 1 增加对比度,alpha < 1 减少对比度。 + beta (int): 用于调整亮度的值,可以是正或负。 + + 返回: + adjusted_image (ndarray): 调整对比度后的图像。 + """ + + adjusted_image = cv2.convertScaleAbs(image, alpha=alpha, beta=beta) + return adjusted_image + + +# 使用示例 +if __name__ == "__main__": + image = cv2.imread('output_6.png') # 替换为你的图片路径 + img_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) + + alpha = 1.5 # 对比度系数,大于1增加对比度 + beta = -60 # 亮度调整,这里设置为0,不改变亮度 + + # 调整图像对比度 + result_image = adjust_contrast(image, alpha, beta) + # 可以选择保存调整后的图像 + cv2.imwrite('adjusted_image.jpg', result_image) # 保存调整后的图片 \ No newline at end of file From 7bf6eb2e7cc96f2498204d2e5478944d7df86cef Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Tue, 21 May 2024 10:14:10 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat=20=E4=BA=BA=E8=84=B8=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/generate_image/utils/image_processing.py | 1 - 1 file changed, 1 deletion(-) diff --git a/app/service/generate_image/utils/image_processing.py b/app/service/generate_image/utils/image_processing.py index 3602cab..f6d87f2 100644 --- a/app/service/generate_image/utils/image_processing.py +++ b/app/service/generate_image/utils/image_processing.py @@ -214,7 +214,6 @@ def stain_detection(image, user_id, category, tasks_id, spot_size=100): logger.info("中心区域存在连续的纯白区域") is_pure_white = True else: - logger.info("中心区域不存在连续的纯白区域") is_pure_white = False if is_pure_white: From 94e8e9c7c5e1390fad1999dbfbef57ecaf3119af Mon Sep 17 00:00:00 2001 From: zhouchengrong Date: Tue, 9 Jul 2024 10:08:11 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat=20fix=20update=20minio=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/config.py b/app/core/config.py index 8b94834..73ac0d1 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -37,7 +37,7 @@ RABBITMQ_ENV = "" # 生产环境 settings = Settings() # minio 配置 -MINIO_URL = "www.minio.aida.com.hk:9000" +MINIO_URL = "www.minio.aida.com.hk:12024" MINIO_ACCESS = 'vXKFLSJkYeEq2DrSZvkB' MINIO_SECRET = 'uKTZT3x7C43WvPN9QTc99DiRkwddWZrG9Uh3JVlR' MINIO_SECURE = True