Skip to content

Commit 94109fc

Browse files
author
yi.he
committed
update readme
1 parent 22c871f commit 94109fc

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
* ``alignshift``
1616
the core implementation of AlignShift convolution and TSM convolution, including the operators, models, and 2D-to-3D/AlignShift/TSM model converters.
17-
* ``operators``: include AlignShiftConv, TSMConv.
18-
* ``converters.py``: include converters which convert 2D models to 3dConv/AlignShiftConv/TSMConv counterparts.
19-
* ``models``: Native AlignShift/TSM models.
17+
* ``operators``: include AlignShiftConv, TSMConv, A3DConv.
18+
* ``converters.py``: include converters which convert 2D models to 3DConv/AlignShiftConv/TSMConv/A3DConv counterparts.
19+
* ``models``: Native AlignShift/TSM/A3DConv models.
2020
* ``deeplesion``
2121
the experiment code is base on [mmdetection](https://github.com/open-mmlab/mmdetection)
2222
,this directory consists of compounents used in mmdetection.
@@ -51,10 +51,10 @@ thickness = torch.rand(batch_size, 1)
5151
out = m(x, thickness)
5252
```
5353

54-
## Usage of AlignShiftConv/TSMConv operators
54+
## Usage of AlignShiftConv/TSMConv/A3DConv operators
5555

5656
```python
57-
from nn.operators import AlignShiftConv, TSMConv
57+
from nn.operators import AlignShiftConv, TSMConv, A3DConv
5858
x = torch.rand(batch_size, 3, D, H, W)
5959
thickness = torch.rand(batch_size, 1)
6060
# AlignShiftConv to process 3D volumnes
@@ -63,6 +63,9 @@ out = conv(x, thickness)
6363
# TSMConv to process 3D volumnes
6464
conv = TSMConv(in_channels=3, out_channels=10, kernel_size=3, padding=1, n_fold=8, tsm=True)
6565
out = conv(x)
66+
# A3DConv to process 3D volumnes
67+
conv = A3DConv(in_channels=3, out_channels=10, kernel_size=3, padding=1, dimension=3)
68+
out = conv(x)
6669
```
6770

6871
## Usage of native AlignShiftConv/TSMConv models
@@ -109,6 +112,11 @@ output_3d = net(input_3d, thickness)
109112
```bash
110113
./deeplesion/train_dist.sh ./deeplesion/mconfig/densenet_tsm.py 2
111114
```
115+
* Train A3DConv models
116+
```bash
117+
./deeplesion/train_dist.sh ./deeplesion/mconfig/densenet_a3d.py 2
118+
```
119+
112120
* Evaluation
113121
```bash
114122
./deeplesion/eval.sh ${mmdetection script} ${checkpoint path}

nn/operators/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .alignshiftconv import AlignShiftConv
22
from .tsmconv import TSMConv
3-
from .a3d import A3DConv
3+
from .a3dconv import A3DConv

nn/operators/a3d.py renamed to nn/operators/a3dconv.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@
1010
class A3DConv(_ConvNd):
1111
'''
1212
Args:
13-
n_fold (int): Divisor of channels to shift.
14-
alignshift(bool): if apply alignshift operation before conv
13+
dimension (int): number of dimensions to shift.
1514
inplace (bool): if Enable inplace operation.
16-
ref_thickness (float): Reference z axis spacing Default: 0.2mm.
17-
shift_padding_zero(bool): f padding zeros to side fold before shift channels
15+
enable_shift(bool): if enable shift
1816
'''
1917
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
2018
padding=0, dilation=1, groups=1,
2119
bias=True, padding_mode='zeros',
22-
dimension=3,
23-
enable_shift=True, inplace=False,
24-
shift_padding_zero=False):
20+
dimension=3, enable_shift=True, inplace=False):
2521

2622
kernel_size = _pair_same(kernel_size)
2723
stride = as_triple(stride)
@@ -33,8 +29,6 @@ def __init__(self, in_channels, out_channels, kernel_size, stride=1,
3329

3430
self.enable_shift = enable_shift
3531
self.inplace = inplace
36-
self.shift_padding_zero = shift_padding_zero
37-
# if self.enable_shift:
3832
self._init_adaptive_weights(in_channels, dimension)
3933

4034
def _init_adaptive_weights(self, in_channels, dimension):

0 commit comments

Comments
 (0)