Skip to content
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 dints model #3344

Merged
merged 94 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
eb7b0df
add dints model
Nov 15, 2021
40de0d5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2021
76e9f52
rename scripts
Nov 16, 2021
f0b4138
rename scripts
Nov 16, 2021
5d0e596
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 16, 2021
f96b5c9
rename scripts
Nov 16, 2021
c5801fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 16, 2021
e1a7327
update scripts
Nov 16, 2021
936bc0a
Merge branch 'dev' of https://github.com/dongyang0122/MONAI into dev
Nov 16, 2021
a4974b3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 16, 2021
6136793
update scripts
Nov 16, 2021
f2e8020
Merge branch 'dev' of https://github.com/dongyang0122/MONAI into dev
Nov 16, 2021
abc9c37
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 16, 2021
0ae6d07
update scripts
Nov 16, 2021
41fc33b
Merge branch 'dev' of https://github.com/dongyang0122/MONAI into dev
Nov 16, 2021
6df8eca
update scripts
Nov 16, 2021
a273e5f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 16, 2021
7ee2b86
update scripts
Nov 16, 2021
0657ee6
Merge branch 'dev' of https://github.com/dongyang0122/MONAI into dev
Nov 16, 2021
d4d10c6
update scripts
Nov 16, 2021
a611738
update scripts
Nov 16, 2021
2dc349a
update scripts
Nov 16, 2021
b5816b8
update scripts
Nov 16, 2021
01fe2ad
update scripts
Nov 17, 2021
43575ff
update scripts
Nov 18, 2021
ff83ee6
update scripts
Nov 18, 2021
efe48a2
update scripts
Nov 18, 2021
9c77ac8
update scripts
Nov 18, 2021
5db9899
Move stem out of dints
heyufan1995 Nov 18, 2021
52d5143
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 18, 2021
47745a0
Add test dints cell, mixop and dints bug fix
heyufan1995 Nov 18, 2021
ff04568
Merge branch 'dev' of https://github.com/YufanHe/MONAI into dev
heyufan1995 Nov 18, 2021
1c0ec1a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 18, 2021
3e7779c
Change dints.stem
heyufan1995 Nov 18, 2021
f0b7051
Merge branch 'dev' of https://github.com/dongyang0122/MONAI into dev
heyufan1995 Nov 18, 2021
2169fe6
update scripts
Nov 19, 2021
c2d68cf
Merge branch 'dev' into dev
wyli Nov 19, 2021
086ed44
Merge branch 'dev' into dev
wyli Nov 19, 2021
2a5ac3a
adds doc; update test_factorized_reduce.py
wyli Nov 19, 2021
8441b5f
update docstring of mixops
wyli Nov 19, 2021
32b7f4b
ReLU -> Acti
wyli Nov 19, 2021
56520e9
update mixops cell
wyli Nov 19, 2021
cba1666
remove forward()
wyli Nov 19, 2021
b84c273
update scripts
Nov 19, 2021
bc7dbbb
Add dints comments
heyufan1995 Nov 19, 2021
36f0420
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 19, 2021
83476eb
Merge remote-tracking branch 'upstream/dev' into dev
wyli Nov 19, 2021
1e6198f
Add device to dints and fix unit test
heyufan1995 Nov 19, 2021
ecdd836
Merge branch 'dev' of github.com:dongyang0122/MONAI into dev
heyufan1995 Nov 19, 2021
6c13d30
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 19, 2021
d68534d
fixes typos
wyli Nov 20, 2021
7c8e2f3
fix docstrings
wyli Nov 20, 2021
404509c
fix docstrings
wyli Nov 20, 2021
4fc643a
fixes tests
wyli Nov 20, 2021
9e9411e
Merge branch 'dev' into dev
wyli Nov 20, 2021
16a987a
update mixop and cell
wyli Nov 20, 2021
0f5c648
update scripts
Nov 22, 2021
7797ab2
update scripts
Nov 22, 2021
e200e69
Add dints comments
heyufan1995 Nov 22, 2021
d33afa2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 22, 2021
0ed2182
Remove arch_codes in forward
heyufan1995 Nov 22, 2021
1af47ec
Merge branch 'dev' of github.com:dongyang0122/MONAI into dev
heyufan1995 Nov 22, 2021
dd7078f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 22, 2021
07de39e
Add Dints weight parameter function
heyufan1995 Nov 22, 2021
aa34417
Merge branch 'dev' of github.com:dongyang0122/MONAI into dev
heyufan1995 Nov 22, 2021
fb1d849
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 22, 2021
21c06d0
update scripts
Nov 22, 2021
d974fd4
Fix 2D Dints bugs, unit testing, and commenting
heyufan1995 Nov 23, 2021
acaca1a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 23, 2021
a4345fd
dints/dints_blocks updates
wyli Nov 23, 2021
0d3692d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 23, 2021
1e32a86
Merge branch 'dev' into dev
wyli Nov 23, 2021
c52fceb
update ram cost
wyli Nov 23, 2021
b5d2e76
update scripts
Nov 23, 2021
73dfb9d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 23, 2021
f49bd6d
update scripts
Nov 23, 2021
e569d12
Merge branch 'dev' of https://github.com/dongyang0122/MONAI into dev
Nov 23, 2021
72b0e8f
[DLMED] add TorchScript
Nic-Ma Nov 24, 2021
72f6673
Fix dints bug, add comments, torchscript support
heyufan1995 Nov 24, 2021
8b86206
Merge branch 'dev' of github.com:dongyang0122/MONAI into dev
heyufan1995 Nov 24, 2021
6052e28
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 24, 2021
831011b
update scripts
Nov 24, 2021
e71e528
update scripts
Nov 24, 2021
5052cb3
update scripts
Nov 24, 2021
5c44bbc
update docstrings; remoted `is_search`
wyli Nov 24, 2021
2225f10
torchscript dints inference
wyli Nov 24, 2021
3f34ada
Merge branch 'dev' into dev
wyli Nov 24, 2021
d345fa4
test fixes
wyli Nov 24, 2021
3ef6554
Merge branch 'dev' into dev
wyli Nov 24, 2021
60e4074
fixes gpu tests
wyli Nov 24, 2021
4ab976b
fixes dints cell tests
wyli Nov 24, 2021
2515a4c
skip for previous torch versions
wyli Nov 24, 2021
07e1444
inplace grads
wyli Nov 24, 2021
eaea96f
remove warning msg
wyli Nov 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/source/networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,26 @@ Nets
.. autoclass:: MILModel
:members:

