From 9451bfdcd76d958575ffd91cb1fc68073d2c0561 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:40:58 -0400 Subject: [PATCH 1/3] skip a variable from codespell --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f5041034..7ab68d8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,3 +12,6 @@ force_sort_within_sections = true reverse_relative = true sort_relative_in_force_sorted_sections = true known_first_party = ["nobrainer"] + +[tool.codespell] +ignore-words-list = "nd" From 809f9d3ec794be2f96fb4ecdafeeddfc0fbfae78 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:41:13 -0400 Subject: [PATCH 2/3] [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2 README.md", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a5ec38b..43a5581f 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ the Apache 2.0 license. It was started under the support of NIH R01 EB020470. ### Augmentation methods #### Spatial Transforms -[Center crop](), [Spacial Constant Padding](), [Random Crop](), [Resize](), [Random flip (left and right)]() +[Center crop](), [Spatial Constant Padding](), [Random Crop](), [Resize](), [Random flip (left and right)]() #### Intensity Transforms [Add gaussian noise](), [Min-Max intensity scaling](), [Costom intensity scaling](), [Intensity masking](), [Contrast adjustment]() From 62578a44dc475fd2f488691a3260dbe96e296127 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:41:16 -0400 Subject: [PATCH 3/3] [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- nobrainer/bayesian_utils.py | 2 +- nobrainer/models/bayesian_vnet.py | 18 +++++++++--------- nobrainer/models/bayesian_vnet_semi.py | 16 ++++++++-------- nobrainer/models/highresnet.py | 2 +- nobrainer/models/unet.py | 2 +- nobrainer/models/vnet.py | 10 +++++----- nobrainer/models/vox2vox.py | 10 +++++----- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/nobrainer/bayesian_utils.py b/nobrainer/bayesian_utils.py index d25ab443..62ca1d6a 100644 --- a/nobrainer/bayesian_utils.py +++ b/nobrainer/bayesian_utils.py @@ -64,7 +64,7 @@ def default_loc_scale_fn( safe to use when doing asynchronous distributed training. The default (`None`) is to use the `tf.get_variable` default. weightnorm: An optional (boolean) to activate weightnorm for the mean - kernal. + kernel. Returns ---------- diff --git a/nobrainer/models/bayesian_vnet.py b/nobrainer/models/bayesian_vnet.py index b8a99e28..a29750a2 100644 --- a/nobrainer/models/bayesian_vnet.py +++ b/nobrainer/models/bayesian_vnet.py @@ -28,9 +28,9 @@ def down_stage( kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use. @@ -83,11 +83,11 @@ def up_stage( kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) filters: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use @@ -153,17 +153,17 @@ def end_stage( kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) n_classes: int, for binary class use the value 1. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use Result ---------- - prediction probablities + prediction probabilities """ conv = tfp.layers.Convolution3DFlipout( n_classes, @@ -216,12 +216,12 @@ def bayesian_vnet( a value of 1. input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size(int): size of the kernal of conv layers + kernal_size(int): size of the kernel of conv layers activation(str): all tf.keras.activations are allowed kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) See Bayesian Utils for more options for kld, prior_fn and kernal_posterior_fn activation: str or optimizer object, the non-linearity to use. All diff --git a/nobrainer/models/bayesian_vnet_semi.py b/nobrainer/models/bayesian_vnet_semi.py index 4ade40bc..33256c9d 100644 --- a/nobrainer/models/bayesian_vnet_semi.py +++ b/nobrainer/models/bayesian_vnet_semi.py @@ -24,7 +24,7 @@ def down_stage(inputs, filters, kernel_size=3, activation="relu", padding="SAME" inputs: tf.layer for encoding stage. filters: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use @@ -61,11 +61,11 @@ def up_stage( kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) filters: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use @@ -131,17 +131,17 @@ def end_stage( kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) n_classes: int, for binary class use the value 1. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use Result ---------- - prediction probablities. + prediction probabilities. """ conv = tfp.layers.Convolution3DFlipout( n_classes, @@ -195,12 +195,12 @@ def bayesian_vnet_semi( a value of 1. input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size(int): size of the kernal of conv layers + kernal_size(int): size of the kernel of conv layers activation(str): all tf.keras.activations are allowed kld: a func to compute KL Divergence loss, default is set None. KLD can be set as (lambda q, p, ignore: kl_lib.kl_divergence(q, p)) prior_fn: a func to initialize priors distributions - kernel_posterior_fn:a func to initlaize kernal posteriors + kernel_posterior_fn:a func to initlaize kernel posteriors (loc, scale and weightnorms) See Bayesian Utils for more options for kld, prior_fn and kernal_posterior_fn activation: str or optimizer object, the non-linearity to use. All diff --git a/nobrainer/models/highresnet.py b/nobrainer/models/highresnet.py index e93f7d4c..1e7910e4 100644 --- a/nobrainer/models/highresnet.py +++ b/nobrainer/models/highresnet.py @@ -16,7 +16,7 @@ def highresnet( https://arxiv.org/abs/1707.01992 Args: n_classes(int): number of classes - input_shape(tuple):four ints representating the shape of 3D input + input_shape(tuple):four ints representing the shape of 3D input activation(str): all tf.keras.activations are allowed dropout_rate(int): [0,1]. """ diff --git a/nobrainer/models/unet.py b/nobrainer/models/unet.py index 22434c1a..fb23a639 100644 --- a/nobrainer/models/unet.py +++ b/nobrainer/models/unet.py @@ -19,7 +19,7 @@ def unet( https://arxiv.org/abs/1606.06650 Args: n_classes(int): number of classes - input_shape(tuple):four ints representating the shape of 3D input + input_shape(tuple):four ints representing the shape of 3D input activation(str): all tf.keras.activations are allowed batch_size(int): batch size. """ diff --git a/nobrainer/models/vnet.py b/nobrainer/models/vnet.py index 5dd73d1b..2b259441 100644 --- a/nobrainer/models/vnet.py +++ b/nobrainer/models/vnet.py @@ -23,7 +23,7 @@ def down_stage(inputs, filters, kernel_size=3, activation="relu", padding="SAME" inputs: tf.layer for encoding stage. filters: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use @@ -48,7 +48,7 @@ def up_stage(inputs, skip, filters, kernel_size=3, activation="relu", padding="S inputs: tf.layer for encoding stage. filters: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use @@ -80,14 +80,14 @@ def end_stage(inputs, n_classes=1, kernel_size=3, activation="relu", padding="SA ---------- inputs: tf.model layer. n_classes: int, for binary class use the value 1. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use Result ---------- - prediction probablities + prediction probabilities """ conv = Conv3D( filters=n_classes, @@ -123,7 +123,7 @@ def vnet( a value of 1. input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. activation: str or optimizer object, the non-linearity to use. All tf.activations are allowed to use diff --git a/nobrainer/models/vox2vox.py b/nobrainer/models/vox2vox.py index c981c148..5a5b07b3 100644 --- a/nobrainer/models/vox2vox.py +++ b/nobrainer/models/vox2vox.py @@ -26,11 +26,11 @@ def vox_gan( a value of 1. input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - g_kernal_size: int, size of the kernal for generator. Default kernal size + g_kernal_size: int, size of the kernel for generator. Default kernel size is set to be 4. g_filters: int, number of filters for generator. default is set 64. g_norm: str, to set batch or instance norm. - d_kernal_size: int, size of the kernal for discriminator. Default kernal size + d_kernal_size: int, size of the kernel for discriminator. Default kernel size is set to be 4. d_filters: int, number of filters for discriminator. default is set 64. d_norm: str, to set batch or instance norm. @@ -65,7 +65,7 @@ def Vox_generator(n_classes, input_shape, n_filters=64, kernel_size=4, norm="bat a value of 1. input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 4. n_filters: int, number of filters. default is set 64. norm: str, to set batch or instance norm. @@ -195,7 +195,7 @@ def Vox_discriminator(input_shape, n_filters=64, kernel_size=4, norm="batch"): input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. n_filters: int, number of filters. default is set 64. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 4. norm: str, to set batch or instance norm. @@ -275,7 +275,7 @@ def Vox_ensembler(n_classes, input_shape, kernel_size=3, **kwargs): a value of 1. input_shape: list or tuple of four ints, the shape of the input data. Omit the batch dimension, and include the number of channels. - kernal_size: int, size of the kernal of conv layers. Default kernal size + kernal_size: int, size of the kernel of conv layers. Default kernel size is set to be 3. Returns