config.py
High level definition of CNN architectures.
@author: Nicola VIGANĂ’, CEA-MEM, Grenoble, France
NetworkParams
¶
Bases: ABC
Abstract base class for storing network parameters.
Source code in src/autoden/models/config.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
__repr__()
¶
Produce the string representation of the object.
Returns:
Type | Description |
---|---|
str
|
The string representation. |
Source code in src/autoden/models/config.py
33 34 35 36 37 38 39 40 41 |
|
get_model(device='cuda' if is_cuda_available() else 'cpu')
abstractmethod
¶
Get the associated model with the selected parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device |
str
|
The device that the the model should run on, by default "cuda" if cuda is available, otherwise "cpu". |
'cuda' if is_available() else 'cpu'
|
Returns:
Type | Description |
---|---|
Module
|
The model. |
Source code in src/autoden/models/config.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
NetworkParamsDnCNN
¶
Bases: NetworkParams
Store DnCNN parameters.
Source code in src/autoden/models/config.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
__init__(n_channels_in=1, n_channels_out=1, n_layers=20, n_features=64)
¶
Initialize the DnCNN network parameters definition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_channels_in |
int
|
Number of input channels. Default is 1. |
1
|
n_channels_out |
int
|
Number of output channels. Default is 1. |
1
|
n_layers |
int
|
Number of layers. Default is 20. |
20
|
n_features |
int
|
Number of features. Default is 64. |
64
|
Source code in src/autoden/models/config.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
get_model(device='cuda' if is_cuda_available() else 'cpu')
¶
Get a DnCNN model with the selected parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device |
str
|
The device that the the model should run on, by default "cuda" if cuda is available, otherwise "cpu". |
'cuda' if is_available() else 'cpu'
|
Returns:
Type | Description |
---|---|
Module
|
The DnCNN model. |
Source code in src/autoden/models/config.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
NetworkParamsMSD
¶
Bases: NetworkParams
Store MS-D net parameters.
Source code in src/autoden/models/config.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
__init__(n_channels_in=1, n_channels_out=1, n_layers=80, n_features=1, dilations=np.arange(1, 10))
¶
Initialize the MS-D network parameters definition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_channels_in |
int
|
Number of input channels, by default 1. |
1
|
n_channels_out |
int
|
Number of output channels, by default 1. |
1
|
n_layers |
int
|
Number of layers in the network, by default 80. |
80
|
n_features |
int
|
Number of features, by default 1. |
1
|
dilations |
Sequence[int] | NDArray[integer]
|
Dilation values for the network, by default np.arange(1, 10). |
arange(1, 10)
|
Source code in src/autoden/models/config.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
get_model(device='cuda' if is_cuda_available() else 'cpu')
¶
Get a MS-D net model with the selected parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device |
str
|
The device that the the model should run on, by default "cuda" if cuda is available, otherwise "cpu". |
'cuda' if is_available() else 'cpu'
|
Returns:
Type | Description |
---|---|
Module
|
The model. |
Source code in src/autoden/models/config.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
NetworkParamsUNet
¶
Bases: NetworkParams
Store UNet parameters.
Source code in src/autoden/models/config.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
__init__(n_channels_in=1, n_channels_out=1, n_levels=DEFAULT_LEVELS, n_features=DEFAULT_FEATURES, n_channels_skip=None, bilinear=True, pad_mode='replicate')
¶
Initialize the UNet network parameters definition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_channels_in |
int
|
Number of input channels. Default is 1. |
1
|
n_channels_out |
int
|
Number of output channels. Default is 1. |
1
|
n_levels |
int
|
Number of levels in the UNet. Default is 3. |
DEFAULT_LEVELS
|
n_features |
int
|
Number of features in the UNet. Default is 32. |
DEFAULT_FEATURES
|
n_channels_skip |
int
|
Number of skip connections channels. Default is None. |
None
|
bilinear |
bool
|
Whether to use bilinear interpolation. Default is True. |
True
|
pad_mode |
str
|
Padding mode for convolutional layers. Default is "replicate". |
'replicate'
|
Source code in src/autoden/models/config.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_model(device='cuda' if is_cuda_available() else 'cpu')
¶
Get a U-net model with the selected parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device |
str
|
The device that the the model should run on, by default "cuda" if cuda is available, otherwise "cpu". |
'cuda' if is_available() else 'cpu'
|
Returns:
Type | Description |
---|---|
Module
|
The U-net model. |
Source code in src/autoden/models/config.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|