Fix redundant outputs via Logging in DDP training (#500)
* Change print to logging * Clean function set_logging * Add line spacing * Change leftover prints to log * Fix scanning labels output * Fix rank naming * Change leftover print to logging * Reorganized DDP variables * Fix type error * Make quotes consistent * Fix spelling * Clean function call * Add line spacing * Update datasets.py * Update train.py Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
1 parent
542833c997
commit
4949401a94
5 files changed
+56
-39
No files matched your search
+4
-2
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import math
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
|
||||
@@ -12,6 +13,7 @@ from utils.general import check_anchor_order, make_divisible, check_file
|
||||
from utils.torch_utils import (
|
||||
time_synchronized, fuse_conv_and_bn, model_info, scale_img, initialize_weights, select_device)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class Detect(nn.Module):
|
||||
def __init__(self, nc=80, anchors=(), ch=()): # detection layer
|
||||
@@ -169,7 +171,7 @@ class Model(nn.Module):
|
||||
|
||||
|
||||
def parse_model(d, ch): # model_dict, input_channels(3)
|
||||
print('\n%3s%18s%3s%10s %-40s%-30s' % ('', 'from', 'n', 'params', 'module', 'arguments'))
|
||||
logger.info('\n%3s%18s%3s%10s %-40s%-30s' % ('', 'from', 'n', 'params', 'module', 'arguments'))
|
||||
anchors, nc, gd, gw = d['anchors'], d['nc'], d['depth_multiple'], d['width_multiple']
|
||||
na = (len(anchors[0]) // 2) if isinstance(anchors, list) else anchors # number of anchors
|
||||
no = na * (nc + 5) # number of outputs = anchors * (classes + 5)
|
||||
@@ -224,7 +226,7 @@ def parse_model(d, ch): # model_dict, input_channels(3)
|
||||
t = str(m)[8:-2].replace('__main__.', '') # module type
|
||||
np = sum([x.numel() for x in m_.parameters()]) # number params
|
||||
m_.i, m_.f, m_.type, m_.np = i, f, t, np # attach index, 'from' index, type, number params
|
||||
print('%3s%18s%3s%10.0f %-40s%-30s' % (i, f, n, np, t, args)) # print
|
||||
logger.info('%3s%18s%3s%10.0f %-40s%-30s' % (i, f, n, np, t, args)) # print
|
||||
save.extend(x % i for x in ([f] if isinstance(f, int) else f) if x != -1) # append to savelist
|
||||
layers.append(m_)
|
||||
ch.append(c2)
|
||||
|
||||
Reference in new issue
Block a user