S-Vetrivel commited on
Commit
9d2870b
·
1 Parent(s): f07936b

Add comprehensive debug logging to track AI classification confidence calculations

Browse files
Files changed (1) hide show
  1. app/infer.py +4 -1
app/infer.py CHANGED
@@ -64,6 +64,7 @@ class VoiceClassifier:
64
 
65
  t1 = time.time()
66
  print(f"DEBUG: Inference took {t1 - t0:.3f}s. probs: {probs}")
 
67
 
68
  # 3. Pitch Analysis (for explanation)
69
  # Use librosa for pitch tracking (fast approximation)
@@ -78,7 +79,7 @@ class VoiceClassifier:
78
  pitch_var = np.std(f0) if len(f0) > 0 else 0.0
79
 
80
  t2 = time.time()
81
- print(f"DEBUG: Pitch Detection took {t2 - t1:.3f}s. Variance: {pitch_var}")
82
 
83
  # 4. Final Classification Logic
84
  # Deepfake model is the authority
@@ -90,6 +91,8 @@ class VoiceClassifier:
90
  prediction = "HUMAN"
91
  confidence = prob_real
92
  prob_ai = prob_fake
 
 
93
 
94
  # Construct Explanation
95
  if prediction == "AI_GENERATED":
 
64
 
65
  t1 = time.time()
66
  print(f"DEBUG: Inference took {t1 - t0:.3f}s. probs: {probs}")
67
+ print(f"DEBUG: prob_fake={prob_fake:.6f}, prob_real={prob_real:.6f}")
68
 
69
  # 3. Pitch Analysis (for explanation)
70
  # Use librosa for pitch tracking (fast approximation)
 
79
  pitch_var = np.std(f0) if len(f0) > 0 else 0.0
80
 
81
  t2 = time.time()
82
+ print(f"DEBUG: Pitch Detection took {t2 - t1:.3f}s. Variance: {pitch_var:.2f}")
83
 
84
  # 4. Final Classification Logic
85
  # Deepfake model is the authority
 
91
  prediction = "HUMAN"
92
  confidence = prob_real
93
  prob_ai = prob_fake
94
+
95
+ print(f"DEBUG: prediction={prediction}, confidence={confidence:.6f}, prob_ai={prob_ai:.6f}")
96
 
97
  # Construct Explanation
98
  if prediction == "AI_GENERATED":