You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The loss is not nan/inf when using the following config
dataset:
dir:
train: "/raid/candi/Yunguan/DeepReg/neuroimaging/preprocessed"# requiredvalid:
test:
format: "nifti"type: "unpaired"# paired / unpaired / groupedlabeled: false # whether to use the labels if available, "true" or "false"image_shape: [196, 112, 96]train:
# define neural network structuremethod: "ddf"# options include "ddf", "dvf", "conditional"backbone:
name: "unet"# options include "local", "unet" and "global"num_channel_initial: 16# number of initial channel in local net, controls the size of the networkdepth: 4# concat_skip: true# encode_num_channels: [16, 32, 32, 32, 32]# decode_num_channels: [32, 32, 32, 32, 32]# define the loss function for trainingloss:
image:
name: "lncc"# other options include "lncc", "ssd" and "gmi", for local normalised cross correlation,weight: 1.0label:
weight: 0.0name: "dice"# options include "dice", "cross-entropy", "mean-squared", "generalised_dice" and "jaccard"regularization:
weight: 1.0# weight of regularization lossname: "gradient"# options include "bending", "gradient"# define the optimizeroptimizer:
name: "adam"# options include "adam", "sgd" and "rms"adam:
learning_rate: 1.0e-4# define the hyper-parameters for preprocessingpreprocess:
data_augmentation:
name: "affine"batch_size: 4shuffle_buffer_num_batch: 1# shuffle_buffer_size = batch_size * shuffle_buffer_num_batch# other training hyper-parametersepochs: 2000# number of training epochssave_period: 50# the model will be saved every `save_period` epochs.
ok just found out that I added activation at the final layer before outputting DDF. :( it might be the cause, as leaky relu or relu both push DDF towards positive values, which may push DDF to be too large
Activity
mathpluscode commentedon Mar 7, 2021
The loss is not nan/inf when using the following config
Issue #690: add debug prints
mathpluscode commentedon Mar 15, 2021
Issue #690: add debug prints
mathpluscode commentedon Mar 21, 2021
It seems that the problem may come from the deformation regularization.
mathpluscode commentedon Mar 22, 2021
changing deform loss to https://github.com/voxelmorph/voxelmorph/blob/legacy/src/losses.py#L88 does not solve the problem
Need to double check the resampler and related functions
eventually we got inf first in lncc, but the nan/inf checks in LNCC was not triggered?
mathpluscode commentedon Mar 22, 2021
changed
zero_boundaryinresample, default toFalse, still got nan/infmaybed linked to leaky relu
mathpluscode commentedon Mar 23, 2021
change from leaky relu to relu does not solve the problem neither
mathpluscode commentedon Mar 23, 2021
ok just found out that I added activation at the final layer before outputting DDF. :( it might be the cause, as leaky relu or relu both push DDF towards positive values, which may push DDF to be too large
mathpluscode commentedon Mar 23, 2021
by fixing activation, we still got nan/inf
mathpluscode commentedon Mar 23, 2021
change to SSD loss for image, then the nan/inf is gone.
So the problem must come from the LNCC loss
Issue #690: modify lncc implementation
42 remaining items
Issue #690: update changelog and fix test
Issue #690: modify LNCC implementation to be more stable
mathpluscode commentedon Mar 27, 2021
Actually, as our implementation was originally from VM, and I just found that multiple users have found issues with NCC there
calc_cross_myis the closest to our fix)Issue #690: add reference for LNCC
mathpluscode commentedon Mar 31, 2021
reopen this issue as the previous fix was buggy
Issue #690: fix negative variance issue and add accurate test
Issue #690: fix pytest
Issue #690: make smooth value configurable and add extensive tests fo…
Issue #690: make smooth value configurable and add extensive tests fo…
Issue #690: make smooth value configurable and add extensive tests fo…
Issue #690: added doc regarding reduction strategy in loss
Merge pull request #733 from DeepRegNet/690-nan-inf-loss