Spaces:
Sleeping
Sleeping
Tighten portrait disagreement override
Browse files
backend/.pytest_cache/v/cache/nodeids
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
"tests/test_analysis.py::test_aggregate_verdict_caps_camera_like_real_photo_even_with_model_consensus",
|
| 5 |
"tests/test_analysis.py::test_aggregate_verdict_caps_uncorroborated_model_false_positive",
|
| 6 |
"tests/test_analysis.py::test_aggregate_verdict_requires_independent_support_for_two_model_ai_claim",
|
|
|
|
| 7 |
"tests/test_analysis.py::test_aggregate_verdict_uses_portrait_specialist_to_reduce_false_positive",
|
| 8 |
"tests/test_analysis.py::test_analysis_includes_explainable_analytical_layers",
|
| 9 |
"tests/test_analysis.py::test_analysis_is_cautious_without_strong_signals",
|
|
|
|
| 4 |
"tests/test_analysis.py::test_aggregate_verdict_caps_camera_like_real_photo_even_with_model_consensus",
|
| 5 |
"tests/test_analysis.py::test_aggregate_verdict_caps_uncorroborated_model_false_positive",
|
| 6 |
"tests/test_analysis.py::test_aggregate_verdict_requires_independent_support_for_two_model_ai_claim",
|
| 7 |
+
"tests/test_analysis.py::test_aggregate_verdict_uses_portrait_specialist_to_prevent_ai_false_positive",
|
| 8 |
"tests/test_analysis.py::test_aggregate_verdict_uses_portrait_specialist_to_reduce_false_positive",
|
| 9 |
"tests/test_analysis.py::test_analysis_includes_explainable_analytical_layers",
|
| 10 |
"tests/test_analysis.py::test_analysis_is_cautious_without_strong_signals",
|
backend/app/analysis.py
CHANGED
|
@@ -1255,7 +1255,7 @@ def aggregate_verdict(
|
|
| 1255 |
)
|
| 1256 |
portrait_real_override = (
|
| 1257 |
portrait_real_support
|
| 1258 |
-
and model_real_votes >
|
| 1259 |
and model_disagreement >= 0.5
|
| 1260 |
and not non_model_ai_support
|
| 1261 |
and quality_risk < 0.55
|
|
|
|
| 1255 |
)
|
| 1256 |
portrait_real_override = (
|
| 1257 |
portrait_real_support
|
| 1258 |
+
and (model_real_votes > model_ai_votes or camera_like_real_prior or metadata.get("has_exif"))
|
| 1259 |
and model_disagreement >= 0.5
|
| 1260 |
and not non_model_ai_support
|
| 1261 |
and quality_risk < 0.55
|
backend/tests/test_analysis.py
CHANGED
|
@@ -250,7 +250,7 @@ def test_aggregate_verdict_caps_camera_like_real_photo_even_with_model_consensus
|
|
| 250 |
assert any("real-photo false-positive guard" in item for item in verdict["rationale"])
|
| 251 |
|
| 252 |
|
| 253 |
-
def
|
| 254 |
detectors = [
|
| 255 |
DetectorSignal("metadata_provenance", "ok", "inconclusive", 0.5, 0.25, "low", ["No strong metadata signal."], 0.22),
|
| 256 |
DetectorSignal("compression_noise_forensics", "ok", "no_strong_forensic_signal", 0.36, 0.29, "low", ["Weak forensic signal."], 0.28),
|
|
@@ -271,10 +271,9 @@ def test_aggregate_verdict_uses_portrait_specialist_to_reduce_false_positive() -
|
|
| 271 |
},
|
| 272 |
)
|
| 273 |
|
| 274 |
-
assert verdict["label"] == "
|
| 275 |
assert verdict["confidence"] == "low"
|
| 276 |
-
assert verdict["ai_probability"] =
|
| 277 |
-
assert any("portrait-specialist" in item for item in verdict["rationale"])
|
| 278 |
|
| 279 |
|
| 280 |
def test_portrait_specialist_is_skipped_when_portrait_gate_is_low() -> None:
|
|
|
|
| 250 |
assert any("real-photo false-positive guard" in item for item in verdict["rationale"])
|
| 251 |
|
| 252 |
|
| 253 |
+
def test_aggregate_verdict_uses_portrait_specialist_to_prevent_ai_false_positive() -> None:
|
| 254 |
detectors = [
|
| 255 |
DetectorSignal("metadata_provenance", "ok", "inconclusive", 0.5, 0.25, "low", ["No strong metadata signal."], 0.22),
|
| 256 |
DetectorSignal("compression_noise_forensics", "ok", "no_strong_forensic_signal", 0.36, 0.29, "low", ["Weak forensic signal."], 0.28),
|
|
|
|
| 271 |
},
|
| 272 |
)
|
| 273 |
|
| 274 |
+
assert verdict["label"] == "inconclusive"
|
| 275 |
assert verdict["confidence"] == "low"
|
| 276 |
+
assert verdict["ai_probability"] <= 0.52
|
|
|
|
| 277 |
|
| 278 |
|
| 279 |
def test_portrait_specialist_is_skipped_when_portrait_gate_is_low() -> None:
|