-2
Traceback (most recent call last):
File "C:\Users\Gary\Desktop\yolov5-5.0\yolov5-5.0\train.py", line 543, in <module>
train(hyp, opt, device, tb_writer)
File "C:\Users\Gary\Desktop\yolov5-5.0\yolov5-5.0\train.py", line 88, in train
model = Model(opt.cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device)  # create
File "C:\Users\Gary\Desktop\yolov5-5.0\yolov5-5.0\models\yolo.py", line 73, in __init__
self.yaml_file = Path(cfg).name
NameError: name 'Path' is not defined

please, how to solve those problems?

1
  • Are you sure you have imported pathlib? As from pathlib import Path?
    – Ivan
    Commented Mar 27, 2023 at 9:03

1 Answer 1

2

You need to import Path which you can do so using from pathlib import Path

1
  • You are welcome @GaryZhou - please select my response as the answer (the tick on the left side). Thanks Commented Mar 27, 2023 at 15:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.