noise2void
¶
Self-supervised denoiser implementation, based on Noise2Void.
@author: Nicola VIGANÒ, CEA-MEM, Grenoble, France
Classes:
-
N2V
–Self-supervised denoising from single images.
N2V
¶
N2V(
model: int | str | NetworkParams | Module | Mapping,
data_scale_bias: DataScaleBias | None = None,
reg_val: float | LossRegularizer | None = None,
device: str = "cuda" if is_available() else "cpu",
batch_size: int | None = None,
augmentation: str | Sequence[str] | None = None,
save_epochs_dir: str | None = None,
verbose: bool = True,
)
Bases: Denoiser
Self-supervised denoising from single images.
Parameters:
-
model
(str | NetworkParams | Module | Mapping | None
) –Type of neural network to use or a specific network (or state) to use
-
data_scale_bias
(DataScaleBias | None
, default:None
) –Scale and bias of the input data, by default None
-
reg_val
(float | None
, default:None
) –Regularization value, by default 1e-5
-
device
(str
, default:'cuda' if is_available() else 'cpu'
) –Device to use, by default "cuda" if cuda is available, otherwise "cpu"
-
save_epochs_dir
(str | None
, default:None
) –Directory where to save network states at each epoch. If None disabled, by default None
-
verbose
(bool
, default:True
) –Whether to produce verbose output, by default True
Methods:
Attributes:
Source code in src/autoden/algorithms/denoiser.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
n_dims
property
¶
n_dims: int
Returns the expected signal dimensions.
If the model is an instance of SerializableModel
and has an init_params
attribute containing the key "n_dims"
, this property returns the value
associated with "n_dims"
. Otherwise, it defaults to 2.
Returns:
-
int
–The expected signal dimensions.
infer
¶
infer(inp: NDArray) -> NDArray
Inference, given an initial stack of images.
Parameters:
-
inp
(NDArray
) –The input stack of images
Returns:
-
NDArray
–The denoised stack of images
Source code in src/autoden/algorithms/denoiser.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
train
¶
train(
inp: NDArray,
epochs: int,
tst_inds: Sequence[int] | NDArray,
mask_shape: int | Sequence[int] | NDArray = 1,
ratio_blind_spot: float = 0.015,
algo: str = "adam",
lower_limit: float | NDArray | None = None,
) -> dict[str, NDArray]
Self-supervised training.
Parameters:
-
inp
(NDArray
) –The input images, which will also be targets
-
epochs
(int
) –Number of training epochs
-
tst_inds
(Sequence[int] | NDArray
) –The validation set indices
-
mask_shape
(int | Sequence[int] | NDArray
, default:1
) –Shape of the blind spot mask, by default 1.
-
algo
(str
, default:'adam'
) –Optimizer algorithm to use, by default "adam"
-
lower_limit
(float | NDArray | None
, default:None
) –The lower limit for the input data. If provided, the input data will be clipped to this limit. Default is None.
Source code in src/autoden/algorithms/noise2void.py
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|