mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
ensemble bug
This commit is contained in:
parent
d080107998
commit
84a6446040
@ -25,7 +25,6 @@ idendities = {
|
||||
"Matt": ["img29.jpg", "img30.jpg", "img31.jpg", "img32.jpg", "img33.jpg"],
|
||||
"Leonardo": ["img34.jpg", "img35.jpg", "img36.jpg", "img37.jpg"],
|
||||
"George": ["img38.jpg", "img39.jpg", "img40.jpg", "img41.jpg"]
|
||||
|
||||
}
|
||||
#--------------------------
|
||||
#Positives
|
||||
@ -45,6 +44,7 @@ for key, values in idendities.items():
|
||||
|
||||
positives = pd.DataFrame(positives, columns = ["file_x", "file_y"])
|
||||
positives["decision"] = "Yes"
|
||||
|
||||
print(positives.shape)
|
||||
#--------------------------
|
||||
#Negatives
|
||||
@ -80,8 +80,11 @@ df = pd.concat([positives, negatives]).reset_index(drop = True)
|
||||
|
||||
print(df.decision.value_counts())
|
||||
|
||||
df.file_x = "deepface/tests/dataset/"+df.file_x
|
||||
df.file_y = "deepface/tests/dataset/"+df.file_y
|
||||
df.file_x = "dataset/"+df.file_x
|
||||
df.file_y = "dataset/"+df.file_y
|
||||
|
||||
print(df.head())
|
||||
|
||||
#--------------------------
|
||||
#DeepFace
|
||||
|
||||
@ -111,7 +114,8 @@ if True:
|
||||
resp_obj = DeepFace.verify(instances
|
||||
, model_name = model
|
||||
, model = pretrained_models[model]
|
||||
, distance_metric = metric)
|
||||
, distance_metric = metric
|
||||
, enforce_detection = False)
|
||||
|
||||
distances = []
|
||||
|
||||
@ -138,7 +142,7 @@ for model in models:
|
||||
|
||||
feature = '%s_%s' % (model, metric)
|
||||
|
||||
ax1 = fig.add_subplot(4, 2, figure_idx)
|
||||
ax1 = fig.add_subplot(len(models) * len(metrics), len(metrics), figure_idx)
|
||||
|
||||
df[df.decision == "Yes"][feature].plot(kind='kde', title = feature, label = 'Yes', legend = True)
|
||||
df[df.decision == "No"][feature].plot(kind='kde', title = feature, label = 'No', legend = True)
|
||||
@ -204,6 +208,15 @@ gbm.save_model("face-recognition-ensemble-model.txt")
|
||||
|
||||
predictions = gbm.predict(x_test)
|
||||
|
||||
prediction_classes = []
|
||||
for prediction in predictions:
|
||||
prediction_class = np.argmax(prediction)
|
||||
prediction_classes.append(prediction_class)
|
||||
|
||||
print(y_test)
|
||||
print("------")
|
||||
print(prediction_classes)
|
||||
|
||||
cm = confusion_matrix(y_test, prediction_classes)
|
||||
print(cm)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user