-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Deformable Convolution operation. #1586
Merged
Merged
Commits on Dec 1, 2019
-
Add Deformable Convolution operation.
This adds the deformable convolution operation, as described in Deformable Convolutional Networks (https://arxiv.org/abs/1703.06211). - The code is based on https://github.com/open-mmlab/mmdetection/blob/master/mmdet/ops/dcn/src/deform_conv_cuda.cpp ; the whole code was modified and refactored to remove redundancies and increase clarity, and to adapt it to torchvision. - The CPU part is a direct copy of the CUDA code; it might make sense to do follow-up adjustments in the CPU code to simplify it / optimize it, or to reuse functionality between CPU and CUDA.. - We also add tests (with a non-trivial set of parameters); they can be made more robust by randomizing the parameters and executing multiple times.
Configuration menu - View commit details
-
Copy full SHA for acb507b - Browse repository at this point
Copy the full SHA acb507bView commit details -
Update DeformConv to be more consistent w/ Conv2d
* rename some variables and arguments to match Conv2d; * add optional bias; * add weight, offset and bias as module parameters; * remove the n_parallel_imgs parameter; * Fix __repr__; * etc.. Initialization of weight and bias is the same as in Conv2d, and initialization of offsets to zero is the same as in the paper. This also includes some other small unrelated fixes/improvements.
Configuration menu - View commit details
-
Copy full SHA for f7c4984 - Browse repository at this point
Copy the full SHA f7c4984View commit details -
Configuration menu - View commit details
-
Copy full SHA for a05f3f5 - Browse repository at this point
Copy the full SHA a05f3f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 65749cc - Browse repository at this point
Copy the full SHA 65749ccView commit details -
Remove offset param from DeformConv2d module
- We pass the offset in the forward of DeformConv2d, instead of having an internal parameter. This adds some complexity to creating the module (e.g. now you have to worry about the output size, to create the offset), but it gives more flexibility. - We also use make_tuple for tuple creation, in an attempt to fix error w/ older compilers.
Configuration menu - View commit details
-
Copy full SHA for 4e2dadf - Browse repository at this point
Copy the full SHA 4e2dadfView commit details -
Old gcc versions were giving wrong results here, because they would resolve abs as int -> int, thus causing undesired truncation. Replacing abs by std::abs should allow for correct overloading of abs as float -> float.
Configuration menu - View commit details
-
Copy full SHA for a6092be - Browse repository at this point
Copy the full SHA a6092beView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d90f2c - Browse repository at this point
Copy the full SHA 3d90f2cView commit details -
Reorder weight and offset args in deform_conv2d
We place offset arg before the weight arg, to be more consistent with DeformConv2d.forward(input, offset)
Configuration menu - View commit details
-
Copy full SHA for 929eecc - Browse repository at this point
Copy the full SHA 929eeccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5aebed3 - Browse repository at this point
Copy the full SHA 5aebed3View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.