39b587f1aef21060878707696d4e7251d72cd22b,examples/face_recognition_knn.py,,,#,147
Before Change
if __name__ == "__main__":
knn_clf = train("knn_examples/train")
for img_path in listdir("knn_examples/test"):
preds = predict(join("knn_examples/test", img_path) ,knn_clf=knn_clf)
print(preds)
draw_preds(join("knn_examples/test", img_path), preds)
After Change
// STEP 2: Using the trained classifier, make predictions for unknown images
for image_file in os.listdir("knn_examples/test"):
full_file_path = os.path.join("knn_examples/test", image_file)
print("Looking for faces in {}".format(image_file))
// Find all people in the image using a trained classifier model
// Note: You can pass in either a classifier file name or a classifier model instance
predictions = predict(full_file_path, model_path="trained_knn_model.clf")
// Print results on the console
for name, (top, right, bottom, left) in predictions:
print("- Found {} at ({}, {})".format(name, left, top))
// Display results overlaid on an image
show_prediction_labels_on_image(os.path.join("knn_examples/test", image_file), predictions)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: ageitgey/face_recognition
Commit Name: 39b587f1aef21060878707696d4e7251d72cd22b
Time: 2018-03-05
Author: ageitgey@gmail.com
File Name: examples/face_recognition_knn.py
Class Name:
Method Name:
Project Name: keras-team/autokeras
Commit Name: 021f346839bbab5b22e5858eab16d382af26185b
Time: 2019-07-30
Author: jhfjhfj1@gmail.com
File Name: autokeras/auto_model.py
Class Name: AutoModel
Method Name: predict