训练时遇到:
Namespace(augment=False, batch_size=2, conf_thres=0.001, data='data/Aquarium_Combined_v3.yaml', device='', exist_ok=False, img_size=640, iou_thres=0.65, name='exp', no_trace=False, project='runs/test', save_conf=False, save_hybrid=False, save_json=False, save_txt=False, single_cls=False, task='val', v5_metric=False, verbose=False, weights='/home/yolov7-main/runs/train/yolov7+SIOU_Focal/weights/best.pt')
YOLOR 2022-10-8 torch 1.9.0+cu111 CUDA:0 (NVIDIA GeForce RTX 3080 Ti, 12053.8125MB)
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "/home/yolov7-main/utils/google_utils.py", line 26, in attempt_download
assets = [x['name'] for x in response['assets']] # release assets
KeyError: 'assets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 320, in
test(opt.data,
File "test.py", line 58, in test
model = attempt_load(weights, map_location=device) # load FP32 model
File "/home/yolov7-main/models/experimental.py", line 251, in attempt_load
attempt_download(w)
File "/home/yolov7-main/utils/google_utils.py", line 31, in attempt_download
tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'git tag' returned non-zero exit status 128.
这是因为执行test.py的时候,pt文件路径中不能有大写字母,将大写字母去掉就可以了。
参考解决:yolov7在训练或测试时,出现fatal: not a git repository (or any...)及lndexError: list index out of range错误 - 知乎 (zhihu.com)