Bladeren bron

初次修改分数漏掉的情况

AnlaAnla 2 weken geleden
bovenliggende
commit
e4bf79cfec
2 gewijzigde bestanden met toevoegingen van 199 en 68 verwijderingen
  1. 193 68
      app/core/scoring_config.json
  2. 6 0
      app/utils/score_inference/CardScorer.py

+ 193 - 68
app/core/scoring_config.json

@@ -149,16 +149,16 @@
       ]
     },
     "front_weights": {
-      "wear_area": 0.3,
-      "loss_area": 0.7
+      "wear_area": 1,
+      "loss_area": 1
     },
     "back_weights": {
-      "wear_area": 0.3,
-      "loss_area": 0.7
+      "wear_area": 1,
+      "loss_area": 1
     },
     "final_weights": {
-      "front": 0.7,
-      "back": 0.3
+      "front": 1.4,
+      "back": 0.6
     }
   },
   "edge": {
@@ -310,16 +310,16 @@
       ]
     },
     "front_weights": {
-      "wear_area": 0.4,
-      "loss_area": 0.6
+      "wear_area": 0.8,
+      "loss_area": 1.2
     },
     "back_weights": {
-      "wear_area": 0.4,
-      "loss_area": 0.6
+      "wear_area": 0.8,
+      "loss_area": 1.2
     },
     "final_weights": {
-      "front": 0.7,
-      "back": 0.3
+      "front": 1.4,
+      "back": 0.6
     }
   },
   "face": {
@@ -327,137 +327,262 @@
       "wear_area": [
         {
           "min": 0,
-          "max": 0.02,
-          "deduction": "-0.01"
+          "max": 0.01,
+          "deduction": -0.01
         },
         {
-          "min": 0.02,
+          "min": 0.01,
           "max": 0.05,
-          "deduction": "-0.05"
+          "deduction": -0.05
         },
         {
           "min": 0.05,
           "max": 0.1,
-          "deduction": "-0.1"
+          "deduction": -0.1
         },
         {
           "min": 0.1,
-          "max": 0.2,
-          "deduction": "-0.2"
-        },
-        {
-          "min": 0.2,
           "max": 0.5,
-          "deduction": "-0.3"
+          "deduction": -0.25
         },
         {
           "min": 0.5,
           "max": 1,
-          "deduction": "-0.5"
+          "deduction": -0.5
         },
         {
           "min": 1,
           "max": 1.5,
-          "deduction": "-1.0"
+          "deduction": -0.75
         },
         {
           "min": 1.5,
           "max": 2,
-          "deduction": "-1.5"
+          "deduction": -1
         },
         {
           "min": 2,
+          "max": 2.5,
+          "deduction": -1.5
+        },
+        {
+          "min": 2.5,
           "max": 3,
-          "deduction": "-2.0"
+          "deduction": -2
         },
         {
           "min": 3,
-          "max": 5,
-          "deduction": "-2.5"
+          "max": 4,
+          "deduction": -2.5
         },
         {
-          "min": 5,
-          "max": 7.5,
-          "deduction": "-3"
+          "min": 4,
+          "max": 6,
+          "deduction": -3
         },
         {
-          "min": 7.5,
-          "max": 10,
-          "deduction": "-3.5"
+          "min": 6,
+          "max": 8,
+          "deduction": -3.5
         },
         {
-          "min": 10,
-          "max": 12.5,
-          "deduction": "-4"
+          "min": 8,
+          "max": 10,
+          "deduction": -4
         },
         {
-          "min": 12.5,
+          "min": 10,
           "max": 15,
-          "deduction": "-4.5"
+          "deduction": -4.5
         },
         {
           "min": 15,
           "max": 20,
-          "deduction": "-5"
+          "deduction": -5
         },
         {
           "min": 20,
+          "max": 30,
+          "deduction": -5.5
+        },
+        {
+          "min": 30,
           "max": "inf",
-          "deduction": "-6"
+          "deduction": -6
         }
       ],
       "pit_area": [
         {
           "min": 0,
+          "max": 0.01,
+          "deduction": -0.01
+        },
+        {
+          "min": 0.01,
           "max": 0.05,
-          "deduction": -0.1
+          "deduction": -0.05
         },
         {
           "min": 0.05,
           "max": 0.1,
-          "deduction": -0.5
+          "deduction": -0.1
         },
         {
           "min": 0.1,
-          "max": 0.25,
+          "max": 0.5,
+          "deduction": -0.25
+        },
+        {
+          "min": 0.5,
+          "max": 1,
+          "deduction": -0.5
+        },
+        {
+          "min": 1,
+          "max": 1.5,
+          "deduction": -0.75
+        },
+        {
+          "min": 1.5,
+          "max": 2,
+          "deduction": -1
+        },
+        {
+          "min": 2,
+          "max": 2.5,
           "deduction": -1.5
         },
         {
-          "min": 0.25,
-          "max": 0.5,
+          "min": 2.5,
+          "max": 3,
+          "deduction": -2
+        },
+        {
+          "min": 3,
+          "max": 4,
+          "deduction": -2.5
+        },
+        {
+          "min": 4,
+          "max": 6,
           "deduction": -3
         },
         {
-          "min": 0.5,
-          "max": "inf",
+          "min": 6,
+          "max": 8,
+          "deduction": -3.5
+        },
+        {
+          "min": 8,
+          "max": 10,
+          "deduction": -4
+        },
+        {
+          "min": 10,
+          "max": 15,
+          "deduction": -4.5
+        },
+        {
+          "min": 15,
+          "max": 20,
           "deduction": -5
+        },
+        {
+          "min": 20,
+          "max": 30,
+          "deduction": -5.5
+        },
+        {
+          "min": 30,
+          "max": "inf",
+          "deduction": -6
         }
       ],
       "stain_area": [
         {
           "min": 0,
+          "max": 0.01,
+          "deduction": -0.01
+        },
+        {
+          "min": 0.01,
           "max": 0.05,
-          "deduction": -0.1
+          "deduction": -0.05
         },
         {
           "min": 0.05,
           "max": 0.1,
-          "deduction": -0.5
+          "deduction": -0.1
         },
         {
           "min": 0.1,
-          "max": 0.25,
+          "max": 0.5,
+          "deduction": -0.25
+        },
+        {
+          "min": 0.5,
+          "max": 1,
+          "deduction": -0.5
+        },
+        {
+          "min": 1,
+          "max": 1.5,
+          "deduction": -0.75
+        },
+        {
+          "min": 1.5,
+          "max": 2,
+          "deduction": -1
+        },
+        {
+          "min": 2,
+          "max": 2.5,
           "deduction": -1.5
         },
         {
-          "min": 0.25,
-          "max": 0.5,
+          "min": 2.5,
+          "max": 3,
+          "deduction": -2
+        },
+        {
+          "min": 3,
+          "max": 4,
+          "deduction": -2.5
+        },
+        {
+          "min": 4,
+          "max": 6,
           "deduction": -3
         },
         {
-          "min": 0.5,
-          "max": "inf",
+          "min": 6,
+          "max": 8,
+          "deduction": -3.5
+        },
+        {
+          "min": 8,
+          "max": 10,
+          "deduction": -4
+        },
+        {
+          "min": 10,
+          "max": 15,
+          "deduction": -4.5
+        },
+        {
+          "min": 15,
+          "max": 20,
           "deduction": -5
+        },
+        {
+          "min": 20,
+          "max": 30,
+          "deduction": -5.5
+        },
+        {
+          "min": 30,
+          "max": "inf",
+          "deduction": -6
         }
       ],
       "scratch_length": [
@@ -499,18 +624,18 @@
       ]
     },
     "coefficients": {
-      "wear_area": 1,
+      "wear_area": 0.5,
       "scratch_length": 1,
-      "dent_area": 1,
-      "stain_area": 1
+      "dent_area": 2,
+      "stain_area": 1.2
     },
     "light_weights": {
       "ring_weight": 0.8,
       "coaxial_weight": 0.2
     },
     "final_weights": {
-      "front": 0.75,
-      "back": 0.25
+      "front": 1.5,
+      "back": 0.5
     }
   },
   "centering": {
@@ -622,37 +747,37 @@
         {
           "min": 0,
           "max": 60,
-          "deduction": "0"
+          "deduction": 0
         },
         {
           "min": 60,
           "max": 65,
-          "deduction": "-0.5"
+          "deduction": -0.5
         },
         {
           "min": 65,
           "max": 70,
-          "deduction": "-1"
+          "deduction": -1
         },
         {
           "min": 70,
           "max": 75,
-          "deduction": "-1.5"
+          "deduction": -1.5
         },
         {
           "min": 75,
           "max": 85,
-          "deduction": "-2"
+          "deduction": -2
         },
         {
           "min": 85,
           "max": 95,
-          "deduction": "-2.5"
+          "deduction": -2.5
         },
         {
           "min": 95,
           "max": "inf",
-          "deduction": "-3"
+          "deduction": -3
         }
       ],
       "coefficients": {

+ 6 - 0
app/utils/score_inference/CardScorer.py

@@ -178,11 +178,13 @@ class CardScorer:
             # 将分数写入json
             if is_write_score:
                 if "score" not in defect:
+                    logger.info("新写入")
                     # 新建的时候
                     # logger.info(f"新建分数score: {the_score}")
                     defect['score'] = the_score
                     defect["new_score"] = None
                 elif defect.get("new_score") is None:
+                    logger.info("初次修改")
                     # 初次修改
                     # if defect["score"] != the_score:
                     #     logger.info(f"初次修改 -> new_score: {the_score} (原score: {defect['score']})")
@@ -192,8 +194,11 @@ class CardScorer:
                         logger.info(f"del {defect_type} 补回: {the_score}")
                         defect["new_score"] = 0
                         weighted_scores[defect_type] -= the_score
+                    else:
+                        defect["new_score"] = the_score
 
                 elif "score" in defect and defect["new_score"] is not None:
+                    logger.info("多次修改")
                     # 多次修改
                     # if defect["new_score"] != the_score:
                     #     defect["score"] = defect["new_score"]
@@ -204,6 +209,7 @@ class CardScorer:
                         defect["new_score"] = 0
                         weighted_scores[defect_type] -= the_score
                 else:
+                    logger.info("这里直接赋值分数")
                     defect['score'] = the_score
                     defect["new_score"] = None