mirror of
https://github.com/ultralytics/ultralytics
synced 2026-04-21 14:07:18 +00:00
Fix AP calculation precision in compute_ap (#24175)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
fa3dd8d96e
commit
a481399723
3 changed files with 13 additions and 10 deletions
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
|
@ -74,19 +74,19 @@ jobs:
|
|||
uv pip list
|
||||
- name: Benchmark DetectionModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}.pt' imgsz=160 verbose=0.218
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}.pt' imgsz=160 verbose=0.216
|
||||
- name: Benchmark ClassificationModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-cls.pt' imgsz=160 verbose=0.249
|
||||
- name: Benchmark YOLOWorld DetectionModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/yolov8s-worldv2.pt' imgsz=160 verbose=0.337
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/yolov8s-worldv2.pt' imgsz=160 verbose=0.335
|
||||
- name: Benchmark SegmentationModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-seg.pt' imgsz=160 verbose=0.230
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-seg.pt' imgsz=160 verbose=0.229
|
||||
- name: Benchmark PoseModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-pose.pt' imgsz=160 verbose=0.194
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-pose.pt' imgsz=160 verbose=0.185
|
||||
- name: Benchmark OBBModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-obb.pt' imgsz=160 verbose=0.372
|
||||
|
|
@ -345,15 +345,15 @@ jobs:
|
|||
yolo checks
|
||||
uv pip list
|
||||
- name: Benchmark DetectionModel
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n.pt' imgsz=160 verbose=0.218
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n.pt' imgsz=160 verbose=0.216
|
||||
- name: Benchmark ClassificationModel
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n-cls.pt' imgsz=160 verbose=0.249
|
||||
- name: Benchmark YOLOWorld DetectionModel
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolov8s-worldv2.pt' imgsz=160 verbose=0.337
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolov8s-worldv2.pt' imgsz=160 verbose=0.335
|
||||
- name: Benchmark SegmentationModel
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n-seg.pt' imgsz=160 verbose=0.230
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n-seg.pt' imgsz=160 verbose=0.229
|
||||
- name: Benchmark PoseModel
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n-pose.pt' imgsz=160 verbose=0.194
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n-pose.pt' imgsz=160 verbose=0.185
|
||||
- name: Benchmark OBBModel
|
||||
run: python -m ultralytics.cfg.__init__ benchmark model='yolo26n-obb.pt' imgsz=160 verbose=0.372
|
||||
- name: Benchmark Summary
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ davis.justin@mssm.org:
|
|||
esat@ultralytics.com:
|
||||
avatar: https://avatars.githubusercontent.com/u/43647848?v=4
|
||||
username: artest08
|
||||
faruk.gmstss@gmail.com:
|
||||
avatar: null
|
||||
username: null
|
||||
fatih@ultralytics.com:
|
||||
avatar: https://avatars.githubusercontent.com/u/34196005?v=4
|
||||
username: fcakyon
|
||||
|
|
|
|||
|
|
@ -728,8 +728,8 @@ def compute_ap(recall: list[float], precision: list[float]) -> tuple[float, np.n
|
|||
mrec (np.ndarray): Modified recall curve with sentinel values added at the beginning and end.
|
||||
"""
|
||||
# Append sentinel values to beginning and end
|
||||
mrec = np.concatenate(([0.0], recall, [1.0]))
|
||||
mpre = np.concatenate(([1.0], precision, [0.0]))
|
||||
mrec = np.concatenate(([0.0], recall, [recall[-1] if len(recall) else 1.0], [1.0]))
|
||||
mpre = np.concatenate(([1.0], precision, [0.0], [0.0]))
|
||||
|
||||
# Compute the precision envelope
|
||||
mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue