diff --git a/model_pred/check_model_on_cpu/check.py b/model_pred/check_model_on_cpu/check.py index e69de29..5158f83 100644 --- a/model_pred/check_model_on_cpu/check.py +++ b/model_pred/check_model_on_cpu/check.py @@ -0,0 +1,27 @@ +import numpy as np +import tensorflow as tf +from tensorflow import keras + +model = keras.models.load_model('../sign_car_detection_model') + + +class_names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'del', 'nothing', 'space'] + +path_to_img = 'C_test_own.png' + +def pred_sign_char(path_to_img: str): + + pred = [] + test_image = tf.keras.utils.load_img(path_to_img, target_size = (256, 256)) + test_image = tf.keras.utils.img_to_array(test_image) + test_image = np.expand_dims(test_image, axis = 0) + result = model.predict(test_image) + + + print(result) + pred.append(class_names[np.argmax(result)]) + print(pred) + return pred[0] + + +pred_sign_char(path_to_img) \ No newline at end of file