omagdy/3DRDN-CycleGAN

Error in valid_batch = [next(valid_dataset)]

juzhongren opened this issue · 1 comments

Error:
how to solve this problem,
#Initial Random Slice Image Generation
valid_batch = [next(valid_dataset)]

Traceback (most recent call last):
File "main.py", line 26, in
main()
File "main.py", line 22, in main
LAMBDA_CYC, LAMBDA_IDT, CRIT_ITER, TRAIN_ONLY, MODEL)
File "F:\mazhiqiang\3DRDN-CycleGAN-main\training.py", line 86, in main_loop
valid_batch = [next(valid_dataset)]
File "C:\Users\user\anaconda3\envs\tensorflow-gpu2.6.0\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 4692, in next
return nest.map_structure(to_numpy, next(self._iterator))
File "C:\Users\user\anaconda3\envs\tensorflow-gpu2.6.0\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 761, in next
return self._next_internal()
File "C:\Users\user\anaconda3\envs\tensorflow-gpu2.6.0\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 747, in _next_internal
output_shapes=self._flat_output_shapes)
File "C:\Users\user\anaconda3\envs\tensorflow-gpu2.6.0\lib\site-packages\tensorflow\python\ops\gen_dataset_ops.py", line 2727, in iterator_get_next
_ops.raise_from_not_ok_status(e, name)
File "C:\Users\user\anaconda3\envs\tensorflow-gpu2.6.0\lib\site-packages\tensorflow\python\framework\ops.py", line 6941, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Need minval < maxval, got 50 >= 14
[[{{node StatefulPartitionedCall/StatefulPartitionedCall/random_uniform_2}}]] [Op:IteratorGetNext]

Hi @juzhongren,

What are the dimensions of the images that you're using as a dataset ?

The parameters PATCH_SIZE and BOUNDARY_VOXELS_1 are set such that the image patch (extracted from the 3d image) thats inserted into the network is of size 40x40x40 and is at least 50 pixels/voxels away from all 6 sides of the image cube as these are almost always empty pixels/voxels surrounding the scanned image.

If your images have a dimension smaller than 140 (50 + 40 + 50) then you need to adjust these 2 parameters (PATCH_SIZE, BOUNDARY_VOXELS_1) accordingly by making them smaller.

Let me know if this answers your question.