PSPNet-tensorflow
PSPNet-tensorflow copied to clipboard
How to generate ckpt pre-train model from caffemodel?
Hello, I was successful to achieve the performance as your report. I was download the PSPNet caffe and build with cudnn 5.0.
Then I run the code
python convert.py ./pspnet101_cityscapes_713.prototxt --caffemodel ./pspnet101_cityscapes.caffemodel --data-output-path ./pspnet-init.ckpt
However, I got the error as bellow. Did you have same error when you generate the cpkt file? Thanks
caffe-tensorflow/kaffe/tensorflow/transformer.py", line 242, in load
NodeKind.BatchNorm]),
AttributeError: type object 'NodeKind' has no attribute 'BatchNorm'
Note that, I also changed the layers.py as below because the original code used name as BatchNorm
'BN': shape_identity,
'Interp': shape_identity,
Hello John! I have the same problem with you. Do you solve the problem?
@John1231983
@YanZhiyuan0918: Please look at the solution at https://github.com/Vladkryvoruchko/PSPNet-Keras-tensorflow
Let me know if you have any problem
@John1231983 Thanks a lot for advice. When I try to directly use the .npy model provided by [(https://github.com/Vladkryvoruchko/PSPNet-Keras-tensorflow)] to convert to .ckpt model, I run the code:
python npy2ckpt.py ./model/pspnet101_cityscapes.npy --save-dir=./model/
then I have the problem as follow:
ValueError: Variable conv4_17_3x3_bn/mean does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?
Do you know this problem?
OK. I see. I meet the problem and I need to used other code to convert npy2ckpt in the https://github.com/DrSleep/tensorflow-deeplab-resnet/tree/master/kaffe
Yes, I think so. The code npy2ckpt.py I used is also from https://github.com/DrSleep/tensorflow-deeplab-resnet . I think there is something unmatched in it .
@YanZhiyuan0918: have you solve the problem? Thanks
@John1231983 Not yet. Maybe we can ask for @hellochick for help.
Hey @John1231983 @YanZhiyuan0918 , I only transformed the weights, and handcraft the model. So I did not use the Caffe - Tensorflow code to generate model.py. Also, when you try to load the weights, you should care about the mismatching of variable name, such as gamma and scale in batch normalization layer.
Hey@hellochick , when train from scratch on ade20k dataset, we first need to restore pre-trained model such as resnet-50?