| |
| """ |
| decide.py |
| νμ€ κ²°κ³Ό(BatteryResult) β 3μ‘΄ νμ . μμ κ·μΉ, μ¬νμ΅ μμ. |
| |
| 3μ‘΄: π’ μ΄μ μμ / π‘ κ²ν νμ / π΄ μ΄μ μμ |
| μμΉ: recall-first β λμΉλ κ²λ³΄λ€ κ³Όνκ² κ±°λ₯΄λ κ² λ«λ€. |
| |
| νμ κ·Όκ±°(νμ μ΄μκ°): |
| - κ²μΆμ conf 0.05 OR μ§κ³λ‘ μ΄λ―Έ 'λ°ν=κ²°ν¨'. μ¬κΈ°μ conf λ‘ red/yellow λ§ κ°λ₯Έλ€. |
| - cell porosity λ 물리νκ³(FP 0.21) β μλ reject κΈμ§, νμ 'κ²ν ν'(yellow). |
| - module κ²μΆ/swelling μ μ λ’° λμ(recall~1.0, FP~0) β νμ conf λ©΄ red. |
| - swelling μ λ°°ν°λ¦¬ λΉμ¨(>0.1)λ‘ μ΄λ―Έ νμ λ¨ β λ°ν μ red. |
| """ |
|
|
| |
| HIGH = 0.50 |
|
|
| |
| DEFECT_CANON = {"porosity": "porosity", "resin": "resin_overflow", "swelling": "swelling"} |
|
|
|
|
| def decide(result): |
| """λ°ν: {zone, defects, red, yellow, worst_conf, reasons}.""" |
| ct = result["cell_type"] |
| red, yellow, reasons = [], [], [] |
|
|
| |
| sw = result["swelling"] |
| if sw["flag"]: |
| red.append("swelling") |
| reasons.append(f"swelling μ¬λΌμ΄μ€ λΉμ¨ {sw['ratio']*100:.0f}% (>10%) β μ μ ν½μ°½") |
|
|
| |
| for d in ("porosity", "resin"): |
| info = result[d] |
| if not info["flag"]: |
| continue |
| cf = info["conf"] |
| if ct == "cell": |
| yellow.append(d) |
| reasons.append(f"{d} κ²μΆ (cell 물리νκ³ β κ²ν ν, conf {cf:.2f})") |
| elif cf >= HIGH: |
| red.append(d) |
| reasons.append(f"{d} νμ (conf {cf:.2f})") |
| else: |
| yellow.append(d) |
| reasons.append(f"{d} μ½ν μ νΈ (conf {cf:.2f})") |
|
|
| |
| if red: |
| zone = "π΄ μ΄μ μμ" |
| elif yellow: |
| zone = "π‘ κ²ν νμ" |
| else: |
| zone = "π’ μ΄μ μμ" |
| reasons.append("μΈ κ²°ν¨ λͺ¨λ λ―Ένμ§") |
|
|
| return { |
| "zone": zone, |
| "defects": red + yellow, |
| "red": red, |
| "yellow": yellow, |
| "worst_conf": max(result["porosity"]["conf"], result["resin"]["conf"], sw["conf"]), |
| "reasons": reasons, |
| } |
|
|