microsoft / Recursive-Cascaded-Networks

[ICCV 2019] Recursive Cascaded Networks for Unsupervised Medical Image Registration
https://arxiv.org/abs/1907.12353
MIT License
361 stars 87 forks source link

question ? [checkpoint in demo] #46

Closed agatadefr closed 3 years ago

agatadefr commented 3 years ago

Hello,

I would like to try your solution. I would like to register 2 CT dicom series (abdominal scans). I tried demo.py code. I have an issue with checkpoint. Which checkpoint to use ? I would like to test on my own data.

python demo.py -c ./weights/VTN-3-liver -f ./datasets/fixed -m ./datasets/moving -o output python demo.py -c ???? -f ./datasets/fixed -m ./datasets/moving -o output

What should I do ?

Because until now I can not run code properly.

I would be appreciate for any help please.

zsyzzsoft commented 3 years ago

You may download either of our pre-trained models here.

agatadefr commented 3 years ago

@zsyzzsoft Thanks for quick reply. I can not run demo properly.

python demo.py -c ./weights/VTN-3-liver -f ./datasets/fixed -m ./datasets/moving -o output

I got an error ..

WARNING:tensorflow:From demo.py:91: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.

WARNING:tensorflow:From demo.py:91: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.

WARNING:tensorflow:From /.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. WARNING:tensorflow:From /.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. 140 180 160 200 ./weights/VTN-3-liver/model-99500 {'base_network': 'VTN', 'n_cascades': 3, 'rep': 1, 'gpu': '0,1,2,3', 'checkpoint': None, 'dataset': 'datasets/liver.json', 'batch': 4, 'round': 20000, 'epochs': 5, 'debug': False, 'val_steps': 100, 'net_args': '', 'data_args': '', 'lr': 0.0001, 'clear_steps': False, 'finetune': None, 'name': None, 'logs': ''} [(<network.base_networks.VTNAffineStem object at 0x2aab0c3f3fd0>, {'raw_weight': 0, 'reg_weight': 0, 'weight': 1}), (<network.base_networks.VTN object at 0x2aab0c47cef0>, {'raw_weight': 0, 'weight': 1, 'reg_weight': 1}), (<network.base_networks.VTN object at 0x2aab0c47ce80>, {'raw_weight': 0, 'weight': 1, 'reg_weight': 1}), (<network.base_networks.VTN object at 0x2aab0c770f28>, {'raw_weight': 1, 'weight': 1, 'reg_weight': 1})] Graph built Traceback (most recent call last): File/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1339, in _run_fn self._extend_graph() File "/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1374, in _extend_graph tf_session.ExtendSession(self._session) tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation strided_slice_19: {{node strided_slice_19}}was explicitly assigned to /gpu:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:XLA_CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled. [[strided_slice_19]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1286, in restore {self.saver_def.filename_tensor_name: save_path}) File "/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1370, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation strided_slice_19: node strided_slice_19 (defined at /Agata/dev/reg/Recursive-Cascaded-Networks/network/utils.py:151) was explicitly assigned to /gpu:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:XLA_CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled. [[strided_slice_19]]

Errors may have originated from an input operation. Input Source operations connected to node strided_slice_19: Reshape_16 (defined at /Agata/dev/reg/Recursive-Cascaded-Networks/network/utils.py:196)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "demo.py", line 286, in main() File "demo.py", line 94, in main saver.restore(sess, checkpoint) File "/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1322, in restore err, "a mismatch between the current graph and the graph") tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Cannot assign a device for operation strided_slice_19: node strided_slice_19 (defined at /pstore/data/oncology_imaging/Agata/dev/reg/Recursive-Cascaded-Networks/network/utils.py:151) was explicitly assigned to /gpu:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:XLA_CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled. [[strided_slice_19]]

Errors may have originated from an input operation. Input Source operations connected to node strided_slice_19: Reshape_16 (defined at /Agata/dev/reg/Recursive-Cascaded-Networks/network/utils.py:196)

zsyzzsoft commented 3 years ago

Seems that the installed tensorflow does not have GPU support or there are no GPU devices. Please install tensorflow-gpu properly.