14
14
15
15
* `` alignshift ``
16
16
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.
20
20
* `` deeplesion ``
21
21
the experiment code is base on [ mmdetection] ( https://github.com/open-mmlab/mmdetection )
22
22
,this directory consists of compounents used in mmdetection.
@@ -51,10 +51,10 @@ thickness = torch.rand(batch_size, 1)
51
51
out = m(x, thickness)
52
52
```
53
53
54
- ## Usage of AlignShiftConv/TSMConv operators
54
+ ## Usage of AlignShiftConv/TSMConv/A3DConv operators
55
55
56
56
``` python
57
- from alignshift .operators import AlignShiftConv, TSMConv
57
+ from nn .operators import AlignShiftConv, TSMConv, A3DConv
58
58
x = torch.rand(batch_size, 3 , D, H, W)
59
59
thickness = torch.rand(batch_size, 1 )
60
60
# AlignShiftConv to process 3D volumnes
@@ -63,12 +63,15 @@ out = conv(x, thickness)
63
63
# TSMConv to process 3D volumnes
64
64
conv = TSMConv(in_channels = 3 , out_channels = 10 , kernel_size = 3 , padding = 1 , n_fold = 8 , tsm = True )
65
65
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)
66
69
```
67
70
68
71
## Usage of native AlignShiftConv/TSMConv models
69
72
70
73
``` python
71
- from alignshift .models import DenseNetCustomTrunc3dAlign, DenseNetCustomTrunc3dTSM
74
+ from nn .models import DenseNetCustomTrunc3dAlign, DenseNetCustomTrunc3dTSM
72
75
net = DenseNetCustomTrunc3dAlign(num_classes = 3 )
73
76
B, C_in, D, H, W = (1 , 3 , 7 , 256 , 256 )
74
77
input_3d = torch.rand(B, C_in, D, H, W)
@@ -109,6 +112,11 @@ output_3d = net(input_3d, thickness)
109
112
``` bash
110
113
./deeplesion/train_dist.sh ./deeplesion/mconfig/densenet_tsm.py 2
111
114
```
115
+ * Train A3DConv models
116
+ ``` bash
117
+ ./deeplesion/train_dist.sh ./deeplesion/mconfig/densenet_a3d.py 2
118
+ ```
119
+
112
120
* Evaluation
113
121
``` bash
114
122
./deeplesion/eval.sh ${mmdetection script} ${checkpoint path}
0 commit comments