feat design 提速测试
fix
This commit is contained in:
@@ -30,7 +30,6 @@ class Painting(object):
|
|||||||
resize_pattern = cv2.resize(pattern, (dim_image_w, dim_image_h), interpolation=cv2.INTER_AREA)
|
resize_pattern = cv2.resize(pattern, (dim_image_w, dim_image_h), interpolation=cv2.INTER_AREA)
|
||||||
closed_mo = np.expand_dims(result['mask'], axis=2).repeat(3, axis=2)
|
closed_mo = np.expand_dims(result['mask'], axis=2).repeat(3, axis=2)
|
||||||
gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2)
|
gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2)
|
||||||
logger.info(f"image id is :{result['image_id']}")
|
|
||||||
get_image_fir = resize_pattern * (closed_mo / 255) * (gray_mo / 255)
|
get_image_fir = resize_pattern * (closed_mo / 255) * (gray_mo / 255)
|
||||||
result['pattern_image'] = get_image_fir.astype(np.uint8)
|
result['pattern_image'] = get_image_fir.astype(np.uint8)
|
||||||
result['final_image'] = result['pattern_image']
|
result['final_image'] = result['pattern_image']
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cv2
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from app.core.config import SEG_CACHE_PATH
|
from app.core.config import SEG_CACHE_PATH
|
||||||
|
from app.service.utils.decorator import ClassCallRunTime
|
||||||
from app.service.utils.oss_client import oss_get_image
|
from app.service.utils.oss_client import oss_get_image
|
||||||
from ..builder import PIPELINES
|
from ..builder import PIPELINES
|
||||||
from ...utils.design_ensemble import get_seg_result
|
from ...utils.design_ensemble import get_seg_result
|
||||||
@@ -15,7 +16,7 @@ logger = logging.getLogger()
|
|||||||
@PIPELINES.register_module()
|
@PIPELINES.register_module()
|
||||||
class Segmentation(object):
|
class Segmentation(object):
|
||||||
|
|
||||||
# @ClassCallRunTime
|
@ClassCallRunTime
|
||||||
def __call__(self, result):
|
def __call__(self, result):
|
||||||
if "seg_mask_url" in result.keys() and result['seg_mask_url'] != "":
|
if "seg_mask_url" in result.keys() and result['seg_mask_url'] != "":
|
||||||
seg_mask = oss_get_image(bucket=result['seg_mask_url'].split('/')[0], object_name=result['seg_mask_url'][result['seg_mask_url'].find('/') + 1:], data_type="cv2")
|
seg_mask = oss_get_image(bucket=result['seg_mask_url'].split('/')[0], object_name=result['seg_mask_url'][result['seg_mask_url'].find('/') + 1:], data_type="cv2")
|
||||||
@@ -59,7 +60,6 @@ class Segmentation(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def load_seg_result(image_id):
|
def load_seg_result(image_id):
|
||||||
file_path = f"{SEG_CACHE_PATH}{image_id}.npy"
|
file_path = f"{SEG_CACHE_PATH}{image_id}.npy"
|
||||||
logger.info(f"load seg file name is :{SEG_CACHE_PATH}{image_id}.npy")
|
|
||||||
try:
|
try:
|
||||||
seg_result = np.load(file_path)
|
seg_result = np.load(file_path)
|
||||||
return True, seg_result
|
return True, seg_result
|
||||||
|
|||||||
Reference in New Issue
Block a user