Skip to content

Add parameter for Deformable Convolution offset group scalar value #3258

@joeyballentine

Description

@joeyballentine

🚀 Feature

Currently, the scalar used to calculate the number of deformable groups is hardcoded at 2. I would like for a parameter to be added that allows this number to be anything in order to have compatibility with repositories such as EDVR which use 3 for this value.

I have already added it myself and was going to submit a PR before reading that I should submit an issue first.

Motivation

I am currently trying to replace the MMdetection Deformable Convolution v2 with the Torchvision one for the EDVR repository. However, for its offsets, it calculates the out_nc size using this formula: self.deformable_groups * 3 * self.kernel_size[0] * self.kernel_size[1]. The usual formula, which the current Torchvision implementation expects, is self.deformable_groups * 2 * self.kernel_size[0] * self.kernel_size[1]. As you can see, they use a 3 in this calculation instead of a 2. I'm not entirely sure why, but it doesn't work unless it uses 3.

This causes an issue when using the Torchvision implementation, as in order to calculate the number of offset groups (called deformable groups in the formula above), it requires that scalar value to be 2.

EDVR Formula

Torchvision Formula

Pitch

I would like for a parameter to be added that would allow me to change this value, like so.

Alternatives

Another alternative could be to allow the number of offset groups to be passed in instead of being auto-calculated, as that is what the MMDetection version does.

Additional context

None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions