PS:笔者以下问题都是基于在yolov5-v6.0版本出现
问题1:在运行train.py时出现以下报错
D:\ProgramData\Anaconda3\envs\yolov5\python.exe D:/yxt/yolov5-master/train.py
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\git\__init__.py", line 140, in <module>
refresh()
File "D:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\git\__init__.py", line 127, in refresh
if not Git.refresh(path=path):
File "D:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\git\cmd.py", line 455, in refresh
raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial message can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|silent|none|n|0: for no message or exception
- warn|w|warning|log|l|1: for a warning message (logged at level CRITICAL, displayed by default)
- error|e|exception|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:/yxt/yolov5-master/train.py", line 100, in <module>
GIT_INFO = check_git_info()
File "D:\ProgramData\Anaconda3\envs\yolov5\lib\contextlib.py", line 75, in inner
return func(*args, **kwds)
File "D:\yxt\yolov5-master\utils\general.py", line 375, in check_git_info
import git
File "D:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\git\__init__.py", line 142, in <module>
raise ImportError("Failed to initialize: {0}".format(_exc)) from _exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial message can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|silent|none|n|0: for no message or exception
- warn|w|warning|log|l|1: for a warning message (logged at level CRITICAL, displayed by default)
- error|e|exception|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
Process finished with exit code 1
解决方法:
通过查询网友的解释,可能时因为yolov5的获取方式时直接下载的zip导致的,不是通过git方式下载会出现这个问题,可以通过以下解决
在cmd.py中
import os
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
import signal
问题2:
data = self.stream.read(size)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 234: illegal multibyte sequence
COMET INFO: Couldn't find a Git repository in 'D:\\yxt\\yolov5-master' nor in any parent directory. Set `COMET_GIT_DIRECTORY` if your Git Repository is elsewhere.
COMET WARNING: Unknown error exporting current conda environment
解决方法:
在修改自己的数据集时,往往时通过复制coco128.yaml文件再修改得到,这时候自己的yaml文件中可能存在不能解释的字符,以下两种方式都可以解决,
第一种:
# parent
# ├── yolov5
# └── datasets
# └── coco128 ← downloads here (7 MB)
第二种,也可以修改成如下所示:
# parent
# |--yolov5
# |--datasets
# |--coco128 <- downloads here (7 MB)
问题3:
COMET INFO: Couldn't find a Git repository in 'D:\\yxt\\yolov5-master' nor in any parent directory. Set `COMET_GIT_DIRECTORY` if your Git Repository is elsewhere.
COMET WARNING: Unknown error exporting current conda environment
解决方法:
这个报错暂时未修改,因为没有影响到训练。
问题4:
raise Exception("Dataset not found ❌") Exception: Dataset not found ❌
解决方法:
这种问题通常是设置的数据集路径不对文章来源:https://www.toymoban.com/news/detail-847777.html
要注意路径的datasets通常时与yolov5的工程路径在同一级目录下,不能放到yolov5工程目录下,修改目录即可以解决。文章来源地址https://www.toymoban.com/news/detail-847777.html
到了这里,关于yolov5训练自己的数据集问题排除的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!