Integer printout (#2450)
* Integer printout * test.py 'Labels' * Update train.py
This commit is contained in:
parent
886f1c03d8
commit
f01f3223d5
4
test.py
4
test.py
|
|
@ -93,7 +93,7 @@ def test(data,
|
||||||
confusion_matrix = ConfusionMatrix(nc=nc)
|
confusion_matrix = ConfusionMatrix(nc=nc)
|
||||||
names = {k: v for k, v in enumerate(model.names if hasattr(model, 'names') else model.module.names)}
|
names = {k: v for k, v in enumerate(model.names if hasattr(model, 'names') else model.module.names)}
|
||||||
coco91class = coco80_to_coco91_class()
|
coco91class = coco80_to_coco91_class()
|
||||||
s = ('%20s' + '%12s' * 6) % ('Class', 'Images', 'Targets', 'P', 'R', 'mAP@.5', 'mAP@.5:.95')
|
s = ('%20s' + '%12s' * 6) % ('Class', 'Images', 'Labels', 'P', 'R', 'mAP@.5', 'mAP@.5:.95')
|
||||||
p, r, f1, mp, mr, map50, map, t0, t1 = 0., 0., 0., 0., 0., 0., 0., 0., 0.
|
p, r, f1, mp, mr, map50, map, t0, t1 = 0., 0., 0., 0., 0., 0., 0., 0., 0.
|
||||||
loss = torch.zeros(3, device=device)
|
loss = torch.zeros(3, device=device)
|
||||||
jdict, stats, ap, ap_class, wandb_images = [], [], [], [], []
|
jdict, stats, ap, ap_class, wandb_images = [], [], [], [], []
|
||||||
|
|
@ -223,7 +223,7 @@ def test(data,
|
||||||
nt = torch.zeros(1)
|
nt = torch.zeros(1)
|
||||||
|
|
||||||
# Print results
|
# Print results
|
||||||
pf = '%20s' + '%12.3g' * 6 # print format
|
pf = '%20s' + '%12i' * 2 + '%12.3g' * 4 # print format
|
||||||
print(pf % ('all', seen, nt.sum(), mp, mr, map50, map))
|
print(pf % ('all', seen, nt.sum(), mp, mr, map50, map))
|
||||||
|
|
||||||
# Print results per class
|
# Print results per class
|
||||||
|
|
|
||||||
2
train.py
2
train.py
|
|
@ -264,7 +264,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
|
||||||
if rank != -1:
|
if rank != -1:
|
||||||
dataloader.sampler.set_epoch(epoch)
|
dataloader.sampler.set_epoch(epoch)
|
||||||
pbar = enumerate(dataloader)
|
pbar = enumerate(dataloader)
|
||||||
logger.info(('\n' + '%10s' * 8) % ('Epoch', 'gpu_mem', 'box', 'obj', 'cls', 'total', 'targets', 'img_size'))
|
logger.info(('\n' + '%10s' * 8) % ('Epoch', 'gpu_mem', 'box', 'obj', 'cls', 'total', 'labels', 'img_size'))
|
||||||
if rank in [-1, 0]:
|
if rank in [-1, 0]:
|
||||||
pbar = tqdm(pbar, total=nb) # progress bar
|
pbar = tqdm(pbar, total=nb) # progress bar
|
||||||
optimizer.zero_grad()
|
optimizer.zero_grad()
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ def profile(x, ops, n=100, device=None):
|
||||||
s_in = tuple(x.shape) if isinstance(x, torch.Tensor) else 'list'
|
s_in = tuple(x.shape) if isinstance(x, torch.Tensor) else 'list'
|
||||||
s_out = tuple(y.shape) if isinstance(y, torch.Tensor) else 'list'
|
s_out = tuple(y.shape) if isinstance(y, torch.Tensor) else 'list'
|
||||||
p = sum(list(x.numel() for x in m.parameters())) if isinstance(m, nn.Module) else 0 # parameters
|
p = sum(list(x.numel() for x in m.parameters())) if isinstance(m, nn.Module) else 0 # parameters
|
||||||
print(f'{p:12.4g}{flops:12.4g}{dtf:16.4g}{dtb:16.4g}{str(s_in):>24s}{str(s_out):>24s}')
|
print(f'{p:12}{flops:12.4g}{dtf:16.4g}{dtb:16.4g}{str(s_in):>24s}{str(s_out):>24s}')
|
||||||
|
|
||||||
|
|
||||||
def is_parallel(model):
|
def is_parallel(model):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue