yangyanli/DO-Conv

关于DO-Conv的使用

yearing1017 opened this issue · 10 comments

  • 您好,我是一名研一的学生,读了您的论文,想问下有关DO-Conv的具体使用
  • 像使用import torch.nn.Conv2d 一样 导入 from do_conv_pytorch import DOConv2d,然后直接替换吗?
  • 在train的时候就直接使用,在inference阶段使用方法有变化吗?
  • Yes, it can be used directly by replacing Conv2d, and you can set the value of D_mul.

  • In the inference phase, you can use DOConv2d without changing, or fold D into W to reduce the computation to be exactly equivalent to that of a convolutional layer.

  • Yes, it can be used directly by replacing Conv2d, and you can set the value of D_mul.
  • In the inference phase, you can use DOConv2d without changing, or fold D into W to reduce the computation to be exactly equivalent to that of a convolutional layer.
  • 谢谢解答;请问自己设置D_mul的值根据什么去设置值?D_mul的真正意义是什么?是我读论文没有理解;
  • 如何 fold D into W?期待您的回复

最近在试着应用您的成果,但是运行之后会报错

def doconv_cnn(num_classes, input_shape=(3,197,197), lr_init, weight_decay):
inputs = Input(input_shape)
Conv_1=DOConv2D(16, kernel_size=(3, 3), strides=(1, 1),padding='same', groups=2, kernel_initializer='he_normal', kernel_regularizer=regularizers.l2(weight_decay), use_bias=True, name='block1_Conv1')(inputs)

上面是TensorFlow代码报错如下

AttributeError: 'DOConv2D' object has no attribute '_get_input_channel'

有空还请解答~

please update your tensorflow version to 2.2;
And We will provide the code of folding D into W in the inference phase latter.

please update your tensorflow version to 2.2;
And We will provide the code of folding D into W in the inference phase latter.
您好,请问tensorflow版本是1.x的怎么样可以使用这个呢,因为我的代码还涉及其他模块,无法升级到2.x版本

tf1.x needs to manually redefine the functions integrated in tf2.x, but the operation of the kernel is consistent with the tf2.x provided by us.

tf1.x needs to manually redefine the functions integrated in tf2.x, but the operation of the kernel is consistent with the tf2.x provided by us.

thanks a lot!

  • Yes, it can be used directly by replacing Conv2d, and you can set the value of D_mul.
  • In the inference phase, you can use DOConv2d without changing, or fold D into W to reduce the computation to be exactly equivalent to that of a convolutional layer.
  • 谢谢解答;请问自己设置D_mul的值根据什么去设置值?D_mul的真正意义是什么?是我读论文没有理解;
  • 如何 fold D into W?期待您的回复

请问 你知道了吗 为什么Dmul需要大于M×N?

n fact, the code implementation does not necessarily require D_mul to be greater than or equal to MxN, because when using Depthwise Separable Convolutional Layer, the feature composition of DOConv can be used for the deployment on edge devices, when D_mul is less than MxN (Dmul = 1 is probably the choice most widely used in practice).

However, as an over-parameterized method, D_mul ≥ MxN is necessary. Please refer to Proposition 3 in the Method section of our paper for details: Note that the condition Dmul ≥ M×N is necessary, otherwise the composite operator W' cannot
express the same family of linear transformations as W in a conventional convolutional layer.

  • 您好,我是一名研一的学生,读了您的论文,想问下有关DO-Conv的具体使用
  • 像使用import torch.nn.Conv2d 一样 导入 from do_conv_pytorch import DOConv2d,然后直接替换吗?
  • 在train的时候就直接使用,在inference阶段使用方法有变化吗?

你好,我在尝试将DO-Conv替换掉vgg中的conv模块,但是替换后,模型loss 无法下降,请问你在实践中有类似的问题吗