Buckets:
| """Score fixed selection-derived thresholds on separate quick validation tiles.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from evaluation.metrics import evaluate_detection | |
| from evaluation.scene_precision_frontier import aggregate | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("records", type=Path) | |
| parser.add_argument("initial_frontier", type=Path) | |
| parser.add_argument("candidate_frontier", type=Path) | |
| parser.add_argument("output", type=Path) | |
| args = parser.parse_args() | |
| records = json.loads(args.records.read_text()) | |
| initial = json.loads(args.initial_frontier.read_text())["results"]["initial"]["frontier"] | |
| candidate = json.loads(args.candidate_frontier.read_text())["results"]["candidate"]["frontier"] | |
| result = {} | |
| for name, frontier in (("initial", initial), ("candidate", candidate)): | |
| thresholds = {int(cls): entry["best"]["threshold"] for cls, entry in frontier.items() if entry["best"]} | |
| predictions, targets = aggregate(records[name]) | |
| for row in predictions: | |
| row["annotations"] = [a for a in row["annotations"] | |
| if int(a["category_id"]) in thresholds and | |
| a["confidence"] >= thresholds[int(a["category_id"])]] | |
| result[name] = {"thresholds": thresholds, "abstained_class_ids": sorted(int(c) for c, v in frontier.items() if not v["best"]), | |
| "metrics": evaluate_detection(predictions, targets, ignore_prediction_fraction=.5)} | |
| report = {"status": "DEVELOPMENT_DIAGNOSTIC", "results": result, | |
| "limitations": ["Thresholds fitted on selection scenes and held fixed for quick tiles.", | |
| "Quick and selection tiles may share source scenes; prior project use prevents independence claims.", | |
| "Source scenes may be incompletely covered; 0.05 prediction floor and cross-tile NMS apply.", | |
| "Ignored-region policy and annotations limit precision reliability."]} | |
| with args.output.open("x") as stream: | |
| json.dump(report, stream, indent=2) | |
| stream.write("\n") | |
| print(json.dumps({name: {key: value["metrics"][key] for key in ("precision", "recall", "f1")} | |
| for name, value in result.items()})) | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 2.38 kB
- Xet hash:
- a5ff8f6dc45525d7e8b87c864aa8d688af7e29b1fd56c4c4e4dc47583017131e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.