feat
fix seg cache debug
This commit is contained in:
@@ -13,6 +13,8 @@ from app.schemas.pre_processing import DesignPreProcessingModel
|
|||||||
from app.service.design.utils.design_ensemble import get_keypoint_result, get_seg_result
|
from app.service.design.utils.design_ensemble import get_keypoint_result, get_seg_result
|
||||||
from app.service.utils.oss_client import oss_get_image, oss_upload_image
|
from app.service.utils.oss_client import oss_get_image, oss_upload_image
|
||||||
|
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class DesignPreprocessing:
|
class DesignPreprocessing:
|
||||||
# def __init__(self):
|
# def __init__(self):
|
||||||
@@ -21,19 +23,19 @@ class DesignPreprocessing:
|
|||||||
# @ RunTime
|
# @ RunTime
|
||||||
def pipeline(self, image_list):
|
def pipeline(self, image_list):
|
||||||
sketches_list = self.read_image(image_list)
|
sketches_list = self.read_image(image_list)
|
||||||
logging.info("read image success")
|
# logging.info("read image success")
|
||||||
|
|
||||||
bounding_box_sketches_list = self.bounding_box(sketches_list)
|
bounding_box_sketches_list = self.bounding_box(sketches_list)
|
||||||
logging.info("bounding box image success")
|
# logging.info("bounding box image success")
|
||||||
|
|
||||||
super_resolution_list = self.super_resolution(bounding_box_sketches_list)
|
super_resolution_list = self.super_resolution(bounding_box_sketches_list)
|
||||||
logging.info("super_resolution_list image success")
|
# logging.info("super_resolution_list image success")
|
||||||
|
|
||||||
infer_sketches_list = self.infer_image(super_resolution_list)
|
infer_sketches_list = self.infer_image(super_resolution_list)
|
||||||
logging.info("infer image success")
|
# logging.info("infer image success")
|
||||||
|
|
||||||
result = self.composing_image(infer_sketches_list)
|
result = self.composing_image(infer_sketches_list)
|
||||||
logging.info("Replenish white edge image success")
|
# logging.info("Replenish white edge image success")
|
||||||
|
|
||||||
for d in result:
|
for d in result:
|
||||||
if 'image_obj' in d:
|
if 'image_obj' in d:
|
||||||
@@ -100,7 +102,7 @@ class DesignPreprocessing:
|
|||||||
padding_left,
|
padding_left,
|
||||||
padding_right,
|
padding_right,
|
||||||
cv2.BORDER_CONSTANT,
|
cv2.BORDER_CONSTANT,
|
||||||
value=(255, 255, 255) # 你可以选择填充颜色,例如黑色
|
value=(255, 255, 255)
|
||||||
)
|
)
|
||||||
item['obj'] = padded_image
|
item['obj'] = padded_image
|
||||||
return image_list
|
return image_list
|
||||||
@@ -156,6 +158,9 @@ class DesignPreprocessing:
|
|||||||
# 推理获得seg 结果
|
# 推理获得seg 结果
|
||||||
seg_result = get_seg_result(sketch["image_id"], sketch['obj'])[0]
|
seg_result = get_seg_result(sketch["image_id"], sketch['obj'])[0]
|
||||||
self.save_seg_result(seg_result, sketch['image_id'])
|
self.save_seg_result(seg_result, sketch['image_id'])
|
||||||
|
logger.info(f"{sketch['image_id']} image size is :{sketch['obj'].shape} , seg cache size is :{seg_result.shape}")
|
||||||
|
else:
|
||||||
|
logger.info(f"{sketch['image_id']} image size is :{sketch['obj'].shape} , seg cache size is :{seg_cache.shape}")
|
||||||
|
|
||||||
if IF_DEBUG_SHOW:
|
if IF_DEBUG_SHOW:
|
||||||
debug_show_image = sketch['obj'].copy()
|
debug_show_image = sketch['obj'].copy()
|
||||||
|
|||||||
Reference in New Issue
Block a user