I tried to test the tflite model using a little python script that calls the model, inputs an image and shows the output. Here is the code
import tensorflow as tf
import numpy as np
import cv2
interpreter = tf.lite.Interpreter(model_path="nyu2tflite.tflite")
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
print(input_details,output_details)
input_data=cv2.resize(cv2.imread('../a/sss.JPG'),(640,480)) #shape is 640 X 480 X 3
input_data=input_data.astype(np.float32)
input_data=np.expand_dims(input_data,axis=0) #shape is 1 X 640 X 480 X 3
interpreter.set_tensor(input_details[0]['index'], input_data)
interpreter.invoke()
output_data = interpreter.get_tensor(output_details[0]['index'])
output_data = np.squeeze(output_data,axis=0)
output_data = output_data.astype(np.uint8)
cv2.imshow('final',output_data)
cv2.imshow('input',input_data)
cv2.waitKey(0)
Heres one of the results, the depth calculations are totally off. If I'm doing something wrong here, please tell me.