高速公路违停检测
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

24 rindas
598B

  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())