Skip to content

Commit 175b8a6

Browse files
authored
Update README.md
1 parent 996600e commit 175b8a6

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ For now, the code has only been implemented on [PyTorch](https://pytorch.org/),
2626
The method is described in the article [Dilated Convolution with Learnable Spacings](https://arxiv.org/abs/2112.03740v4). The Gaussian and triangle versions are described in the arXiv preprint [Dilated Convolution with Learnable Spacings: beyond bilinear interpolation](https://arxiv.org/abs/2306.00817v2).
2727
## What's new
2828

29+
**Dec 22, 2023**:
30+
- Dcls2d could already be used with flat dilated kernel sizes ((7,1) for example). However, this introduces unnecessary position and sigma learning along the flat dimension. We introduce Dcls2dK1d where a 1D flat kernel is constructed but a 2D convolution is applied. Please see the [Usage](#usage) section for a use case.
31+
2932
**Oct 19, 2023**:
3033
- A new family of DCLS methods is implemented: Dcls**N**_**M**d (**N** for the convolution dimension and **M** for the number of N learnable position dimensions). Currently, only the Dcls3_1d method is available. Please see the [Usage](#usage) section for a use case.
3134

@@ -109,7 +112,7 @@ git clone https://github.com/K-H-Ismail/Dilated-Convolution-with-Learnable-Spaci
109112
cd Dilated-Convolution-with-Learnable-Spacings-PyTorch
110113
python3 -m pip install --upgrade pip
111114
python3 -m build
112-
python3 -m pip install dist/dcls-0.0.6-py3-none-any.whl
115+
python3 -m pip install dist/dcls-0.0.7-py3-none-any.whl
113116

114117
```
115118

@@ -201,6 +204,31 @@ loss = output.sum()
201204
loss.backward()
202205
print(output.size(), m.weight.grad.size(), m.P.grad.size())
203206
```
207+
##
208+
209+
As for flat kernels, Dcls**N**dK**M**d could be used. For now, only the Dcls2dK1d method is available and could be used as follows:
210+
211+
```python
212+
import torch
213+
from DCLS.construct.modules import Dcls2dK1d
214+
215+
m = Dcls2dK1d(
216+
out_channels=32,
217+
in_channels=32,
218+
kernel_count=3,
219+
dilated_kernel_size=11,
220+
flat_dim=0 # the flat dimensions dimension, here it is equivalent to torch.nn.Conv2d with kernel_size=(1,11)
221+
groups=1,
222+
padding=(0, 11 // 2),
223+
224+
)
225+
# The last dimension of the input is always where positions are learned
226+
input = torch.randn(8, 32, 56, 56)
227+
output = m(input)
228+
loss = output.sum()
229+
loss.backward()
230+
print(output.size(), m.weight.grad.size(), m.P.grad.size())
231+
```
204232

205233

206234
## Device Supports

0 commit comments

Comments
 (0)