TypeError: A logger name must be a string

在改进YOLOv7实验过程中,出现的问题,问了下度娘,看到很多人在问,貌似没有给出解决办法,我给大家提供一种解决思路。

原问题:

/home/snnu/miniconda3/envs/yolov7/bin/python /media/snnu/dataset/chenkequan/huiyiPaper/yolov7/train.py --weights ./checkpoint/yolov7.pt --cfg ./cfg/yolov7-improve/yolov7_helmet_DeformeableConV2.yaml --data ./data/dataset_helmet_RH_ALL.yaml --epochs 300 --batch-size 16 --device 0,1 --project yolov7_helmet_Improve
Traceback (most recent call last):
  File "/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/config.py", line 617, in configure
    self.configure_logger((name), loggers[name])
  File "/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/config.py", line 785, in configure_logger
    logger = logging.getLogger(name)
  File "/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/__init__.py", line 1935, in getLogger
    return Logger.manager.getLogger(name)
  File "/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/__init__.py", line 1229, in getLogger
    raise TypeError('A logger name must be a string')
TypeError: A logger name must be a string

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/media/snnu/dataset/chenkequan/huiyiPaper/yolov7/train.py", line 568, in
    set_logging(opt.global_rank)
  File "/media/snnu/dataset/chenkequan/huiyiPaper/yolov7/utils/general.py", line 104, in set_logging
    'propagate': False, }}})
  File "/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/config.py", line 800, in dictConfig
    dictConfigClass(config).configure()
  File "/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/config.py", line 620, in configure
    '%r' % name) from e
ValueError: Unable to configure logger -1

Process finished with exit code 1
 

解决方法:

直接在

/home/snnu/miniconda3/envs/yolov7/lib/python3.7/logging/config.py中的

  self.configure_logger((name), loggers[name])

改为

  self.configure_logger(str(name), loggers[name])

你可能感兴趣的:(问题杂记,python,机器学习,深度学习)