
深度学习
喜碧CatBrother
这个作者很懒,什么都没留下…
展开
-
EOFError: Compressed file ended before the end-of-stream marker was reached
分析问题:本人是通过下载资源中断后再次运行代码时出现的该error,应该是之前下载了部分资源,但是不完整导致的。解决方法:1、尝试删除之前所下载的资源,重新下载2、修改下载所需保存的路径...原创 2021-01-09 10:18:42 · 654 阅读 · 2 评论 -
urllib.error.URLError
“蜜汁error,可能就像情绪那样莫测吧”urllib.error.URLError目前遇到两种出现形式:urllib.error.URLError: <urlopen error [Errno 104] Connection reset by peer>解决方案(因无权限,没有亲测):yum install opensslurllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ss原创 2021-01-08 22:42:10 · 3028 阅读 · 0 评论 -
RuntimeError: Expected object of backend CPU but got backend CUDA for argument #4 'mat1'
RuntimeError: Expected object of backend CPU but got backend CUDA for argument #4 'mat1'该Error出现在pytroch框架下,加载完模型后计划修改最后一层全连接层。 checkpoint = torch.load(config.best_models + config.model_name...原创 2019-12-08 11:06:56 · 1326 阅读 · 1 评论 -
RuntimeError: CUDA error: device-side assert triggered
RuntimeError: CUDA error: device-side assert triggered该Error是在pytorch框架下出现的,其原因是样本的label种类大于了代码所设置的类别数。建议将类别数调到与label种类数相等或略大于label类数。...原创 2019-12-08 11:02:43 · 1823 阅读 · 0 评论 -
RuntimeError: The size of tensor a (40) must match the size of tensor b (41) at non-singleton dimens
RuntimeError: The size of tensor a (40) must match the size of tensor b (41) at non-singleton dimension 3此类还是维度问题,建议尝试以下几种解决方案:1、model.avg_pool = nn.AvgPool2d(kernel_size=1, stride=1, padding=0) mo...原创 2019-10-25 20:36:46 · 22456 阅读 · 3 评论 -
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 14 and 13
情况一:作为输入的图像数据的维度不符合模型的要求,常用的输入大小有224*224,笔者暂时没找到精确知晓模型所需输入图像数据维度大小的方法,只能凭借经验尝试。若有大牛知晓,烦请告知。此外,还有一种可能是数据集里面图像维度不一,因此最好进入模型前对图像数据维度进行处理。情况二:batch_size可能是导致该问题的因素之一,简单来说就是数据集总数不能整除batch_size,最后导致维度不匹配...原创 2019-10-24 23:20:07 · 1103 阅读 · 0 评论 -
RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found
笔者正在进行PyTorch框架下的多卡并行计算初探,目前常用的方式有:model = torch.nn.DataParallel(model, device_ids = [0,1,2,3])该方法主要用于一机多卡。model = torch.nn.parallel.DistributedDataParallel(model,device_ids=[arg.local_rank],outp...原创 2019-06-03 23:59:14 · 42634 阅读 · 9 评论 -
RuntimeError: size mismatch
RuntimeError: size mismatch出现于pytorch框架下加载VGG11预训练模型时出现的错误。笔者初期认为,出现该错误的主要原因是输出和输入的维度不匹配。带着疑惑,我们通过输出网络模型结构来观察:我们可以看到(18): Conv2d输出的维度是512,(avgpool): AdaptiveAvgPool2d输出的维度是77,(0): Linear输入的维度是25088。...原创 2019-06-01 21:41:11 · 16517 阅读 · 1 评论 -
ValueError: invalid literal for int() with base 10: 'train'之文件路径(Linux代码移植到Windows)
bug的开头总是这样,适逢其会,猝不及防。笔者在Linux下成功运行的代码移植到Windows下运行报错,Linux和Windows还是有些许细微差别,在此记录一次小坑。欢迎各位同僚留言各种Linux和Windows互相移植出现的bug,希望能总结差异便于移植。定位到错误语句,断点调试,发现是Linux与Windows之间正斜杆与反斜杠之间的差异。因此,在操作正反斜杆时建议先统一正反斜杠...原创 2019-05-23 15:49:48 · 3411 阅读 · 2 评论 -
ValueError:could not broadcast input array from shape (450,600,3) into shape (64,64,3)
笔者的朋友在使用TensorFlow框架时出现如上问题,其原因为尺寸不匹配,通过resize即可解决a.resize((64,64,3))reshape与resize区别:reshape:有返回值,所谓有返回值,即不对原始多维数组进行修改;resize:无返回值,所谓有返回值,即会对原始多维数组进行修改;...原创 2019-05-21 19:59:03 · 15698 阅读 · 0 评论 -
AttributeError: 'tuple' object has no attribute 'log_softmax'
入门深度学习时遇到的问题,小记一下,如大牛有更好的建议,请多多指教。在调试Inception-v3时出现的error,建议尝试的解决方法如下: model = torchvision.models.inception_v3(pretrained = True) model.aux_logits = False笔者框架使用的是pytorch,其他框架未尝试。或者尝试:ou...原创 2019-05-21 19:50:32 · 14185 阅读 · 4 评论