Retain Results.speed attribute during ops (#12774)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
e26036d965
commit
303579c35e
1 changed files with 6 additions and 4 deletions
|
|
@ -94,7 +94,9 @@ class Results(SimpleClass):
|
|||
tojson(normalize=False): Converts detection results to JSON format.
|
||||
"""
|
||||
|
||||
def __init__(self, orig_img, path, names, boxes=None, masks=None, probs=None, keypoints=None, obb=None) -> None:
|
||||
def __init__(
|
||||
self, orig_img, path, names, boxes=None, masks=None, probs=None, keypoints=None, obb=None, speed=None
|
||||
) -> None:
|
||||
"""
|
||||
Initialize the Results class.
|
||||
|
||||
|
|
@ -115,7 +117,7 @@ class Results(SimpleClass):
|
|||
self.probs = Probs(probs) if probs is not None else None
|
||||
self.keypoints = Keypoints(keypoints, self.orig_shape) if keypoints is not None else None
|
||||
self.obb = OBB(obb, self.orig_shape) if obb is not None else None
|
||||
self.speed = {"preprocess": None, "inference": None, "postprocess": None} # milliseconds per image
|
||||
self.speed = speed if speed is not None else {"preprocess": None, "inference": None, "postprocess": None}
|
||||
self.names = names
|
||||
self.path = path
|
||||
self.save_dir = None
|
||||
|
|
@ -180,8 +182,8 @@ class Results(SimpleClass):
|
|||
return self._apply("to", *args, **kwargs)
|
||||
|
||||
def new(self):
|
||||
"""Return a new Results object with the same image, path, and names."""
|
||||
return Results(orig_img=self.orig_img, path=self.path, names=self.names)
|
||||
"""Return a new Results object with the same image, path, names and speed."""
|
||||
return Results(orig_img=self.orig_img, path=self.path, names=self.names, speed=self.speed)
|
||||
|
||||
def plot(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue