高速公路违停检测
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223
  1. #!/usr/bin/python
  2. # -*- encoding: utf-8 -*-
  3. import os.path as osp
  4. import time
  5. import sys
  6. import logging
  7. import torch.distributed as dist
  8. def setup_logger(logpth):
  9. logfile = 'BiSeNet-{}.log'.format(time.strftime('%Y-%m-%d-%H-%M-%S'))
  10. logfile = osp.join(logpth, logfile)
  11. FORMAT = '%(levelname)s %(filename)s(%(lineno)d): %(message)s'
  12. log_level = logging.INFO
  13. if dist.is_initialized() and not dist.get_rank()==0:
  14. log_level = logging.ERROR
  15. logging.basicConfig(level=log_level, format=FORMAT, filename=logfile)
  16. logging.root.addHandler(logging.StreamHandler())