计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
python-api【效率与协作】Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task needs direct, in-memory use of the legacy Object-Detection-Metrics classes instead of a text-folder CLI workflow.
BoundingBox / BoundingBoxes objects directly from Python data.Evaluator.GetPascalVOCMetrics.EveryPointInterpolation versus ElevenPointInterpolation.../file-evaluation/SKILL.md; that path owns safe folder parsing and the self-contained CLI helper.lib/ directory. The repo is source-style, so add the lib directory itself to sys.path; do not expect a pip package import.references/api-reference.md for verified signatures, enums, class responsibilities, and in-memory usage patterns.references/metric-behavior.md before interpreting AP, TP/FP, duplicate detections, relative coordinates, or IoU edge cases.scripts/api_metric_smoke.py --repo-root PATH or --lib-dir PATH to verify a user-provided checkout/copy before relying on it.references/troubleshooting.md.import sys
from pathlib import Path
lib_dir = Path("/path/to/copied-or-checked-out/lib")
sys.path.insert(0, str(lib_dir))
from BoundingBox import BoundingBox
from BoundingBoxes import BoundingBoxes
from Evaluator import Evaluator
from utils import BBFormat, BBType, CoordinatesType, MethodAveragePrecision
boxes = BoundingBoxes()
boxes.addBoundingBox(BoundingBox("img-1", "person", 10, 10, 50, 50,
CoordinatesType.Absolute, bbType=BBType.GroundTruth,
format=BBFormat.XYX2Y2))
boxes.addBoundingBox(BoundingBox("img-1", "person", 10, 10, 50, 50,
CoordinatesType.Absolute, bbType=BBType.Detected,
classConfidence=0.99, format=BBFormat.XYX2Y2))
metrics = Evaluator().GetPascalVOCMetrics(
boxes,
IOUThreshold=0.5,
method=MethodAveragePrecision.EveryPointInterpolation,
)
This should produce one person result with AP 1.0, total positives 1, total TP 1, and total FP 0.
This sub-skill distills the repository's lib/BoundingBox.py, lib/BoundingBoxes.py, lib/Evaluator.py, lib/utils.py, and the programmatic examples under samples/sample_1/ and samples/sample_2/. Those paths are evidence for the guidance here; runtime use should rely on the bundled references and script above.