VBoussot commited on
Commit
9d47104
·
1 Parent(s): 4c03b58

Update body model

Browse files
Files changed (3) hide show
  1. body/Body.pt +2 -2
  2. body/Model.py +19 -23
  3. body/Prediction.yml +3 -3
body/Body.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0a4652d0c8139e2d3ce86247bf3e050671de369fe982a701bf6bf76304131c7a
3
- size 423981609
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be2218b50786e326e38c65c5cf2e2745f354911acbb4ae86bd1ca702db316d1c
3
+ size 47484709
body/Model.py CHANGED
@@ -1,10 +1,6 @@
1
- import torch
2
- from torch import nn
3
-
4
  from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet
5
  from konfai.network import network
6
 
7
-
8
  def _replace_unpicklable_identities(module: nn.Module) -> None:
9
  """Replace library lambdas such as ``lambda x: x`` with ``nn.Identity``."""
10
  for child in module.modules():
@@ -13,7 +9,7 @@ def _replace_unpicklable_identities(module: nn.Module) -> None:
13
  if hasattr(child, "nonlin2") and callable(child.nonlin2) and not isinstance(child.nonlin2, nn.Module):
14
  child.nonlin2 = nn.Identity()
15
 
16
- class ResEncMCT(network.Network):
17
  def __init__(
18
  self,
19
  optimizer: network.OptimizerLoader = network.OptimizerLoader(),
@@ -32,22 +28,22 @@ class ResEncMCT(network.Network):
32
  dim=2,
33
  )
34
  self.add_module("DecoderOutputs", ResidualEncoderUNet(
35
- input_channels=in_channels,
36
- n_stages=7,
37
- features_per_stage=(32, 64, 128, 256, 512, 512, 512),
38
- conv_op=nn.Conv2d,
39
- kernel_sizes=3,
40
- strides=(1, 2, 2, 2, 2, 2, 2),
41
- n_blocks_per_stage=(1, 3, 4, 6, 6, 6, 6),
42
- num_classes=nb_class,
43
- n_conv_per_stage_decoder=(1, 1, 1, 1, 1, 1),
44
- conv_bias=True,
45
- norm_op=nn.InstanceNorm2d,
46
- norm_op_kwargs={"eps": 1e-5, "affine": True},
47
- dropout_op=None,
48
- dropout_op_kwargs=None,
49
- nonlin=nn.LeakyReLU,
50
- nonlin_kwargs={"inplace": True},
51
- deep_supervision=False,
52
- ))
53
  _replace_unpicklable_identities(self.DecoderOutputs)
 
 
 
 
1
  from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet
2
  from konfai.network import network
3
 
 
4
  def _replace_unpicklable_identities(module: nn.Module) -> None:
5
  """Replace library lambdas such as ``lambda x: x`` with ``nn.Identity``."""
6
  for child in module.modules():
 
9
  if hasattr(child, "nonlin2") and callable(child.nonlin2) and not isinstance(child.nonlin2, nn.Module):
10
  child.nonlin2 = nn.Identity()
11
 
12
+ class ResEnc(network.Network):
13
  def __init__(
14
  self,
15
  optimizer: network.OptimizerLoader = network.OptimizerLoader(),
 
28
  dim=2,
29
  )
30
  self.add_module("DecoderOutputs", ResidualEncoderUNet(
31
+ input_channels=in_channels,
32
+ n_stages=6,
33
+ features_per_stage=(24, 48, 96, 192, 256, 256),
34
+ conv_op=nn.Conv2d,
35
+ kernel_sizes=3,
36
+ strides=(1, 2, 2, 2, 2, 2),
37
+ n_blocks_per_stage=(1, 2, 2, 3, 3, 3),
38
+ num_classes=nb_class,
39
+ n_conv_per_stage_decoder=(1, 1, 1, 1, 1),
40
+ conv_bias=True,
41
+ norm_op=nn.InstanceNorm2d,
42
+ norm_op_kwargs={"eps": 1e-5, "affine": True},
43
+ dropout_op=None,
44
+ dropout_op_kwargs=None,
45
+ nonlin=nn.LeakyReLU,
46
+ nonlin_kwargs={"inplace": True},
47
+ deep_supervision=False,
48
+ ))
49
  _replace_unpicklable_identities(self.DecoderOutputs)
body/Prediction.yml CHANGED
@@ -1,7 +1,7 @@
1
  Predictor:
2
  Model:
3
- classpath: Model:ResEncMCT
4
- ResEncMCT:
5
  in_channels: 5
6
  nb_class: 12
7
  outputs_criterions: None
@@ -18,7 +18,7 @@ Predictor:
18
  spacing:
19
  - 3
20
  - 3
21
- - 0
22
  inverse: true
23
  Standardize:
24
  lazy: false
 
1
  Predictor:
2
  Model:
3
+ classpath: Model:ResEnc
4
+ ResEnc:
5
  in_channels: 5
6
  nb_class: 12
7
  outputs_criterions: None
 
18
  spacing:
19
  - 3
20
  - 3
21
+ - 3
22
  inverse: true
23
  Standardize:
24
  lazy: false