Merge branch 'main' into quan

test-quan
Lakshantha Dissanayake 3 weeks ago committed by GitHub
commit c7ee2c9456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      docs/en/guides/object-counting.md
  2. 4
      ultralytics/engine/model.py
  3. 4
      ultralytics/engine/results.py

@ -19,7 +19,7 @@ Object counting with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly
allowfullscreen> allowfullscreen>
</iframe> </iframe>
<br> <br>
<strong>Watch:</strong> Object Counting using Ultralytics YOLO11 <strong>Watch:</strong> Object Counting using Ultralytics YOLOv8
</td> </td>
<td align="center"> <td align="center">
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/Fj9TStNBVoY" <iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/Fj9TStNBVoY"

@ -2,7 +2,7 @@
import inspect import inspect
from pathlib import Path from pathlib import Path
from typing import List, Union from typing import Dict, List, Union
import numpy as np import numpy as np
import torch import torch
@ -881,7 +881,7 @@ class Model(nn.Module):
return self return self
@property @property
def names(self) -> list: def names(self) -> Dict[int, str]:
""" """
Retrieves the class names associated with the loaded model. Retrieves the class names associated with the loaded model.

@ -535,9 +535,9 @@ class Results(SimpleClass):
# Plot Detect results # Plot Detect results
if pred_boxes is not None and show_boxes: if pred_boxes is not None and show_boxes:
for i, d in enumerate(reversed(pred_boxes)): for i, d in enumerate(reversed(pred_boxes)):
c, conf, id = int(d.cls), float(d.conf) if conf else None, None if d.id is None else int(d.id.item()) c, d_conf, id = int(d.cls), float(d.conf) if conf else None, None if d.id is None else int(d.id.item())
name = ("" if id is None else f"id:{id} ") + names[c] name = ("" if id is None else f"id:{id} ") + names[c]
label = (f"{name} {conf:.2f}" if conf else name) if labels else None label = (f"{name} {d_conf:.2f}" if conf else name) if labels else None
box = d.xyxyxyxy.reshape(-1, 4, 2).squeeze() if is_obb else d.xyxy.squeeze() box = d.xyxyxyxy.reshape(-1, 4, 2).squeeze() if is_obb else d.xyxy.squeeze()
annotator.box_label( annotator.box_label(
box, box,

Loading…
Cancel
Save