ultralytics 8.1.31 NCNN and CLIP updates (#9235)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
41c2d8d99f
commit
3c179f87cb
8 changed files with 77 additions and 60 deletions
|
|
@ -385,14 +385,12 @@ class Results(SimpleClass):
|
|||
BGR=True,
|
||||
)
|
||||
|
||||
def tojson(self, normalize=False):
|
||||
"""Convert the object to JSON format."""
|
||||
def summary(self, normalize=False):
|
||||
"""Convert the results to a summarized format."""
|
||||
if self.probs is not None:
|
||||
LOGGER.warning("Warning: Classify task do not support `tojson` yet.")
|
||||
LOGGER.warning("Warning: Classify task do not support `summary` and `tojson` yet.")
|
||||
return
|
||||
|
||||
import json
|
||||
|
||||
# Create list of detection dictionaries
|
||||
results = []
|
||||
data = self.boxes.data.cpu().tolist()
|
||||
|
|
@ -413,8 +411,13 @@ class Results(SimpleClass):
|
|||
result["keypoints"] = {"x": (x / w).tolist(), "y": (y / h).tolist(), "visible": visible.tolist()}
|
||||
results.append(result)
|
||||
|
||||
# Convert detections to JSON
|
||||
return json.dumps(results, indent=2)
|
||||
return results
|
||||
|
||||
def tojson(self, normalize=False):
|
||||
"""Convert the results to JSON format."""
|
||||
import json
|
||||
|
||||
return json.dumps(self.summary(normalize=normalize), indent=2)
|
||||
|
||||
|
||||
class Boxes(BaseTensor):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue