Views
No views yet
with_mask, without_mask, mask_worn_incorrectly1import tensorflow as tf
2import numpy as np
3from PIL import Image
4
5model = tf.keras.models.load_model("face_mask_model.h5")
6img = Image.open("face.jpg").resize((224, 224))
7arr = np.expand_dims(np.array(img), 0) / 255.0
8pred = model.predict(arr)
9print(["with_mask","without_mask","mask_worn_incorrectly"][pred.argmax()])