From d989bc9260c6a4e0ea6a28da7e6c0e979f32d582 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 2 Aug 2020 14:23:05 -0700 Subject: [PATCH] remove NBSP --- models/yolo.py | 4 ++-- utils/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/yolo.py b/models/yolo.py index bcd9cbd..3cb0a13 100644 --- a/models/yolo.py +++ b/models/yolo.py @@ -127,7 +127,7 @@ class Model(nn.Module): def _initialize_biases(self, cf=None): # initialize biases into Detect(), cf is class frequency # cf = torch.bincount(torch.tensor(np.concatenate(dataset.labels, 0)[:, 0]).long(), minlength=nc) + 1. m = self.model[-1] # Detect() module - for mi, s in zip(m.m, m.stride): #  from + for mi, s in zip(m.m, m.stride): # from b = mi.bias.view(m.na, -1) # conv.bias(255) to (3,85) b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image) b[:, 5:] += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls @@ -135,7 +135,7 @@ class Model(nn.Module): def _print_biases(self): m = self.model[-1] # Detect() module - for mi in m.m: #  from + for mi in m.m: # from b = mi.bias.detach().view(m.na, -1).T # conv.bias(255) to (3,85) print(('%6g Conv2d.bias:' + '%10.3g' * 6) % (mi.weight.shape[1], *b[:5].mean(1).tolist(), b[5:].mean())) diff --git a/utils/utils.py b/utils/utils.py index 839656a..7d8d7a9 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -21,7 +21,7 @@ import yaml from scipy.signal import butter, filtfilt from tqdm import tqdm -from . import torch_utils #  torch_utils, google_utils +from . import torch_utils # torch_utils, google_utils # Set printoptions torch.set_printoptions(linewidth=320, precision=5, profile='long') @@ -84,7 +84,7 @@ def check_anchors(dataset, model, thr=4.0, imgsz=640): r = wh[:, None] / k[None] x = torch.min(r, 1. / r).min(2)[0] # ratio metric best = x.max(1)[0] # best_x - return (best > 1. / thr).float().mean() #  best possible recall + return (best > 1. / thr).float().mean() # best possible recall bpr = metric(m.anchor_grid.clone().cpu().view(-1, 2)) print('Best Possible Recall (BPR) = %.4f' % bpr, end='')