Browse Source

Improved yolo.py profiling (#2940)

* Improved yolo.py profiling

Improved column order and labelling.

* Update yolo.py
modifyDataloader
Glenn Jocher GitHub 3 years ago
parent
commit
4890499344
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      models/yolo.py

+ 5
- 2
models/yolo.py View File

@@ -134,7 +134,9 @@ class Model(nn.Module):
for _ in range(10):
_ = m(x)
dt.append((time_synchronized() - t) * 100)
logger.info('%10.1f%10.0f%10.1fms %-40s' % (o, m.np, dt[-1], m.type))
if m == self.model[0]:
logger.info(f"{'time (ms)':>10s} {'GFLOPS':>10s} {'params':>10s} {'module'}")
logger.info(f'{dt[-1]:10.2f} {o:10.2f} {m.np:10.0f} {m.type}')

x = m(x) # run
y.append(x if m.i in self.save else None) # save output
@@ -157,7 +159,8 @@ class Model(nn.Module):
m = self.model[-1] # Detect() module
for mi in m.m: # from
b = mi.bias.detach().view(m.na, -1).T # conv.bias(255) to (3,85)
logger.info(('%6g Conv2d.bias:' + '%10.3g' * 6) % (mi.weight.shape[1], *b[:5].mean(1).tolist(), b[5:].mean()))
logger.info(
('%6g Conv2d.bias:' + '%10.3g' * 6) % (mi.weight.shape[1], *b[:5].mean(1).tolist(), b[5:].mean()))

# def _print_weights(self):
# for m in self.model.modules():

Loading…
Cancel
Save