Doarchive

YOLOv7 Error : subprocess.CalledProcessError: Command 'git tag' returned non-zero exit status 128. 본문

Computer Vision/Deep learning

YOLOv7 Error : subprocess.CalledProcessError: Command 'git tag' returned non-zero exit status 128.

오순발닦개 2023. 4. 5. 11:24

 

1. 학습시 에러가 발생하는 경우  (train.py)

 

KeyError: 'assets'

During handling of the above exception, another exception occurred: Traceback (most recent call last):

File "/content/gdrive/MyDrive/guideDetection/yolov7/train.py", line 616, in <module> train(hyp, opt, device, tb_writer)

File "/content/gdrive/MyDrive/guideDetection/yolov7/train.py", line 86, in train attempt_download(weights) # download if not found locally

File "/content/gdrive/MyDrive/guideDetection/yolov7/utils/google_utils.py", line 31, in attempt_download tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]

File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

File "/usr/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command 'git tag' returned non-zero exit status 128.

 

 

 

YOLOv7 train.py 파일을 수정해준다 

 85,86 lines 주석처리if pretrained:

        # with torch_distributed_zero_first(rank):
        #     attempt_download(weights)  # download if not found locally
        ckpt = torch.load(weights, map_location=device)  # load checkpoint
        model = Model(opt.cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device)  # create

 

 

 

2. 테스트시 에러가 발생하는 경우  (detect.py)

 

KeyError: 'assets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/content/gdrive/MyDrive/guideDetection/yolov7/detect.py", line 196, in <module> detect()

File "/content/gdrive/MyDrive/guideDetection/yolov7/detect.py", line 34, in detect model = attempt_load(weights, map_location=device) # load FP32 model

File "/content/gdrive/MyDrive/guideDetection/yolov7/models/experimental.py", line 249, in attempt_load attempt_download(w)

File "/content/gdrive/MyDrive/guideDetection/yolov7/utils/google_utils.py", line 31, in attempt_download tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]

File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

File "/usr/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'git tag' returned non-zero exit status 128.

 

 

yolov7/models/experimental.py 파일을 수정한다 

 

 

251 line 주석처리

 

for w in weights if isinstance(weights, listelse [weights]:
        #attempt_download(w)
        ckpt = torch.load(w, map_location=map_location)  # load
        model.append(ckpt['ema' if ckpt.get('ema'else 'model'].float().fuse().eval())  # FP32 model

 

 

728x90