![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
debug
CV干饭王
这个作者很懒,什么都没留下…
展开
-
Windows下 pytorch 分布式训练方法
torch1.7 以下版本不支持Windows下的分布式训练,会报错 AttributeError: module ‘torch.distributed‘ has no attribute ‘init_process_group‘ 。步骤:1、将本机torch版本升到1.7.0以上,torchvision升到对应的0.8.0版本以上。(1.5~1.8 版本的 torch 代码基本都兼容)温馨提示:建议离线下载 torch1.7.1 版本,torchvision0.8.2 版本。下载链接如下:原创 2021-06-23 12:59:00 · 2761 阅读 · 0 评论 -
pytorch分布式训练报错:AttributeError: module ‘torch.distributed‘ has no attribute ‘init_process_group‘ 解决方法
torch1.7 以下版本在Windows下进行分布式训练会报错:AttributeError: module ‘torch.distributed’ has no attribute ‘init_process_group’报错原因:torch1.7 以下版本不支持Windows下的分布式训练,在Linux内核才不会报这个错。解决办法:方法1:换成Linux系统运行代码。。。(要是没有条件直接看 方法2)方法2:1)、将Windows下的 torch 换成 1.7.0及以上的版本。(1原创 2021-06-23 12:51:50 · 7677 阅读 · 3 评论 -
开源框架运行报错:str object has no attribute decode,解决方法
我是在配置 MaskR-CNN 的时候遇到这个问题,在下图这个加载预训练模型的时候报错:str object has no attribute decode。经多方百度排查后发现是 h5py 模块版本过高。(报错时我的版本是3.10)解决方法:卸载现有版本再安装一个低版本的h5py即可。卸载:pip uninstall h5py重新安装低版本的:(卸载不了就直接运行这个,源如果没更改的话,建议加上国内源)pip install h5py==2.10 -i https://pypi.tuna原创 2021-03-16 22:03:46 · 3095 阅读 · 6 评论 -
The file Tomcat8.exe was not found... Either the CATALINA_HOME environment variable is not defined c
Tomcat service安装错误命令行输入:service install报错:The file Tomcat8.exe was not found...Either the CATALINA_HOME environment variable is not defined correctly orthe incorrect service name has been used.Both the CATALINA_HOME environment variable and the cor原创 2020-11-11 15:58:02 · 6218 阅读 · 3 评论 -
Cannot uninstall ‘scikit-learn’. It is a distutils installed project and thus we cannot accurately d
sklearn升级遇到的问题Cannot uninstall ‘scikit-learn’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.解决方法:1.先用conda卸载旧版本的sklearn,一定用conda,不能用pip;conda remove sc原创 2020-11-06 19:39:42 · 1492 阅读 · 0 评论 -
python调用:cPickle.load()报错:UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0x88 in position 157
python2报错代码:import cPicklef = gzip.open('./dataset/mnist.pkl.gz', 'rb')cPickle.load(f)python3.x报错代码:import _pickle as cPicklef = gzip.open('./dataset/mnist.pkl.gz', 'rb')cPickle.load(f)报错信息:UnicodeDecodeError: ‘ascii’ codec can’t decode byte原创 2020-12-09 21:33:08 · 630 阅读 · 0 评论 -
python报错:TabError: inconsistent use of tabs and spaces in indentation
python代码在编辑后经常会报下面的错:TabError: inconsistent use of tabs and spaces in indentation报错原因:所使用的文本编辑器没有将Tab(\t)键转换为4个空格,而python本身编译器不认这个Tab,导致报错TabError。解决方法:将代码中的所有的Tab键全部删掉,改为手敲4下空格!!!注:python编辑时按回车换行,这一行的前面也都是Tab,即也要改为4个空格。。。...原创 2020-12-09 21:18:51 · 322 阅读 · 0 评论 -
python3.x报错:No module named ‘cPickle‘。解决方法(简单粗暴)
在python加载一些数据时,利用数据官网提供的加载方法或者python2中的加载方法,经常会报错: No module named ‘cPickle’。报错原因:python2中的cPickle库在python3.x中更新改名了。。。现在叫_pickle或pickle。解决方法:将python2代码中的import cPickle在python3.x中改为(二选一,都行)import pickle as cPickleimport _pickle as cPickle...原创 2020-12-09 20:53:33 · 1204 阅读 · 1 评论 -
cv2读取图片报错cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:
opencv-python在执行图片读取代码时经常会报错:cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow’报错时cv2的代码如下:import cv2filen原创 2020-11-26 10:27:47 · 3432 阅读 · 1 评论 -
TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists found
pytorch数据集加载报错:TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists found报错原因:没有将数据转为torch的Tensor数据类型。解决方法:读取数据集时将数据转为Tensor数据类型即可。import torchimport torchvisionimport torch.nn as nnimport torch.utils.data原创 2020-11-21 15:52:55 · 41883 阅读 · 4 评论 -
pytorch报错:CUDA error: an illegal memory access was encountered
pytorch1.6版本在训练时报错:RuntimeError: CUDA error: an illegal memory access was encountered报错原因与低版本的pytorch(如1.1版本)报错相同:RuntimeError: Expected object of backend CUDA but got backend CPU for argument #解决方法:https://blog.csdn.net/weixin_44414948/article/detai原创 2020-11-21 12:25:31 · 26260 阅读 · 6 评论 -
pytorch调用GPU(cuda)报错RuntimeError: Expected object of backend CUDA but got backend CPU for argument
用pytorch写的代码调用GPU(cuda)时,很容易下面的报错:RuntimeError: Expected object of backend CUDA but got backend CPU for argument报错原因:模型model、损失函数criterion、输入数据(input_image、input_label)没有全部移动到GPU(cuda)上。解决方法:将model、input_image、input_label全部移动到cuda上,实例代码如下:model = mod原创 2020-11-18 20:02:51 · 2514 阅读 · 6 评论 -
pytorch下载mnist数据集报错:EOFError: Compressed file ended before the end-of-stream marker was reached
pytorch运行下图代码,下载mnist数据集时报错。EOFError: Compressed file ended before the end-of-stream marker was reachedtrain_dataset = datasets.MNIST( root=r'./mnist', train=True, download=True, transform=transform )解决方法:删除设定代原创 2020-11-18 18:53:31 · 521 阅读 · 0 评论 -
解决pytorch下载mnist等数据集速度过慢、失败问题
问题:pytorch用torchvision下载数据集时速度极慢,而且大概率下载失败,就很恶心人,心态炸裂,故写本文提出解决此问题的方法。原因:下载速度极慢主要原因是pytorch下载数据集的网站如下图所示,属于国外网站,访问受限且极不稳定,解决此问题的最好方法就是自己把mnist等数据集下载到本地,然后把download参数改为False,但此时仍然会报错!原因是没有在./MNIST/processed/目录下生成(.pt)文件。torchvision加载mnist数据集的代码如下:train原创 2020-11-17 22:50:18 · 9259 阅读 · 8 评论