`DiNTS`
~~~~~~~
.. autoclass:: DiNTS
:members:

`TopologyConstruction for DiNTS`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: TopologyConstruction
:members:

`TopologyInstance for DiNTS`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: TopologyInstance
:members:

`TopologySearch for DiNTS`
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: TopologySearch
:members:

Utilities
---------
.. automodule:: monai.networks.utils
Expand Down
17 changes: 12 additions & 5 deletions monai/networks/blocks/dints_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ def __init__(
self._in_channel = in_channel
self._out_channel = out_channel
self._spatial_dims = spatial_dims
if self._spatial_dims not in (2, 3):
raise ValueError("spatial_dims must be 2 or 3.")

conv_type = Conv[Conv.CONV, self._spatial_dims]

self.add_module("up", torch.nn.Upsample(scale_factor=2, mode="trilinear", align_corners=True))
mode = "trilinear" if self._spatial_dims == 3 else "bilinear"
self.add_module("up", torch.nn.Upsample(scale_factor=2, mode=mode, align_corners=True))
self.add_module("acti", get_act_layer(name=act_name))
self.add_module(
"conv",
Expand Down Expand Up @@ -94,6 +96,8 @@ def __init__(
self._in_channel = in_channel
self._out_channel = out_channel
self._spatial_dims = spatial_dims
if self._spatial_dims not in (2, 3):
raise ValueError("spatial_dims must be 2 or 3.")

conv_type = Conv[Conv.CONV, self._spatial_dims]

Expand All @@ -110,7 +114,7 @@ def __init__(
)
self.conv_2 = conv_type(
in_channels=self._in_channel,
out_channels=self._out_channel // 2,
out_channels=self._out_channel - self._out_channel // 2,
kernel_size=1,
stride=2,
padding=0,
Expand All @@ -125,7 +129,10 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
The length along each spatial dimension must be a multiple of 2.
"""
x = self.act(x)
out = torch.cat([self.conv_1(x), self.conv_2(x[:, :, 1:, 1:, 1:])], dim=1)
if self._spatial_dims == 3:
out = torch.cat([self.conv_1(x), self.conv_2(x[:, :, 1:, 1:, 1:])], dim=1)
else:
out = torch.cat([self.conv_1(x), self.conv_2(x[:, :, 1:, 1:])], dim=1)
out = self.norm(out)
return out

Expand Down Expand Up @@ -157,7 +164,7 @@ def __init__(
- 1: ``(k, 1, k)``, ``(1, k, 1)``,
- 2: ``(1, k, k)``. ``(k, 1, 1)``.

act_name:activation layer type and arguments.
act_name: activation layer type and arguments.
norm_name: feature normalization type and arguments.
"""
super().__init__()
Expand Down
3 changes: 1 addition & 2 deletions monai/networks/nets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
densenet201,
densenet264,
)

# from .dints import DiNTS
from .dints import DiNTS, TopologyConstruction, TopologyInstance, TopologySearch
from .dynunet import DynUNet, DynUnet, Dynunet
from .efficientnet import (
BlockArgs,
Expand Down
Loading