diff --git a/app/service/design_fast/utils/design_ensemble.py b/app/service/design_fast/utils/design_ensemble.py index bfc50c6..8eef4f2 100644 --- a/app/service/design_fast/utils/design_ensemble.py +++ b/app/service/design_fast/utils/design_ensemble.py @@ -25,6 +25,7 @@ from app.core.config import * def keypoint_preprocess(img_path): img = mmcv.imread(img_path) + img = cv2.copyMakeBorder(img, 25, 25, 25, 25, cv2.BORDER_CONSTANT, value=[255, 255, 255]) img_scale = (256, 256) h, w = img.shape[:2] img = cv2.resize(img, img_scale) @@ -62,7 +63,11 @@ def keypoint_postprocess(output, scale_factor): scale_matrix = np.diag(scale_factor) nan = np.isinf(scale_matrix) scale_matrix[nan] = 0 - return np.ceil(np.dot(segment_result, scale_matrix) * 4) + # 应用缩放因子 + scaled_result = np.ceil(np.dot(segment_result, scale_matrix) * 4) + # 补偿边框偏移 + compensated_result = scaled_result - 25 + return compensated_result """