Tensorflow Assign Requires Shapes Of Both Tensors To Match. Lhs Shape= [20] Rhs Shape= [48]
Solution 1:
Try deleting any checkpoints that were saved from previous runs. Sometimes when changing the architecture and running again, TF will pick up from the old checkpoint (but with new definition), and you get this error.
Solution 2:
I also ran into this problem, the problem was that the labels and class numbers didn't matched so I changed and fix the class number cound and labels everywhere.
In my case it was to change the "num_classes" parameter in the faster_rcnn.config and the "label_map.pbtxt" file to match with the real values.
Solution 3:
If deleting checkpoints didn't work, this error is due to dimensions, so chek if the number of classes correspond to the same, as well as the dimensions of the image
Solution 4:
So as it happens, I had updated the TensorFlow code but had failed to train it. So I rolled back to the previous version, made the appropriate new changes to the run script and got it working.
Solution 5:
It also happens that the input image shape doesn't match with the input image tensor. Meaning, you may experience this problem when the model is expecting to have an input image as RGB but you are sending it Gray scale image. So, make sure to have the right input data. Check it by using the image.shape function of opencv.
importcv2im= cv2.imread('lena.jpg')
h, w, c = im.shape
print(h,w,c)
where; h is height w is width c is channel
Post a Comment for "Tensorflow Assign Requires Shapes Of Both Tensors To Match. Lhs Shape= [20] Rhs Shape= [48]"