pytorch yolo4 感谢博主https://blog.csdn.net/weixin_44791964/article/details/106214657
ModuleNotFoundError: No module named ‘cv2’
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
Traceback (most recent call last):
File “/home/pc001/e/gcgnew/yolov4-pytorch-master/nets/yolo_training.py”, line 8, in
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
ModuleNotFoundError: No module named ‘matplotlib’
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib
Traceback (most recent call last):
File “/home/pc001/e/gcgnew/yolov4-pytorch-master/get_dr_txt.py”, line 18, in
from tqdm import tqdm
ModuleNotFoundError: No module named ‘tqdm’
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tqdm
Traceback (most recent call last):
File “/home/pc001/e/gcgnew/yolov4-pytorch-master/get_dr_txt.py”, line 75, in
yolo = mAP_Yolo()
File “/home/pc001/e/gcgnew/yolov4-pytorch-master/yolo.py”, line 45, in init
self.generate()
File “/home/pc001/e/gcgnew/yolov4-pytorch-master/yolo.py”, line 76, in generate
state_dict = torch.load(self.model_path, map_location=device)
File “/home/pc001/anaconda3/envs/yolo4pytorch/lib/python3.6/site-packages/torch/serialization.py”, line 381, in load
f = open(f, ‘rb’)
FileNotFoundError: [Errno 2] No such file or directory: ‘model_data/yolo4_weights.pth’
没有对应的权重文件
Traceback (most recent call last):
File “/home/pc001/e/gcgnew/yolov4-pytorch-master/VOCdevkit/VOC2007/voc2yolo4.py”, line 11, in
temp_xml = os.listdir(xmlfilepath)
FileNotFoundError: [Errno 2] No such file or directory: ‘./VOCdevkit/VOC2007/Annotations’
xmlfilepath=r'./VOCdevkit/VOC2007/Annotations'
saveBasePath=r"./VOCdevkit/VOC2007/ImageSets/Main/"
print(xmlfilepath)
print 的路径不正确
解决方式:1 改为绝对路径
xmlfilepath=r'/home/pc001/e/gcgnew/yolov4-pytorch-master/VOCdevkit/VOC2007/Annotations'
saveBasePath=r"/home/pc001/e/gcgnew/yolov4-pytorch-master/VOCdevkit/VOC2007/ImageSets/Main/"
2
ROOT_DIR = os.getcwd()
xmlfilepath=os.path.join(ROOT_DIR, r"Annotations/")
saveBasePath=os.path.join(ROOT_DIR,r"ImageSets/Main/")
# xmlfilepath=r'./VOCdevkit/VOC2007/Annotations'
# saveBasePath=r"./VOCdevkit/VOC2007/ImageSets/Main/"