|
|
@@ -24,6 +24,7 @@ class ScoreService:
|
|
|
|
|
|
logger.info("开始进行卡片居中和转正")
|
|
|
img_bgr = self.rectify_center_service.rectify_and_center(img_bgr)
|
|
|
+ imageHeight, imageWidth = img_bgr.shape[:2]
|
|
|
|
|
|
logger.info("开始进行卡片分数推理")
|
|
|
if score_type == 'front_corner_edge' or score_type == 'front_face':
|
|
|
@@ -81,7 +82,9 @@ class ScoreService:
|
|
|
|
|
|
result_json = self.card_scorer.formate_one_card_result(center_score_data, defect_score_data,
|
|
|
card_defect_type=card_defect_type,
|
|
|
- card_aspect=card_aspect)
|
|
|
+ card_aspect=card_aspect,
|
|
|
+ imageHeight=imageHeight,
|
|
|
+ imageWidth=imageWidth)
|
|
|
|
|
|
temp_score_json_path = settings.TEMP_WORK_DIR / f'{score_type}_score.json'
|
|
|
with open(temp_score_json_path, 'w', encoding='utf-8') as f:
|
|
|
@@ -93,6 +96,8 @@ class ScoreService:
|
|
|
|
|
|
center_json_data = json_data["result"]['center_result']
|
|
|
defect_json_data = json_data["result"]['defect_result']
|
|
|
+ imageHeight = json_data["result"].get('imageHeight', 0)
|
|
|
+ imageWidth = json_data["result"].get('imageWidth', 0)
|
|
|
|
|
|
# 边角和面 类型分类
|
|
|
if score_type == 'front_corner_edge' or score_type == 'back_corner_edge':
|
|
|
@@ -132,7 +137,9 @@ class ScoreService:
|
|
|
|
|
|
result_json = self.card_scorer.formate_one_card_result(center_score_data, defect_score_data,
|
|
|
card_defect_type=inference_type,
|
|
|
- card_aspect=card_aspect)
|
|
|
+ card_aspect=card_aspect,
|
|
|
+ imageHeight=imageHeight,
|
|
|
+ imageWidth=imageWidth)
|
|
|
|
|
|
temp_score_json_path = settings.TEMP_WORK_DIR / f're_{score_type}_score.json'
|
|
|
with open(temp_score_json_path, 'w', encoding='utf-8') as f:
|