
pytorch
文章平均质量分 52
SY_qqq
这个作者很懒,什么都没留下…
展开
-
chumpy+py3 报错 numpy
chumpy库+py39原创 2023-01-31 15:47:38 · 2362 阅读 · 0 评论 -
scatter_ 做 one-hot的一些要注意的点
1.如当label_map的范围是[0,19]one-hot的通道大小为torch.FloatTensor(bs,20,h,w)一般label_map经过transfrom后,通过totensor操作,压缩到了[0,1]的范围,然后要再执行两步label = label*255.0 (因为label不需要压缩到[0,1], 还是要恢复到[0,19]label [label==255] = 20 这一步是排除一些图像中的不关系的像素,按道理来说label*255.0后不会得到255这...原创 2022-05-21 22:40:46 · 332 阅读 · 0 评论 -
《Neural Pose Transfer by Spatially Adaptive Instance Normalization》
概括: 对identity mesh 做pose transfer, 实际上是让提供目标pose的human mesh 学到identity的style。关键在于要让生成的mesh的点的顺序和identity mesh的一致而不是pose mesh。传统的做法是学习在同一个pose下,不同identity style之间的correspondence,利用correspondence 去算displacement。做法:这里用PointNet提取点的特征,把每个vertex当做一个poi..原创 2021-07-05 17:18:48 · 339 阅读 · 0 评论 -
SEAN 代码略解
这篇《SEAN: Image Synthesis with Semantic Region-Adaptive Normalization》是2020年CVPR的一篇oral,对它的代码做一个梳理。由于已经做过了关于SPADE的解析,这一篇主要是看看它在SPADE上有什么改进不同之处一: models/networks/generator.py def __init__(self, opt): super().__init__() self.opt = o.原创 2021-05-09 22:47:44 · 947 阅读 · 2 评论 -
guided-pix2pix 代码略解
《Guided Image-to-Image Translation with Bi-Directional Feature Transformation》train.py model.set_input(data) model.optimize_parameters()开始训练models/guided_pix2pix_model.py def set_input(self, input): self.real_A原创 2021-04-29 11:20:45 · 796 阅读 · 4 评论 -
SPADE 代码略解 ade20k数据集
train.py # Training # train generator if i % opt.D_steps_per_G == 0: trainer.run_generator_one_step(data_i)通过这一行代码开始训练。trainers/pix2pix_trainer.py def run_generator_one_step(self, data): self.optimize原创 2021-04-27 11:42:56 · 3138 阅读 · 2 评论 -
pytorch dataloader worker is killed by signal killed
在网上查了很久的资料都说是内存的问题,或者把num_work给调成0。但是对于我的问题没有得到解决这里提供另一个思路,可能是dataloader在读__get_item__的时候没有读正确,我的问题就是因为这个,没有读到正确的数据集,所以可以检查一下自己的数据集是不是读正确了...原创 2020-10-29 15:12:43 · 1584 阅读 · 0 评论 -
RuntimeError: Trying to backward through the graph a second time but the buffers have already been f
RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed遇到过几次这个报错了,这几天把backward和autograd给看了几遍,终于摸着点门道首先要知道,为什么会报这个错,这个错翻译成白话文就是说:当我们第二次backward的时候,计算图的结构已经被破坏了(释放了),这也是pytorch动态图的机制,可以节省内存。这里不仔细讲解backw原创 2020-07-16 23:10:31 · 27094 阅读 · 16 评论 -
RuntimeError:invalid argument 2:size ‘[1x18x256x256]‘ is invalid for input with 196608 elements as
发现是用了view之后导致的错误本来view之后的1x18x256x256 =1179648 ,但和196608不符合, view的形状可能有问题原创 2020-07-01 23:29:29 · 2065 阅读 · 0 评论 -
Error(s) in loading state_dict for XXX Unexpected key(s) in state_dict, 找不到num_batches_tracked
今天在训练的时候发现加载模型的时候提示找不到num_batches_tracked,感到奇怪,因为之前已经成功训练过一次了怎么这次就报错了呢,后来发现,第一次训练的时候我用的是0.4.0的pytorch,这次用的是1.0的Pytorch,因为torch的版本不一样引起的问题KeyError: 'unexpected key "module.bn1.num_batches_tracked" in state_dict'得到类似这样的报错以下参考自这篇文章https://zhuanlan.zhi.原创 2020-06-24 14:27:54 · 745 阅读 · 0 评论 -
Error with matplotlib.show() : module 'matplotlib' has no attribute 'show'
不要用import matplotlib as plt改成import matplotlib.pyplotas plt原创 2019-07-18 21:04:57 · 7755 阅读 · 4 评论 -
BrokenPipeError: [Errno 32] Broken pipe
<deep learning with pytorch>训练一个分类器问题:在show 训练集的图像的时候出现报错我的代码train.pyimport torchimport torchvisionimport torchvision.transforms as transforms#因为torchvision的数据集的输出格式是PIL图像,范围在[0,1...原创 2019-07-18 20:59:14 · 9768 阅读 · 13 评论