Update DetectMultiBackend for tuple outputs 2 (#9275)

* Update DetectMultiBackend for tuple outputs 2

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update

* Update

* Update

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocherandpre-commit-ci[bot] authored and GitHub committed 2022-09-04 15:39:57 +02:00
1 parent 96c3c7f71d
commit 7aa263c5f2
3 files changed
+12 -7

No files matched your search

+3
View File
@@ -813,6 +813,9 @@ def non_max_suppression(prediction,
list of detections, on (n,6) tensor per image [xyxy, conf, cls]
"""
if isinstance(prediction, (list, tuple)): # YOLOv5 model in validation model, output = (inference_out, loss_out)
prediction = prediction[0] # select only inference output
bs = prediction.shape[0] # batch size
nc = prediction.shape[2] - 5 # number of classes
xc = prediction[..., 4] > conf_thres # candidates