mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-24 06:07:03 +08:00
ultralytics 8.0.125
NMS speed improvements (#3463)
Co-authored-by: Compunet <117437050+dme-compunet@users.noreply.github.com>
This commit is contained in:
parent
0e5a6b8158
commit
8a11eda4a9
@ -35,7 +35,10 @@ Here is an example of the YOLO dataset format for a single image with two object
|
|||||||
1 0.5046 0.0 0.5015 0.004 0.4984 0.00416 0.4937 0.010 0.492 0.0104
|
1 0.5046 0.0 0.5015 0.004 0.4984 0.00416 0.4937 0.010 0.492 0.0104
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: The length of each row does not have to be equal.
|
!!! tip "Tip"
|
||||||
|
|
||||||
|
- The length of each row does not have to be equal.
|
||||||
|
- Each segmentation label must have a **minimum of 3 xy points**: `<class-index> <x1> <y1> <x2> <y2> <x3> <y3>`
|
||||||
|
|
||||||
### Dataset YAML format
|
### Dataset YAML format
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ This repository features a collection of real-world applications and walkthrough
|
|||||||
| -------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------------------------------- |
|
| -------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------------------------------- |
|
||||||
| [YOLO ONNX Detection Inference with C++](./YOLOv8-CPP-Inference) | C++/ONNX | [Justas Bartnykas](https://github.com/JustasBart) |
|
| [YOLO ONNX Detection Inference with C++](./YOLOv8-CPP-Inference) | C++/ONNX | [Justas Bartnykas](https://github.com/JustasBart) |
|
||||||
| [YOLO OpenCV ONNX Detection Python](./YOLOv8-OpenCV-ONNX-Python) | OpenCV/Python/ONNX | [Farid Inawan](https://github.com/frdteknikelektro) |
|
| [YOLO OpenCV ONNX Detection Python](./YOLOv8-OpenCV-ONNX-Python) | OpenCV/Python/ONNX | [Farid Inawan](https://github.com/frdteknikelektro) |
|
||||||
| [YOLO .NET ONNX ImageSharp](https://github.com/dme-compunet/YOLOv8) | C#/ONNX/ImageSharp | [Compuet](https://github.com/dme-compunet) |
|
| [YOLOv8 .NET ONNX ImageSharp](https://github.com/dme-compunet/YOLOv8) | C#/ONNX/ImageSharp | [Compunet](https://github.com/dme-compunet) |
|
||||||
| [YOLO .Net ONNX Detection C#](https://www.nuget.org/packages/Yolov8.Net) | C# .Net | [Samuel Stainback](https://github.com/sstainba) |
|
| [YOLO .Net ONNX Detection C#](https://www.nuget.org/packages/Yolov8.Net) | C# .Net | [Samuel Stainback](https://github.com/sstainba) |
|
||||||
| [YOLOv8 on NVIDIA Jetson(TensorRT and DeepStream)](https://wiki.seeedstudio.com/YOLOv8-DeepStream-TRT-Jetson/) | Python | [Lakshantha](https://github.com/lakshanthad) |
|
| [YOLOv8 on NVIDIA Jetson(TensorRT and DeepStream)](https://wiki.seeedstudio.com/YOLOv8-DeepStream-TRT-Jetson/) | Python | [Lakshantha](https://github.com/lakshanthad) |
|
||||||
| [YOLOv8 ONNXRuntime Python](./YOLOv8-ONNXRuntime) | Python/ONNXRuntime | [Semih Demirel](https://github.com/semihhdemirel) |
|
| [YOLOv8 ONNXRuntime Python](./YOLOv8-ONNXRuntime) | Python/ONNXRuntime | [Semih Demirel](https://github.com/semihhdemirel) |
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = '8.0.124'
|
__version__ = '8.0.125'
|
||||||
|
|
||||||
from ultralytics.hub import start
|
from ultralytics.hub import start
|
||||||
from ultralytics.vit.rtdetr import RTDETR
|
from ultralytics.vit.rtdetr import RTDETR
|
||||||
|
@ -340,7 +340,7 @@ class AutoBackend(nn.Module):
|
|||||||
elif self.coreml: # CoreML
|
elif self.coreml: # CoreML
|
||||||
im = im[0].cpu().numpy()
|
im = im[0].cpu().numpy()
|
||||||
im_pil = Image.fromarray((im * 255).astype('uint8'))
|
im_pil = Image.fromarray((im * 255).astype('uint8'))
|
||||||
# im = im.resize((192, 320), Image.ANTIALIAS)
|
# im = im.resize((192, 320), Image.BILINEAR)
|
||||||
y = self.model.predict({'image': im_pil}) # coordinates are xywh normalized
|
y = self.model.predict({'image': im_pil}) # coordinates are xywh normalized
|
||||||
if 'confidence' in y:
|
if 'confidence' in y:
|
||||||
box = xywh2xyxy(y['coordinates'] * [[w, h, w, h]]) # xyxy pixels
|
box = xywh2xyxy(y['coordinates'] * [[w, h, w, h]]) # xyxy pixels
|
||||||
|
@ -447,7 +447,7 @@ class Exporter:
|
|||||||
check_requirements('nvidia-tensorrt', cmds='-U --index-url https://pypi.ngc.nvidia.com')
|
check_requirements('nvidia-tensorrt', cmds='-U --index-url https://pypi.ngc.nvidia.com')
|
||||||
import tensorrt as trt # noqa
|
import tensorrt as trt # noqa
|
||||||
|
|
||||||
check_version(trt.__version__, '7.0.0', hard=True) # require tensorrt>=8.0.0
|
check_version(trt.__version__, '7.0.0', hard=True) # require tensorrt>=7.0.0
|
||||||
self.args.simplify = True
|
self.args.simplify = True
|
||||||
f_onnx, _ = self.export_onnx()
|
f_onnx, _ = self.export_onnx()
|
||||||
|
|
||||||
|
@ -200,8 +200,7 @@ def non_max_suppression(
|
|||||||
multi_label &= nc > 1 # multiple labels per box (adds 0.5ms/img)
|
multi_label &= nc > 1 # multiple labels per box (adds 0.5ms/img)
|
||||||
merge = False # use merge-NMS
|
merge = False # use merge-NMS
|
||||||
|
|
||||||
prediction = prediction.clone() # don't modify original
|
prediction = prediction.transpose(-1, -2) # shape(1,84,6300) to shape(1,6300,84)
|
||||||
prediction = prediction.transpose(-1, -2) # to (batch, boxes, items)
|
|
||||||
prediction[..., :4] = xywh2xyxy(prediction[..., :4]) # xywh to xyxy
|
prediction[..., :4] = xywh2xyxy(prediction[..., :4]) # xywh to xyxy
|
||||||
|
|
||||||
t = time.time()
|
t = time.time()
|
||||||
@ -245,7 +244,6 @@ def non_max_suppression(
|
|||||||
n = x.shape[0] # number of boxes
|
n = x.shape[0] # number of boxes
|
||||||
if not n: # no boxes
|
if not n: # no boxes
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if n > max_nms: # excess boxes
|
if n > max_nms: # excess boxes
|
||||||
x = x[x[:, 4].argsort(descending=True)[:max_nms]] # sort by confidence and remove excess boxes
|
x = x[x[:, 4].argsort(descending=True)[:max_nms]] # sort by confidence and remove excess boxes
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user