ultralytics 8.2.46 fix OBB Results xyxy attribute (#14020)
This commit is contained in:
parent
69cfc8aa22
commit
5f7d76e2eb
4 changed files with 11 additions and 9 deletions
|
|
@ -64,7 +64,7 @@ classifiers = [
|
||||||
|
|
||||||
# Required dependencies ------------------------------------------------------------------------------------------------
|
# Required dependencies ------------------------------------------------------------------------------------------------
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"numpy>=1.23.5,<2.0.0", # temporary patch for compat errors https://github.com/ultralytics/yolov5/actions/runs/9538130424/job/26286956354
|
"numpy>=1.23.0,<2.0.0", # temporary patch for compat errors https://github.com/ultralytics/yolov5/actions/runs/9538130424/job/26286956354
|
||||||
"matplotlib>=3.3.0",
|
"matplotlib>=3.3.0",
|
||||||
"opencv-python>=4.6.0",
|
"opencv-python>=4.6.0",
|
||||||
"pillow>=7.1.2",
|
"pillow>=7.1.2",
|
||||||
|
|
|
||||||
|
|
@ -236,13 +236,14 @@ def test_results(model):
|
||||||
results = YOLO(WEIGHTS_DIR / model)([SOURCE, SOURCE], imgsz=160)
|
results = YOLO(WEIGHTS_DIR / model)([SOURCE, SOURCE], imgsz=160)
|
||||||
for r in results:
|
for r in results:
|
||||||
r = r.cpu().numpy()
|
r = r.cpu().numpy()
|
||||||
|
print(r, len(r), r.path) # print numpy attributes
|
||||||
r = r.to(device="cpu", dtype=torch.float32)
|
r = r.to(device="cpu", dtype=torch.float32)
|
||||||
r.save_txt(txt_file=TMP / "runs/tests/label.txt", save_conf=True)
|
r.save_txt(txt_file=TMP / "runs/tests/label.txt", save_conf=True)
|
||||||
r.save_crop(save_dir=TMP / "runs/tests/crops/")
|
r.save_crop(save_dir=TMP / "runs/tests/crops/")
|
||||||
r.tojson(normalize=True)
|
r.tojson(normalize=True)
|
||||||
r.plot(pil=True)
|
r.plot(pil=True)
|
||||||
r.plot(conf=True, boxes=True)
|
r.plot(conf=True, boxes=True)
|
||||||
print(r, len(r), r.path)
|
print(r, len(r), r.path) # print after methods
|
||||||
|
|
||||||
|
|
||||||
def test_labels_and_crops():
|
def test_labels_and_crops():
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = "8.2.45"
|
__version__ = "8.2.46"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -743,9 +743,10 @@ class OBB(BaseTensor):
|
||||||
|
|
||||||
Accepts both torch and numpy boxes.
|
Accepts both torch and numpy boxes.
|
||||||
"""
|
"""
|
||||||
x1 = self.xyxyxyxy[..., 0].min(1).values
|
x = self.xyxyxyxy[..., 0]
|
||||||
x2 = self.xyxyxyxy[..., 0].max(1).values
|
y = self.xyxyxyxy[..., 1]
|
||||||
y1 = self.xyxyxyxy[..., 1].min(1).values
|
return (
|
||||||
y2 = self.xyxyxyxy[..., 1].max(1).values
|
torch.stack([x.amin(1), y.amin(1), x.amax(1), y.amax(1)], -1)
|
||||||
xyxy = [x1, y1, x2, y2]
|
if isinstance(x, torch.Tensor)
|
||||||
return np.stack(xyxy, axis=-1) if isinstance(self.data, np.ndarray) else torch.stack(xyxy, dim=-1)
|
else np.stack([x.min(1), y.min(1), x.max(1), y.max(1)], -1)
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue