Update detections() self.t = tuple() (#2617)

* Update detections() self.t = tuple()

Fix multiple results.print() bug.

* Update experimental.py

* Update yolo.py
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-03-26 13:23:11 +01:00
1 parent 0ff5aeca61
commit a57f23d18b
3 files changed
+6 -5

No files matched your search

+3 -4
View File
@@ -1,4 +1,4 @@
# This file contains modules common to various models
# YOLOv5 common modules
import math
from pathlib import Path
@@ -248,7 +248,7 @@ class Detections:
self.xyxyn = [x / g for x, g in zip(self.xyxy, gn)] # xyxy normalized
self.xywhn = [x / g for x, g in zip(self.xywh, gn)] # xywh normalized
self.n = len(self.pred)
self.t = ((times[i + 1] - times[i]) * 1000 / self.n for i in range(3)) # timestamps (ms)
self.t = tuple((times[i + 1] - times[i]) * 1000 / self.n for i in range(3)) # timestamps (ms)
self.s = shape # inference BCHW shape
def display(self, pprint=False, show=False, save=False, render=False, save_dir=''):
@@ -277,8 +277,7 @@ class Detections:
def print(self):
self.display(pprint=True) # print results
print(f'Speed: %.1fms pre-process, %.1fms inference, %.1fms NMS per image at shape {tuple(self.s)}' %
tuple(self.t))
print(f'Speed: %.1fms pre-process, %.1fms inference, %.1fms NMS per image at shape {tuple(self.s)}' % self.t)
def show(self):
self.display(show=True) # show results
+1 -1
View File
@@ -1,4 +1,4 @@
# This file contains experimental modules
# YOLOv5 experimental modules
import numpy as np
import torch
+2
View File
@@ -1,3 +1,5 @@
# YOLOv5 YOLO-specific modules
import argparse
import logging
import sys