NiftyNet
NiftyNet copied to clipboard
inference 3D segmentation with 3DUnet model
Hello: I use the 3DUnet model to do the Brain Tumor segmentation task ,and the training set is the MICCAI BraTS 2018 data. When I use the 'python3 net_run.py inference -c ./config/my_unet_config.ini -a niftynet.application.segmentation_application.SegmentationApplication' to inference the trained model with the config file which includes [TRAINING] , [INFERENCE],[NETWORK] and other config informations, it happens some errors:
INFO:niftynet: Import [SegmentationApplication] from /home/cjh/PycharmProjects/NiftyNet/niftynet/application/segmentation_application.py.
INFO:niftynet: starting segmentation application
INFO:niftynet: `csv_file = ` not found, writing to "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/flair.csv" instead.
INFO:niftynet: Overwriting existing: "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/flair.csv".
INFO:niftynet: [flair] search file folders, writing csv file /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/flair.csv
INFO:niftynet: `csv_file = ` not found, writing to "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t1ce.csv" instead.
INFO:niftynet: Overwriting existing: "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t1ce.csv".
INFO:niftynet: [t1ce] search file folders, writing csv file /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t1ce.csv
INFO:niftynet: `csv_file = ` not found, writing to "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/label.csv" instead.
INFO:niftynet: Overwriting existing: "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/label.csv".
INFO:niftynet: [label] search file folders, writing csv file /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/label.csv
INFO:niftynet: `csv_file = ` not found, writing to "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t2.csv" instead.
INFO:niftynet: Overwriting existing: "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t2.csv".
INFO:niftynet: [t2] search file folders, writing csv file /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t2.csv
INFO:niftynet: `csv_file = ` not found, writing to "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t1.csv" instead.
INFO:niftynet: Overwriting existing: "/home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t1.csv".
INFO:niftynet: [t1] search file folders, writing csv file /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/t1.csv
INFO:niftynet:
Number of subjects 75, input section names: ['subject_id', 'flair', 't1ce', 'label', 't2', 't1']
-- using all subjects (without data partitioning).
CRITICAL:niftynet: No partition ids available.
WARNING:niftynet: phase `parameter` inference ignored
INFO:niftynet: Image reader: loading 75 subjects from sections ('t1', 't2', 't1ce', 'flair') as input [image]
INFO:niftynet: normalisation histogram reference models ready for image:('t1', 't2', 't1ce', 'flair')
INFO:niftynet: label mapping ready for label:('label',), 4 classes
2018-10-30 14:44:59.110336: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
INFO:niftynet: reading size of preprocessed images
INFO:niftynet: initialised resize sampler {'image': (1, 96, 96, 96, 1, 4), 'image_location': (1, 7)}
WARNING:niftynet: From /home/cjh/PycharmProjects/NiftyNet/niftynet/engine/application_initializer.py:106: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with distribution=normal is deprecated and will be removed in a future version.
Instructions for updating:
`normal` is a deprecated alias for `truncated_normal`
using UNet
INFO:niftynet: Initialising Dataset from 75 subjects...
[Layer] UNet/L1 [Trainable] 32_bn_prelu/conv_/w, 32_bn_prelu/bn_/beta, 32_bn_prelu/bn_/gamma, 32_bn_prelu/prelu_acti_/alpha, 64_bn_prelu/conv_/w, 64_bn_prelu/bn_/beta, 64_bn_prelu/bn_/gamma, 64_bn_prelu/prelu_acti_/alpha (59040)
[Layer] UNet/L2 [Trainable] 64_bn_prelu/conv_/w, 64_bn_prelu/bn_/beta, 64_bn_prelu/bn_/gamma, 64_bn_prelu/prelu_acti_/alpha, 128_bn_prelu/conv_/w, 128_bn_prelu/bn_/beta, 128_bn_prelu/bn_/gamma, 128_bn_prelu/prelu_acti_/alpha (332352)
[Layer] UNet/L3 [Trainable] 128_bn_prelu/conv_/w, 128_bn_prelu/bn_/beta, 128_bn_prelu/bn_/gamma, 128_bn_prelu/prelu_acti_/alpha, 256_bn_prelu/conv_/w, 256_bn_prelu/bn_/beta, 256_bn_prelu/bn_/gamma, 256_bn_prelu/prelu_acti_/alpha (1328256)
[Layer] UNet/L4 [Trainable] 256_bn_prelu/conv_/w, 256_bn_prelu/bn_/beta, 256_bn_prelu/bn_/gamma, 256_bn_prelu/prelu_acti_/alpha, 512_bn_prelu/conv_/w, 512_bn_prelu/bn_/beta, 512_bn_prelu/bn_/gamma, 512_bn_prelu/prelu_acti_/alpha, up_2x2_bn/deconv_/w, up_2x2_bn/bn_/beta, up_2x2_bn/bn_/gamma (7408896)
[Layer] UNet/R3 [Trainable] 256_bn_prelu/conv_/w, 256_bn_prelu/bn_/beta, 256_bn_prelu/bn_/gamma, 256_bn_prelu/prelu_acti_/alpha, 256_bn_prelu_1/conv_/w, 256_bn_prelu_1/bn_/beta, 256_bn_prelu_1/bn_/gamma, 256_bn_prelu_1/prelu_acti_/alpha, up_2x2_bn/deconv_/w, up_2x2_bn/bn_/beta, up_2x2_bn/bn_/gamma (7604224)
[Layer] UNet/R2 [Trainable] 128_bn_prelu/conv_/w, 128_bn_prelu/bn_/beta, 128_bn_prelu/bn_/gamma, 128_bn_prelu/prelu_acti_/alpha, 128_bn_prelu_1/conv_/w, 128_bn_prelu_1/bn_/beta, 128_bn_prelu_1/bn_/gamma, 128_bn_prelu_1/prelu_acti_/alpha, up_2x2_bn/deconv_/w, up_2x2_bn/bn_/beta, up_2x2_bn/bn_/gamma (1901568)
[Layer] UNet/R1_FC [Trainable] 64_bn_prelu/conv_/w, 64_bn_prelu/bn_/beta, 64_bn_prelu/bn_/gamma, 64_bn_prelu/prelu_acti_/alpha, 64_bn_prelu_1/conv_/w, 64_bn_prelu_1/bn_/beta, 64_bn_prelu_1/bn_/gamma, 64_bn_prelu_1/prelu_acti_/alpha, 5_bn_prelu/conv_/w, 5_bn_prelu/bn_/beta, 5_bn_prelu/bn_/gamma, 5_bn_prelu/prelu_acti_/alpha (443087)
2018-10-30 14:45:02.157188: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
INFO:niftynet: starting from iter 700
INFO:niftynet: Accessing /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/models/model.ckpt-700
INFO:niftynet: Restoring parameters from /home/cjh/PycharmProjects/NiftyNet/models/model_unet_brats2018/models/model.ckpt-700
CRITICAL:niftynet: network output window can be cropped by specifying the border parameter in config file, but here the output window (8, 8, 8) is already smaller than the input window size minus padding: [96 96 96], not supported by this aggregator
INFO:niftynet: cleaning up...
INFO:niftynet: stopping sampling threads
Traceback (most recent call last):
File "net_run.py", line 8, in <module>
sys.exit(main())
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/__init__.py", line 142, in main
app_driver.run(app_driver.app)
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/engine/application_driver.py", line 202, in run
loop_status=loop_status)
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/engine/application_driver.py", line 328, in loop
ApplicationDriver.loop_step(application, iter_msg)
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/engine/application_driver.py", line 363, in loop_step
ITER_FINISHED.send(application, iter_msg=iteration_message)
File "/usr/lib/python3/dist-packages/blinker/base.py", line 267, in send
for receiver in self.receivers_for(sender)]
File "/usr/lib/python3/dist-packages/blinker/base.py", line 267, in <listcomp>
for receiver in self.receivers_for(sender)]
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/engine/handler_network_output.py", line 50, in interpret_output
_iter_msg.current_iter_output[NETWORK_OUTPUT])
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/application/segmentation_application.py", line 384, in interpret_output
batch_output['window'], batch_output['location'])
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/engine/windows_aggregator_resize.py", line 47, in decode_batch
window, location = self.crop_batch(window, location, self.window_border)
File "/home/cjh/PycharmProjects/NiftyNet/niftynet/engine/windows_aggregator_base.py", line 118, in crop_batch
raise ValueError
ValueError
I can't deal with the above problem and can't understand where my config is wrong? my config file and the generated files when inference are as follows, and look forward to your reply. config_and_log.zip
This error is about the size of the spatial window versus coordinate window size minus the border. You're specifying border = 0
in your config file, try with larger values. The error will get logged in your log file so check that as well to see what the sizes are that are being specific complained about.