tensorflow-yolov4-tflite icon indicating copy to clipboard operation
tensorflow-yolov4-tflite copied to clipboard

Inference on saved Tensorflow model

Open AlphaNumeric99 opened this issue 4 years ago • 2 comments

I converted the weights using save_model.py and got the final model. My question is how to load it via Keras/Tensorflow to do inference?

model = tf.saved_model.load(str(model_dir), tags=['serve'])
model = model.signatures['serving_default']

resized_rgb_image = resized_rgb_image.astype(np.float32)
input_image = np.expand_dims(resized_rgb_image, axis=0)
input_tensor = tf.convert_to_tensor(input_image)
output_dict = model(input_tensor)

I get tensorflow.python.framework.errors_impl.FailedPreconditionError

tensorflow.python.framework.errors_impl.FailedPreconditionError:  Error while reading resource variable batch_normalization_56/moving_mean_60226 from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/batch_normalization_56/moving_mean_60226/class tensorflow::Var does not exist.
	 [[{{node StatefulPartitionedCall/model_1/batch_normalization_56/FusedBatchNormV3/ReadVariableOp}}]] [Op:__inference_signature_wrapper_8573]

AlphaNumeric99 avatar May 16 '20 05:05 AlphaNumeric99

I also have this issue. Did you manage to resolve it?

alexrider1105 avatar Jul 16 '20 00:07 alexrider1105

Any solution for this yet?

dm0288 avatar Aug 25 '21 14:08 dm0288