https://github.com/developer0hye/candle-dcnv2
Deformable Convolution v2 (DCNv2) implementation for Hugging Face Candle
https://github.com/developer0hye/candle-dcnv2
Last synced: about 2 months ago
JSON representation
Deformable Convolution v2 (DCNv2) implementation for Hugging Face Candle
- Host: GitHub
- URL: https://github.com/developer0hye/candle-dcnv2
- Owner: developer0hye
- License: apache-2.0
- Created: 2026-03-15T09:43:29.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-15T11:17:03.000Z (4 months ago)
- Last Synced: 2026-03-15T23:10:39.912Z (4 months ago)
- Language: Rust
- Size: 15.8 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# candle-dcnv2
Deformable Convolution v2 (DCNv2) implementation for [Hugging Face Candle](https://github.com/huggingface/candle).
Implemented with high-level tensor operations — works on all backends (CPU, CUDA, Metal, WASM).
## Usage
```rust
use candle_dcnv2::deform_conv2d;
let output = deform_conv2d(
&input, // [B, C_in, H, W]
&offset, // [B, 2*kH*kW, out_H, out_W]
&weight, // [C_out, C_in, kH, kW]
Some(&bias), // [C_out]
Some(&mask), // [B, kH*kW, out_H, out_W]
(1, 1), // stride
(1, 1), // padding
(1, 1), // dilation
)?;
```
Or use the `DeformConv2d` module which loads weights via `VarBuilder`:
```rust
use candle_dcnv2::DeformConv2d;
let module = DeformConv2d::new(
in_channels, out_channels, (3, 3),
(1, 1), (1, 1), (1, 1), 1, true, vb,
)?;
let output = module.forward(&input, &offset, Some(&mask))?;
```
## Current limitations
- `dilation`: only `(1, 1)`
- `groups`: only `1`
- `offset_groups`: only `1`
- Forward pass only (no backward/training)
These will be extended in future versions.
## License
Apache-2.0