NifTK / NiftyNet

[unmaintained] An open-source convolutional neural networks platform for research in medical image analysis and image-guided therapy
http://niftynet.io
Apache License 2.0
1.36k stars 404 forks source link

How to train a model with one input and multi-output? #487

Open amir-sanaat opened 3 years ago

amir-sanaat commented 3 years ago

Dear Niftynet User, I plan to train a model with one input and three (or more) outputs. Just consider a 2D image as input and three 2D images as output. when I tried it with Niftynet I faced with the following error:

INFO:niftynet: initialised uniform sampler {'image': (1, 96, 112, 1, 1, 2), 'image_location': (1, 7), 'output': (1, 96, 112, 1, 1, 2), 'output_location': (1, 7)} WARNING:niftynet: sampler queue_length should be larger than batch_size, defaulting to batch_size * 5.0 (25). INFO:niftynet: initialised uniform sampler {'image': (1, 96, 112, 1, 1, 2), 'image_location': (1, 7), 'output': (1, 96, 112, 1, 1, 2), 'output_location': (1, 7)}

"ValueError: Cannot reshape a tensor with 10752 elements to shape [21504] (21504 elements) for 'worker_0/loss_function/map/while/Reshape' (op: 'Reshape') with input shapes: [96,112,1], [1] and with input tensors computed as partial shapes: input[1] = [21504]."

Does anyone have any idea for solving this issue?

Thanks