From 6267d6a609f79ad2608a9e80005ca4af31ff5b9a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 10 Aug 2023 20:43:40 +0200 Subject: [PATCH] Fix `torch.Tensor` inference results plotting (#4297) --- ultralytics/engine/results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultralytics/engine/results.py b/ultralytics/engine/results.py index fd0d48b..45727c5 100644 --- a/ultralytics/engine/results.py +++ b/ultralytics/engine/results.py @@ -215,7 +215,7 @@ class Results(SimpleClass): ``` """ if img is None and isinstance(self.orig_img, torch.Tensor): - img = np.ascontiguousarray(self.orig_img[0].permute(1, 2, 0).cpu().detach().numpy()) * 255 + img = (self.orig_img[0].detach().permute(1, 2, 0).cpu().contiguous() * 255).to(torch.uint8).numpy() # Deprecation warn TODO: remove in 8.2 if 'show_conf' in kwargs: