LucasSheng / avatar-net

Avatar-Net: Multi-scale Zero-shot Style Transfer by Feature Decoration
https://lucassheng.github.io/avatar-net/
178 stars 38 forks source link

TypeError: Expected binary or unicode string, got None #6

Open freefly-huanshao opened 5 years ago

freefly-huanshao commented 5 years ago

I try to run this program,but fail...

Finish loading the model [AvatarNet] configuration Traceback (most recent call last): File "evaluate_style_transfer.py", line 163, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "evaluate_style_transfer.py", line 121, in main checkpoint_dir, slim.get_model_variables(), ignore_missing_vars=True) File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 571, in assign_from_checkpoint_fn reader = pywrap_tensorflow.NewCheckpointReader(model_path) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 110, in NewCheckpointReader return CheckpointReader(compat.as_bytes(filepattern), status) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/compat.py", line 65, in as_bytes (bytes_or_text,)) TypeError: Expected binary or unicode string, got None could you give me some suggestion?

Parker-Lyu commented 5 years ago

I met this problem too, did you solve it?

Parker-Lyu commented 5 years ago

I try to run this program,but fail...

Finish loading the model [AvatarNet] configuration Traceback (most recent call last): File "evaluate_style_transfer.py", line 163, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "evaluate_style_transfer.py", line 121, in main checkpoint_dir, slim.get_model_variables(), ignore_missing_vars=True) File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 571, in assign_from_checkpoint_fn reader = pywrap_tensorflow.NewCheckpointReader(model_path) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 110, in NewCheckpointReader return CheckpointReader(compat.as_bytes(filepattern), status) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/compat.py", line 65, in as_bytes (bytes_or_text,)) TypeError: Expected binary or unicode string, got None could you give me some suggestion?

see here https://github.com/LucasSheng/avatar-net/issues/1 what we need to do is to specify a ckpt name instead of a ckpt dir to checkpoint_dir

minhmanho commented 5 years ago

I met the same problem. Have you solved it @freefly-huanshao @Parker-Lyu ?

Parker-Lyu commented 5 years ago

I met the same problem. Have you solved it @freefly-huanshao @Parker-Lyu ?

what i did is to specify a ckpt name instead of a ckpt dir to checkpoint_dir. That works to me. Good luck

minhmanho commented 5 years ago

Sorry I'm new in tensorflow. There are 3 files .data, .index and .meta, how could you specify the ckpt @Parker-Lyu ?

minhmanho commented 5 years ago

Sorry I'm new in tensorflow. There are 3 files .data, .index and .meta, how could you specify the ckpt @Parker-Lyu ?

Sorry for the stupid question. Problem solved!

CJHFUTURE commented 5 years ago

Hi guys, I'm trying to resolve this issue as well. I have created a checkpoint.txt file and put this into that file: model_checkpoint_path: "C:\avatar-net-master\data\AvatarNet\model.ckpt-120000.data-00000-of-00001"

now when I run I get this error....could you expand @LucasSheng on how paths should be defined etc? (TFGPU) C:\avatar-net-master>python evaluate_style_transfer.py --content_dataset_dir C:\avatar-net-master\data\contents\images --style_dataset_dir C:\avatar-net-master\data\contents\images --checkpoint_dir C:\avatar-net-master\data\AvatarNet\model.ckpt-120000.data-00000-of-00001 C:\ProgramData\Anaconda3\lib\site-packages\h5py__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Traceback (most recent call last): File "evaluate_style_transfer.py", line 163, in tf.app.run() File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "evaluate_style_transfer.py", line 91, in main style_model, options = models_factory.get_model(FLAGS.model_config_path) File "C:\avatar-net-master\models\models_factory.py", line 18, in get_model if not tf.gfile.Exists(filename): File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 260, in file_exists pywrap_tensorflow.FileExists(compat.as_bytes(filename), status) File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\util\compat.py", line 61, in as_bytes (bytes_or_text,)) TypeError: Expected binary or unicode string, got None

Thanks heaps

minhmanho commented 5 years ago

@CJHFUTURE Here is how I resolved this problem. Perhaps it's just a style of tensorflow framework to load checkpoint. Please directly give the directory.

init_fn = slim.assign_from_checkpoint_fn("/path/to/cvpr-18_avatar-net/data/model.ckpt-120000", slim.get_model_variables(), ignore_missing_vars=True)
with tf.Session() as sess:
    init_fn(sess)
    nn = 0.0
    total_time = 0.0