kaijieshi7 / dynamic-convolution-pytorch Goto Github PK
View Code? Open in Web Editor NEWPytorch!!!Pytorch!!!Pytorch!!! Dynamic Convolution: Attention over Convolution Kernels (CVPR-2020)
Pytorch!!!Pytorch!!!Pytorch!!! Dynamic Convolution: Attention over Convolution Kernels (CVPR-2020)
请问您有自己实验了吗?速度和精度能达到论文那个水平吗
My image size is 112,112 and I got the below error. Any solution?
Line number
ConvLayers/dynamic_conv.py", line 176, in forward
_x = x.view(1, -1, height, width)# 变化成一个维度进行组卷积
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...)_
很感谢你的分享,但是我在调试过程中发现当输入为(128,1,20,30,30)这个tensor的通道为1时,代码会报错,
File "D:\anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 557, in init
super(Conv3d, self).init(
File "D:\anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 83, in init
self.reset_parameters()
File "D:\anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 86, in reset_parameters
init.kaiming_uniform_(self.weight, a=math.sqrt(5))
File "D:\anaconda3\envs\py38\lib\site-packages\torch\nn\init.py", line 381, in kaiming_uniform_
fan = _calculate_correct_fan(tensor, mode)
File "D:\anaconda3\envs\py38\lib\site-packages\torch\nn\init.py", line 350, in _calculate_correct_fan
fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor)
File "D:\anaconda3\envs\py38\lib\site-packages\torch\nn\init.py", line 282, in _calculate_fan_in_and_fan_out
receptive_field_size = tensor[0][0].numel()
IndexError: index 0 is out of bounds for dimension 0 with size 0
dynamic convolution能否使用在时间序列问题上,我想用dynamic convolution来提取时间特征,感谢分享
Dynamic conv3d中好像没有对卷积核参数做初始化,请问这是为什么呢?这样会有什么影响吗?
在打印的网络中并没有看到动态生成的weight和bias,这样是可以训练的嘛?(ps:此前在训练层注意力中,也用到了beta=nn.parameter,但是定义的参数beta值一直都没有改动!!!)。能问下您的pytorch版本嘛?
作者您好,感谢您对论文的复现!
程序中关于温度问题我还不太明白,期待您的回复:
1.不同的温度值对于模型的训练有什么影响呢?在程序的哪个部分可以体现呢?
2.如果想要使训练温度保持恒定,即不使用temperature annealing,在程序中需要做哪些改动呢?
再次表示感谢!祝您一切顺利!!
Thank you for providing this reproduction!
I have a question on the grouped convolution: in this line you use the grouped convolution to solve the mini-batch training problem.
Could we use the torch.Tensor.expand
to replace the grouped convolution, like:
weight_prime = weight.expand(K, weight.shape[0], weight.shape[1], weight.shape[2], weight.shape[3])
weight = torch.mm(softmax_attention, weight_prime).view(-1, x.shape[1], self.kernel_size, self.kernel_size)
In this way, we might aggregate the attention weight and the convolution weight together. However, this may cause another problem. If batch size (torch.mean(attention_weight, dim=0)
or torch.max(attention_weight, dim=0)
since they are calculated within the batch, in which the range is very close.
I am not sure whether this calculation is equivalent to the line :)
加入动态卷积之后,shape就变了,原来的ResNet预训练模型就不能用了,请问大佬有动态卷积的ResNet50预训练模型吗?
如题,尝试了很多种方式都不支持动态权重,您有什么好的建议吗?
我想请教下各位大佬,我在调试时发现每个卷积核的权重都是0.25,想问这是什么原因呢?怎么解决呢?
一直限制attention的输出大小,这是warmup的手法吗?为什么是加在attention后面而不是卷积后面呢?
当替换分组卷积时,weight的维度和group的维度不对应。
RuntimeError: Given groups=1024, expected weight to be at least 1024 at dimension 0, but got weight of size [32, 32, 3, 3] instead
aggregate_weight = torch.mm(softmax_attention, weight).view(-1, self.in_planes, self.kernel_size, self.kernel_size)
这一行应改成下面这样
aggregate_weight = torch.mm(softmax_attention, weight).view(-1, self.in_planes//self.groups, self.kernel_size, self.kernel_size)
I am really interested in a fantastic Dynamic Convolution and I intend to use it in my research but I can not figure out how to use it.
I can not determine the relation between in_planes , out_planes, groups, and other parameters and how it affects the performance.
hope you will provide more clarification about the code and parameters' relationship to each other and to the input.
feels like K = out channels? is it right?
self.bias = nn.Parameter(torch.Tensor(K, out_planes))
should be changed to
self.bias = nn.Parameter(torch.zeros(K, out_planes))
你好,请问我将动态卷积加入resnet,预训练模型不匹配,应该如何加载预训练权重的问题呀
当stride 为2的时候,这个是不是不能用了
感谢你的复现并开源,请问你有试过你写的动态卷积的速度吗,速度如何?谢谢!
I don't observe any accuracy boost for dy_resnet18 compared to raw_resnet18 model on CIFAR10 and CIFAR100 datasets.
I used default hyper-parameters for the training and observed.
CIFAR10: dy 86.01%, raw 87.75%
CIFAR100: dy 54.59%, raw 56.52%.
All the experiments were bellow my expectations (>90% for CIFAR10, >70% for CIFAR100).
How to take advantage of dynamic convs?
大佬你好!
for idx_batch, (inputs, targets) in enumerate(trainloader):
这句for循环不知道为什么不执行
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.