rishizek / tensorflow-deeplab-v3-plus

DeepLabv3+ built in TensorFlow
MIT License
833 stars 307 forks source link

where is the param "--not-restore-last" #22

Open luoshanwei opened 6 years ago

luoshanwei commented 6 years ago

I find more detailed explanation in DrSleep's repo It say "If restoring weights from the PASCAL models for your dataset with a different number of classes, you will also need to pass the --not-restore-last flag, which will prevent the last layers of size 21 from being restored" where is the param "--not-restore-last" in your code Looking forward to your reply

rishizek commented 6 years ago

Hi @luoshanwei , Thank you for your interest in the repo.

In my case, I restore pre-trained model (Resnet) from --pre_trained_model directory, and last layer is not restored by default (refer to here). On the other hand, trained checkpoints are restored from --model_dir directory, which contains last layer. Thus does not need to use --not-restore-last flag.

I hope this answers your question.

DRACOyu commented 5 years ago

@rishizek hello, I meet the same question,as follows: Key Variable not found in checkpoint [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] I removed the tf.train.init_checkpoint,this problem still remains, I use inceptionV3 as the baseline, from your answer, checkpoint needs to be updated as well.so how to update the checkpoint? hope your answer,thanks

rishizek commented 5 years ago

Hi @DRACOyu , The code in the repo initially restores the model's weights from pre_trained model mentioned above. Then, the checkpoint is restored from here if exist. Please refer to official document for estimator for detail. Perhaps your model_dir contains previous different architecture model. You may be able to run model if you remove your model_dir.