GeorgeSeif / Semantic-Segmentation-Suite

Semantic Segmentation Suite in TensorFlow. Implement, train, and test new Semantic Segmentation models easily!
2.5k stars 880 forks source link

Cannot load any model #196

Open alex88o opened 5 years ago

alex88o commented 5 years ago

I downloaded all the weights with get_pretrained_checkpoints and they are all stored in /utils/models. Then, trying to run test.py with ANY combination of model/checkpoints it raises an error when loading the model, saying that some Tensor is not present in the weight file. An example of run command is:

python test.py --checkpoint_path ./utils/models/resnet_v2_101.ckpt --model custom

developpeur3d commented 5 years ago

can you share with us your error msg ?

alex88o commented 5 years ago

Loading model checkpoint weights ... Traceback (most recent call last): File "test.py", line 52, in saver.restore(sess, args.checkpoint_path) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1560, in restore {self.saver_def.filename_tensor_name: save_path}) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 895, in run run_metadata_ptr) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1124, in _run feed_dict_tensor, options, run_metadata) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run options, run_metadata) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: Tensor name "BatchNorm_2/beta" not found in checkpoint files ./utils/models/resnet_v2_101.ckpt [[Node: save_1/RestoreV2_6 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save_1/Const_0_0, save_1/RestoreV2_6/tensor_names, save_1/RestoreV2_6/shape_and_slices)]]

Caused by op u'save_1/RestoreV2_6', defined at: File "test.py", line 51, in saver=tf.train.Saver(max_to_keep=1000) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1140, in init self.build() File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1172, in build filename=self._filename) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 688, in build restore_sequentially, reshape) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 407, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 247, in restore_op [spec.tensor.dtype])[0]) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 663, in restore_v2 dtypes=dtypes, name=name) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/jolwave/KERAS_TF/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1204, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): Tensor name "BatchNorm_2/beta" not found in checkpoint files ./utils/models/resnet_v2_101.ckpt [[Node: save_1/RestoreV2_6 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save_1/Const_0_0, save_1/RestoreV2_6/tensor_names, save_1/RestoreV2_6/shape_and_slices)]]

jsolves commented 5 years ago

"resnet_v2_101.ckpt" seems a pre-trained network that is loaded when building the network.

"--checkpoint_path" is "The path to the latest checkpoint weights for your model". That means the checkpoint of a supported trained network listed on main page...

developpeur3d commented 5 years ago

I guess you have to delete the older checkpoints folder and re-train your model.

alex88o commented 5 years ago

I didn't trained any model. I just want to download a pre-trained model and test it.

ryohachiuma commented 5 years ago

There is no pre-trained model provided in this project. You have to train the model by yourself.

developpeur3d commented 5 years ago

Maybe by "download the pretrined model" he wanted to say the checkpoints (of the front ends)

Unfortunatily there is no support in this repo :(

l99500 commented 4 years ago

can you share me all the weights with get_pretrained_checkpoints ? I don't know why i can't download these model