Spaces:
Sleeping
Sleeping
Commit ·
f9d49e5
1
Parent(s): 47db9f1
Recognition
Browse files
app/Hackathon_setup/face_recognition_model.py
CHANGED
|
@@ -61,7 +61,21 @@ class Siamese(torch.nn.Module):
|
|
| 61 |
## classifier = nn.Sequential(nn.Linear(64, 64), nn.BatchNorm1d(64), nn.ReLU(), nn.Linear...) ##
|
| 62 |
##########################################################################################################
|
| 63 |
|
| 64 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# Definition of classes as dictionary
|
| 67 |
classes = ['Person0','Person1','Person2','Person3','Person4','Person5','Person6']
|
|
|
|
| 61 |
## classifier = nn.Sequential(nn.Linear(64, 64), nn.BatchNorm1d(64), nn.ReLU(), nn.Linear...) ##
|
| 62 |
##########################################################################################################
|
| 63 |
|
| 64 |
+
# Load the existing trained DecisionTree classifier
|
| 65 |
+
import joblib
|
| 66 |
+
import os
|
| 67 |
+
|
| 68 |
+
# Get the current directory path
|
| 69 |
+
current_path = os.path.dirname(os.path.abspath(__file__))
|
| 70 |
+
|
| 71 |
+
# Load the pre-trained DecisionTree classifier
|
| 72 |
+
try:
|
| 73 |
+
classifier_path = os.path.join(current_path, 'decision_tree_model.sav')
|
| 74 |
+
classifier = joblib.load(classifier_path)
|
| 75 |
+
print(f"✓ Loaded DecisionTree classifier with {len(classifier.classes_)} classes")
|
| 76 |
+
except Exception as e:
|
| 77 |
+
print(f"✗ Error loading DecisionTree classifier: {e}")
|
| 78 |
+
classifier = None
|
| 79 |
|
| 80 |
# Definition of classes as dictionary
|
| 81 |
classes = ['Person0','Person1','Person2','Person3','Person4','Person5','Person6']
|