在运行深度学习的模型当中,新手小白可能会经常碰到一些模型报错,下面汇总一些我自己运行过程当中的常见报错的解决方案:
注:本篇文章的所有模型都是bubbliiiing大佬的github网站上下载的,对新手小白非常友好,github网站指路https://github.com/bubbliiiing
1、ModuleNotFoundError: No module named 'XXX'
解决方案:环境当中没有配置XXX,需要在控制窗口输入pip install XXX
2、AttributeError: 'FigureCanvasTkAgg' object has no attribute 'set_window_title'
解决方案:点击相应链接,在canvas.和set_window_title之间添加manager.
3、RuntimeError: no valid convolution algorithms available in CuDNN
解决方案:降低Freeze_batch_size和Unfreeze_batch_size的数值,比如从8改成4,从4改成2
4、Error: Error(s) in loading state_dict for SSD300
解决方案:没有修改model_path为train.py运行之后产生的loss的.pth文件,将model_path改为logs/best_epoch_weights.pth
5、FileNotFoundError: [Errno 2] No such file or directory: 'model_data/yolov5_s.pth'
解决方案:没有下载相对应的.pth文件,在readme当中的指定路径下载.pth训练权重文件,将其添加到model_data文件夹当中
6、ImportError: cannot import name 'notf' from 'tensorboard.compat'
TypeError: Descriptors cannot be created directly.
解决方案:原先的tensorboard版本太高,与 tensorflow不适配,降级tensorboard版本
7、AttributeError: 'ImageDraw' object has no attribute 'textsize'
解决方案:卸载并重新下载低版本pillow
8、ModuleNotFoundError: No module named 'git'
解决方案:pip install gitpython
9、ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
报错原因:页面文件太小,无法完成操作
解决方案:扩大C盘的虚拟内存到10000MB~(详见CSDN其他大佬操作)
10、TypeError: function takes at most 14 arguments (17 given)
解决方案:
11、AssertionError: train: No labels found in E:\langezhang\yolov5-master\paper_data\ dataSet_path\train.cache, can not start training.
解决方案:修改sa、sb的路径
12、RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
解决方案:
13、TypeError: Descriptors cannot be created directly.
解决方案:这个错误表明描述符无法直接创建,通常是由于protobuf库版本不兼容导致的,卸载并重新下载protobuf 3.20.0
14、NameError: name 'MLPBlock' is not defined
解决方案:在block.py中添加该class~