From a2786230671415e4d5c95a5c4f930fed3438b156 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 13 Mar 2020 10:06:17 -0700 Subject: [PATCH] replaced floatn() with round() --- test.py | 4 ++-- utils/utils.py | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/test.py b/test.py index f6a68859..5e505491 100644 --- a/test.py +++ b/test.py @@ -127,8 +127,8 @@ def test(cfg, for di, d in enumerate(pred): jdict.append({'image_id': image_id, 'category_id': coco91class[int(d[5])], - 'bbox': [floatn(x, 3) for x in box[di]], - 'score': floatn(d[4], 5)}) + 'bbox': [round(x, 3) for x in box[di]], + 'score': round(d[4], 5)}) # Assign all predictions as incorrect correct = torch.zeros(pred.shape[0], niou, dtype=torch.bool, device=device) diff --git a/utils/utils.py b/utils/utils.py index c36d82f4..9fb0d0e5 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -26,10 +26,6 @@ np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format}) cv2.setNumThreads(0) -def floatn(x, n=3): # format floats to n decimals - return float(format(x, '.%gf' % n)) - - def init_seeds(seed=0): random.seed(seed) np.random.seed(seed)