Spaces:
Runtime error
Runtime error
File size: 740 Bytes
8aa4f1e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import logging
import os.path as osp
from termcolor import colored
def set_logging(name=None, verbose=True):
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
# Sets level and returns logger
# rank = int(os.getenv('RANK', -1)) # rank in world for Multi-GPU trainings
fmt = (
# colored("[%(name)s]", "magenta", attrs=["bold"])
colored("[%(asctime)s]", "blue")
+ colored("%(levelname)s:", "green")
+ colored("%(message)s", "white")
)
logging.basicConfig(format=fmt, level=logging.INFO if verbose else logging.WARNING)
return logging.getLogger(name)
LOGGER = set_logging(__name__) # define globally (used in train.py, val.py, detect.py, etc.)
|