skills/cv/classifier-gated-detection-postprocess/SKILL.md
Uses a binary classifier's probability to gate object detector outputs in three tiers: keep detections, append a no-finding box, or replace all detections.
npx skillsauth add wenmin-wu/ds-skills cv-classifier-gated-detection-postprocessInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
In medical imaging detection (chest X-ray, mammography), most images are normal — detectors produce false positives on healthy images. A binary normal/abnormal classifier acts as a gate: if the classifier is confident the image is normal, suppress all detections and output a "No Finding" pseudo-box. If uncertain, append both. This three-tier approach reduces false positives without losing true detections, typically improving mAP by 0.01–0.03.
import pandas as pd
NORMAL_PRED = "14 1.0 0 0 1 1" # class_id=14 (No Finding), conf=1.0, full-image box
LOW_THRESH = 0.3 # below: keep detector output only
HIGH_THRESH = 0.7 # above: replace with No Finding
def gate_detections(det_df, clf_df, low_thresh=0.3, high_thresh=0.7):
"""Gate detector predictions using classifier normal-probability."""
merged = det_df.merge(clf_df[['image_id', 'normal_prob']], on='image_id')
results = []
for _, row in merged.iterrows():
p_normal = row['normal_prob']
det_str = row['PredictionString']
if p_normal < low_thresh:
# Confident abnormal — trust detector
results.append(det_str)
elif p_normal < high_thresh:
# Uncertain — append No Finding alongside detections
results.append(f"{det_str} {NORMAL_PRED}")
else:
# Confident normal — suppress all detections
results.append(NORMAL_PRED)
merged['PredictionString'] = results
return merged
submission = gate_detections(detector_preds, classifier_preds)
[0, 0, 1, 1] with high confidence for the normal classdata-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF