Skip to content

Instantly share code, notes, and snippets.

@pyaf
Last active February 28, 2018 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyaf/70a80ba379d55e647f04effcdc711695 to your computer and use it in GitHub Desktop.
Save pyaf/70a80ba379d55e647f04effcdc711695 to your computer and use it in GitHub Desktop.
Visualizing 3D UNet (without BN layers)
name: 'kidney_seg_no_BN'
force_backward: true
layer { top: 'data' top: 'label' top: 'weights' name: 'loaddata' type: 'HDF5Data' hdf5_data_param { source: 'trainfileList.txt' batch_size: 1 } include: { phase: TRAIN }}
layer { type: 'CreateDeformation'
top: 'def'
name: 'create_deformation'
create_deformation_param {
random_offset_range_from_ignore_label: 0
batch_size: 1 nz: 116 ny: 132 nx: 132 ncomponents: 3
random_elastic_grid_spacing { v: 32 v: 32 v: 32 }
random_elastic_deform_magnitude { v: 4 v: 4 v: 4 }
random_offset_from { v: -44 v: -44 v: -44 }
random_offset_to { v: -8 v: 156 v: 160 }
random_rotate_from { v: -30 v: -30 v: -30}
random_rotate_to { v: 30 v: 30 v: 30}
}
include: { phase: TRAIN } }
layer { bottom: 'data' bottom: 'def' top: 'defdata' name: 'def_data-defdata' type: 'ApplyDeformation' apply_deformation_param { interpolation: 'linear' extrapolation: 'mirror'} include: { phase: TRAIN }}
layer { bottom: 'data' bottom: 'def' top: 'd0a' name: 'def_data-defdata' type: 'ApplyDeformation' apply_deformation_param { interpolation: 'linear' extrapolation: 'mirror'} include: { phase: TEST }}
layer { bottom: 'defdata' top: 'd0a' name: 'val_aug-d0a' type: 'ValueAugmentation' value_augmentation_param { black_from:-0.05 black_to:0.05 slope_min:0.8 slope_max:1.2 white_from:0.95 white_to:1.05 } include: { phase: TRAIN }}
#################################################
layer { bottom: 'd0a' top: 'd0b' name: 'conv_d0a-b' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 32 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } bias_filler { type: 'constant' value:-0.1} } include { phase: TEST } }
layer { bottom: 'd0a' top: 'd0b' name: 'conv_d0a-b' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 32 pad: 0 kernel_size: 3 engine: CAFFE weight_filler { type: 'msra' } bias_filler { type: 'constant' value:-0.1} } include { phase: TRAIN} }
layer { bottom: 'd0b' top: 'd0b' name: 'relu_d0b' type: 'ReLU' }
layer { bottom: 'd0b' top: 'd0c' name: 'conv_d0b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 64 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd0c' top: 'd0c' name: 'relu_d0c' type: 'ReLU' }
layer { bottom: 'd0c' top: 'd1a' name: 'pool_d0c-1a' type: 'Pooling' pooling_param { pool: MAX kernel_size: 2 stride: 2 engine: CAFFE} }
#################################################
#################################################
layer { bottom: 'd1a' top: 'd1b' name: 'conv_d1a-b' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 64 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd1b' top: 'd1b' name: 'relu_d1b' type: 'ReLU' }
layer { bottom: 'd1b' top: 'd1c' name: 'conv_d1b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 128 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd1c' top: 'd1c' name: 'relu_d1c' type: 'ReLU' }
layer { bottom: 'd1c' top: 'd2a' name: 'pool_d1c-2a' type: 'Pooling' pooling_param { pool: MAX kernel_size: 2 stride: 2 engine: CAFFE} }
#################################################
#################################################
layer { bottom: 'd2a' top: 'd2b' name: 'conv_d2a-b' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 128 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd2b' top: 'd2b' name: 'relu_d2b' type: 'ReLU' }
layer { bottom: 'd2b' top: 'd2c' name: 'conv_d2b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 256 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd2c' top: 'd2c' name: 'relu_d2c' type: 'ReLU' }
layer { bottom: 'd2c' top: 'd3a' name: 'pool_d2c-3a' type: 'Pooling' pooling_param { pool: MAX kernel_size: 2 stride: 2 engine: CAFFE} }
#################################################
#################################################
layer { bottom: 'd3a' top: 'd3b' name: 'conv_d3a-b' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 256 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd3b' top: 'd3b' name: 'relu_d3b' type: 'ReLU' }
layer { bottom: 'd3b' top: 'd3c' name: 'conv_d3b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 512 pad: 0 kernel_size: 3 weight_filler { type: 'msra' } } }
layer { bottom: 'd3c' top: 'd3c' name: 'relu_d3c' type: 'ReLU' }
#################################################
#################################################
layer { bottom: 'd3c' top: 'u2a' name: 'upconv_d3c_u2a' type: 'Deconvolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 512 pad: 0 kernel_size: 2 stride: 2 weight_filler { type: 'msra' }} }
layer { bottom: 'u2a' top: 'u2a' name: 'relu_u2a' type: 'ReLU' }
layer { bottom: 'u2a' bottom: 'd2c' top: 'u2b' name: 'concat_d2c_u2a-b' type: 'Concat' }
layer { bottom: 'u2b' top: 'u2c' name: 'conv_u2b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 256 pad: 0 kernel_size: 3 weight_filler { type: 'msra' }} }
layer { bottom: 'u2c' top: 'u2c' name: 'relu_u2c' type: 'ReLU' }
layer { bottom: 'u2c' top: 'u2d' name: 'conv_u2c-d' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 256 pad: 0 kernel_size: 3 weight_filler { type: 'msra' }} }
layer { bottom: 'u2d' top: 'u2d' name: 'relu_u2d' type: 'ReLU' }
#################################################
#################################################
layer { bottom: 'u2d' top: 'u1a' name: 'upconv_u2d_u1a' type: 'Deconvolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 256 pad: 0 kernel_size: 2 stride: 2 weight_filler { type: 'msra' }} }
layer { bottom: 'u1a' top: 'u1a' name: 'relu_u1a' type: 'ReLU' }
layer { bottom: 'u1a' bottom: 'd1c' top: 'u1b' name: 'concat_d1c_u1a-b' type: 'Concat' }
layer { bottom: 'u1b' top: 'u1c' name: 'conv_u1b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 128 pad: 0 kernel_size: 3 weight_filler { type: 'msra' }} }
layer { bottom: 'u1c' top: 'u1c' name: 'relu_u1c' type: 'ReLU' }
layer { bottom: 'u1c' top: 'u1d' name: 'conv_u1c-d' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 128 pad: 0 kernel_size: 3 weight_filler { type: 'msra' }} }
layer { bottom: 'u1d' top: 'u1d' name: 'relu_u1d' type: 'ReLU' }
#################################################
#################################################
layer { bottom: 'u1d' top: 'u0a' name: 'upconv_u1d_u0a' type: 'Deconvolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 128 pad: 0 kernel_size: 2 stride: 2 weight_filler { type: 'msra' }} }
layer { bottom: 'u0a' top: 'u0a' name: 'relu_u0a' type: 'ReLU' }
layer { bottom: 'u0a' bottom: 'd0c' top: 'u0b' name: 'concat_d0c_u0a-b' type: 'Concat' }
layer { bottom: 'u0b' top: 'u0c' name: 'conv_u0b-c' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 64 pad: 0 kernel_size: 3 weight_filler { type: 'msra' }} }
layer { bottom: 'u0c' top: 'u0c' name: 'relu_u0c' type: 'ReLU' }
layer { bottom: 'u0c' top: 'u0d' name: 'conv_u0c-d' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 64 pad: 0 kernel_size: 3 weight_filler {type: 'msra' }} }
layer { bottom: 'u0d' top: 'u0d' name: 'relu_u0d' type: 'ReLU' }
#################################################
layer { bottom: 'u0d' top: 'score' name: 'conv_u0d-score' type: 'Convolution' param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 3 pad: 0 kernel_size: 1 weight_filler { type: 'msra' }} }
layer { bottom: 'label' bottom: 'def' top: 'labelcrop' name: 'def_label-crop' type: 'ApplyDeformation' apply_deformation_param { interpolation: 'nearest' extrapolation: 'mirror' output_shape_from: 'u0d'} include: { phase: TRAIN }}
layer { bottom: 'weights' bottom: 'def' top: 'weightscrop' name: 'def_weights-crop' type: 'ApplyDeformation' apply_deformation_param { interpolation: 'nearest' extrapolation: 'mirror' output_shape_from: 'u0d'} include: { phase: TRAIN }}
layer { bottom: 'score' bottom: 'labelcrop' bottom: 'weightscrop' top: 'loss' name: 'loss' type: 'SoftmaxWithLoss' loss_param { ignore_label: 3 } include: { phase: TRAIN }}
@pyaf
Copy link
Author

pyaf commented Feb 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment