Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions python/ncnn/model_zoo/yolov8.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .model_store import get_model_file
from ..utils.objects import Detect_Object
from ..utils.functional import *
from typing import Iterable

class YoloV8s:
def __init__(
Expand Down Expand Up @@ -204,17 +205,20 @@ def __call__(self, img):
pred, self.prob_threshold, self.nms_threshold
)[0]

objects = [
Detect_Object(
obj[5],
obj[4],
(obj[0] - (wpad / 2)) / scale,
(obj[1] - (hpad / 2)) / scale,
(obj[2] - obj[0]) / scale,
(obj[3] - obj[1]) / scale,
)
for obj in result
]
if isinstance(result, Iterable):
objects = [
Detect_Object(
obj[5],
obj[4],
(obj[0] - (wpad / 2)) / scale,
(obj[1] - (hpad / 2)) / scale,
(obj[2] - obj[0]) / scale,
(obj[3] - obj[1]) / scale,
)
for obj in result
]
else:
objects = []

return objects

Expand Down