models icon indicating copy to clipboard operation
models copied to clipboard

Can't load the pretrained encoder fo training the decoder of Perspective Transformer Nets

Open mees opened this issue 9 years ago • 6 comments

System information

  • What is the top-level directory of the model you are using: Ptn directory
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 14.04
  • TensorFlow installed from (source or binary): Source
  • TensorFlow version (use command below): ('v1.3.0-rc1-27-g2784b1c', '1.3.0-rc2')
  • Bazel version (if compiling from source): 0.5.2
  • CUDA/cuDNN version: 8.0/5.1
  • GPU model and memory: Titan X
  • Exact command to reproduce: run -c opt :train_ptn -- --init_model='/home/meeso/models/ptn/my_models/deeprotator_pretrain/train/' --checkpoint_dir='/home/meeso/models/ptn/my_models/' --inp_dir='/home/meeso/Datasets/shapenet_tf/

Describe the problem

the init_model parameter is supposed to be absolute path of the folder where the pre-trained encoder is located. However, when you try to train the volumetric decoder, it doesn't find the model and crashes with following error.

Source code / logs

INFO: Running command line: bazel-bin/train_ptn '--init_model=/home/meeso/models/ptn/my_models/deeprotator_pretrain/train/' '--checkpoint_dir=/home/meeso/models/ptn/my_models/' '--inp_dir=/home/meeso/Datasets/shapenet_tf/'
Traceback (most recent call last):
  File "/home/meeso/.cache/bazel/_bazel_meeso/3a6bfcc5e3fa6521c178dee287de79bc/execroot/__main__/bazel-out/local-opt/bin/train_ptn.runfiles/__main__/train_ptn.py", line 230, in <module>
    app.run()
  File "/home/meeso/.virtualenvs/2d_to_3d/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "/home/meeso/.cache/bazel/_bazel_meeso/3a6bfcc5e3fa6521c178dee287de79bc/execroot/__main__/bazel-out/local-opt/bin/train_ptn.runfiles/__main__/train_ptn.py", line 210, in main
    init_fn = model.get_init_fn(init_scopes)
  File "/home/meeso/models/ptn/model_voxel_generation.py", line 133, in get_init_fn
    self._params.init_model, var_list)
  File "/home/meeso/.virtualenvs/2d_to_3d/local/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 572, in assign_from_checkpoint
    reader = pywrap_tensorflow.NewCheckpointReader(model_path)
  File "/home/meeso/.virtualenvs/2d_to_3d/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 110, in NewCheckpointReader
    return CheckpointReader(compat.as_bytes(filepattern), status)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/meeso/.virtualenvs/2d_to_3d/local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for /home/meeso/models/ptn/my_models/deeprotator_pretrain/train/
ERROR: Non-zero return code '1' from command: Process exited with status 1.

mees avatar Aug 08 '17 13:08 mees

I don't think there is a bug here, please specify the entire model path in the flag "init_model" rather than the checkpoint directory.

xcyan avatar Aug 08 '17 14:08 xcyan

Well if it's a design choice you should maybe clarify this in the Readme file

mees avatar Aug 08 '17 15:08 mees

@mees I'm assuming you've resolved the issue by passing in a full path rather than just a directory?

For reference here's the help description for the --init_model flag to train_ptn.py: https://github.com/mees/models/blob/df9e50326b7aa9489e000b3dc6c4f41b857eddd3/ptn/train_ptn.py#L61

I'm closing this out, but if you still have issues, feel free to ping this thread, and I'll reopen it.

tatatodd avatar Aug 09 '17 19:08 tatatodd

@mees Then how to set the path of "init_model"? Thank you very much!

ZYCZH avatar Jan 04 '19 05:01 ZYCZH

@ZYCZH This is more like a Tensorflow question.

Set init_model = /.../../../model.ckpt-?????

xcyan avatar Jan 06 '19 22:01 xcyan

@xcyan Thank you very much .

ZYCZH avatar Jan 15 '19 13:01 ZYCZH