|
| 1 | +# Active review prioritization |
| 2 | + |
| 3 | +[English](ACTIVE_REVIEW.md) | [简体中文](ACTIVE_REVIEW.zh-CN.md) |
| 4 | + |
| 5 | +The `prioritize` command converts a large candidate CSV into a deterministic, image-level human-review queue. It balances three signals instead of sorting by confidence alone: |
| 6 | + |
| 7 | +- **Uncertainty:** normalized Bernoulli entropy of detector confidence, highest near `0.5`. |
| 8 | +- **Rarity:** inverse square-root class frequency, dynamically decayed as that class receives review slots. |
| 9 | +- **Visual diversity:** greedy minimum dHash/aHash distance from the already selected images. |
| 10 | + |
| 11 | +The command is CPU-only and read-only. It never changes source candidates, images or labels. |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +```powershell |
| 16 | +yolo-label-recovery prioritize D:\runs\candidates_review.csv D:\data\mining-safety ` |
| 17 | + --output-dir D:\runs\priority-review ` |
| 18 | + --budget 500 ` |
| 19 | + --workers 4 ` |
| 20 | + --uncertainty-weight 0.45 ` |
| 21 | + --rarity-weight 0.20 ` |
| 22 | + --diversity-weight 0.35 ` |
| 23 | + --redact-paths |
| 24 | +``` |
| 25 | + |
| 26 | +The weights must be non-negative and sum to `1`. REVIEW is the only default mode; add `--modes review auto` only when AUTO spot checks intentionally share the same queue. |
| 27 | + |
| 28 | +## Image-level acquisition |
| 29 | + |
| 30 | +Human review normally opens an image, not an isolated prediction row. The command therefore groups every filtered candidate with the same `split + image`, keeps all associated classes/boxes together and computes image-level uncertainty and rarity. Candidate paths may be absolute, dataset-relative or split-relative, but they must resolve inside the dataset root. |
| 31 | + |
| 32 | +For every queue position, the acquisition function is: |
| 33 | + |
| 34 | +```text |
| 35 | +priority = 0.45 * uncertainty |
| 36 | + + 0.20 * dynamic_class_rarity |
| 37 | + + 0.35 * min_visual_distance_to_selected_set |
| 38 | +``` |
| 39 | + |
| 40 | +After an image is selected, class coverage counts and every remaining image's minimum visual distance are updated. This greedy process is deterministic and requires approximately `O(N * B)` compact-hash comparisons for `N` review images and budget `B`; full-resolution pixels are not retained in memory. |
| 41 | + |
| 42 | +## Outputs |
| 43 | + |
| 44 | +| File | Purpose | |
| 45 | +|---|---| |
| 46 | +| `review_queue.csv` | One ranked row per selected image with score components | |
| 47 | +| `review_queue_candidates.csv` | Original candidate rows for selected images with priority rank | |
| 48 | +| `review_pool.csv` | All readable review images and selected status | |
| 49 | +| `image_failures.csv` | Missing, escaping or corrupt image evidence | |
| 50 | +| `prioritization_summary.json` | Policy, totals, distributions and queue data | |
| 51 | +| `prioritization_report.html` | Self-contained report for delivery and portfolio use | |
| 52 | + |
| 53 | +## Statistical boundary |
| 54 | + |
| 55 | +This queue is intentionally biased toward uncertain, rare and diverse examples. It improves issue discovery per reviewer-hour, but **must not** be used to estimate unbiased precision, recall or defect prevalence. Use a separate random or stratified-random audit sample for metrics; use this active queue for remediation. |
| 56 | + |
| 57 | +Detector confidence is also not a calibrated probability by default. Entropy is an acquisition heuristic here, not proof that a prediction is incorrect. Calibration and human verdicts remain separate stages. |
| 58 | + |
| 59 | +## Public fixture |
| 60 | + |
| 61 | +```powershell |
| 62 | +python examples\create_prioritization_fixture.py --output-dir .priority-fixture |
| 63 | +yolo-label-recovery prioritize .priority-fixture\candidates_review.csv .priority-fixture\dataset ` |
| 64 | + --output-dir .priority-output ` |
| 65 | + --budget 12 ` |
| 66 | + --redact-paths |
| 67 | +``` |
| 68 | + |
| 69 | +The fixture contains `36` review images with intentionally imbalanced classes. The queue selects `12`, covers all `6` classes, and gives each class one position within the first six selections before assigning additional slots. |
0 commit comments