I am trying to load the pretrained model from tensorflow hub (link here: https://tfhub.dev/google/on_device_vision/classifier/landmarks_classifier_north_america_V1/1). When I run inference on a single image, I get an output on length 99424, but the corresponding labelmap is of length 99676. This doesn't make any sense to me as the lengths of the two should be the same length. Because of this error, the model is not classifying accurately whatsoever. Is anyone else having the same error. If not, any guidance would be greatly appreciated.
import tensorflow.compat.v2 as tf
import tensorflow_hub as hub
model = hub.KerasLayer(model_url, output_key='predictions:logits')
landmarks = pd.read_csv(landmark_file)
image = load_image(im_path) # (321, 321, 3) scaled between [0,1]
output = model(image)
prediction = landmarks['name'][int(tf.math.argmax(output, 1))]
Additionally, I get this error when loading the model:
INFO:tensorflow:Saver not created because there are no variables in the graph to restore
I feel like it is a problem with tensorflow hub's model, but not entirely sure