face-recognition icon indicating copy to clipboard operation
face-recognition copied to clipboard

Model performance is not good on new data

Open Atul997 opened this issue 4 years ago • 0 comments

I have an issue while following the given steps when I tried to train in own data set. It trains well and giving good result on data whose Id's are on test data. But when I am creating pipeline to predict on new data model performance got poor. How can I improve this and get single prediction for the given new image? Do I need to train model with the weights with more number of epochs or there is something that I am missing?

image = "path to image"
example_image1 = load_image(imge)
img2 = cv2.resize(example_image1, (96,96))
img2 = (img2 / 255.).astype(np.float32)
embedded_2 = nn4_small2_pretrained.predict(np.expand_dims(img2, axis=0))
embedded_3 = embedded_2[0]
example_prediction1 = knn.predict([embedded_3])
example_identity1 = encoder.inverse_transform(example_prediction1)[0]
print(example_identity1)
font = cv2.FONT_HERSHEY_SIMPLEX
org = (50, 50)
fontScale = 1
color = (255, 0, 0)
thickness = 2
image = cv2.putText(example_image1, example_identity1,org, font,
                   fontScale, color, thickness, cv2.LINE_AA)

Atul997 avatar Nov 25 '19 07:11 Atul997