holyseven / PSPNet-TF-Reproduce

Training PSPNet in Tensorflow. Reproduce the performance from the paper.
MIT License
125 stars 30 forks source link

Model failing to load #17

Closed gulzainali98 closed 3 years ago

gulzainali98 commented 5 years ago

model not loading. It gives an error. Below is the error.

Tensor name "resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/beta" not found in checkpoint files /PSPNET/PSPNet-TF-Reproduce/z_pretrained_weights/resnet_v1_101.ckpt [[node save/RestoreV2 (defined at inference.py:71) = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

What could be the problem? I downloaded the model from .sh file given in the code.

holyseven commented 5 years ago

Sorry, by default the code seems to use the model resnet_v1_50 but the pre-trained weights resnet_v1_101.

So the download link for resnet_v1_50 is here http://download.tensorflow.org/models/resnet_v1_50_2016_08_28.tar.gz.

Of course, you can change the model to resnet_v1_101 (see train.py).

gulzainali98 commented 5 years ago

python inference.py --coloring 1 --ms 0 --network resnet_v1_101 --weights_ckpt /PSPREVIVAL/PSPNet-TF-Reproduce/z_pretrained_weights/resnet_v1_101.ckpt --image_path images/real/rgb2.jpg

Even when i specifiy in the command to use resnet_v1_101, it still shows the same error but with resenet_v1_101 this time.

Tensor name "resnet_v1_101/block4/unit_4/BatchNorm/beta" not found in checkpoint files /PSPREVIVAL/PSPNet-TF-Reproduce/z_pretrained_weights/resnet_v1_101.ckpt [[node save/RestoreV2 (defined at inference.py:71) = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

gulzainali98 commented 5 years ago

Error persists even when i repeat the process with resnet_v1_50 I am putting the pre trained weights in the z_pretrained_weights folder

holyseven commented 5 years ago

When inferring an image, the weights_ckpt should be a trained model.

The resnet_v1_101.ckpt is a pretrained classification model on ImageNet. It has no weights for the new layers created for segmentation model. And resnet_v1_101/block4/unit_4/BatchNorm/beta is a new layer. That's why it was not found in renset_v1_101.ckpt.

gulzainali98 commented 5 years ago

where can i get pretrained model for segmentation?

kkk324 commented 4 years ago

same here

noamholz commented 4 years ago

same here :/

holyseven commented 4 years ago

Sorry guys, this repo is mainly for reproducing the training phase of PSPNet. There is only ImageNet-pretrained model in public, which is what I used for training. I didn't provide segmentation trained models, while the official repo did, link.

holyseven commented 3 years ago

To get a trained model for segmentation in Pytorch, you can see here: https://hangzhang.org/PyTorch-Encoding/model_zoo/segmentation.html.