Commit 7a36fef0 authored by tihmels's avatar tihmels

Nachbesserung Sorted_set

parent 5545121a
......@@ -2,15 +2,19 @@ import cv2
import glob
import random
import numpy as np
import logging
import sys
import signal
emotions = ["neutral", "anger", "disgust", "happy", "surprise"] # Emotion list
fishface = cv2.face.FisherFaceRecognizer_create()
data = {}
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
filename='logs/process_model.log')
emotions = ["anger", "disgust", "happy", "neutral", "surprise"] # Emotion list
fishface = cv2.face.FisherFaceRecognizer_create()
def get_files(emotion): # Define function to get file list, randomly shuffle it and split 80/20
files = glob.glob("Basis_data\\dataset\\%s\\*" % emotion)
files = glob.glob('Basis_data/dataset/%s/*' % emotion)
random.shuffle(files)
training = files[:int(len(files) * 0.8)] # get first 80% of file list
prediction = files[-int(len(files) * 0.2):] # get last 20% of file list
......@@ -37,6 +41,7 @@ def make_sets():
prediction_data.append(gray)
prediction_labels.append(emotions.index(emotion))
return training_data, training_labels, prediction_data, prediction_labels
......@@ -64,11 +69,19 @@ def run_recognizer():
# Now run it
metascore = []
logging.debug("fisherface training initialized")
for i in range(0, 10):
correct = run_recognizer()
print("got", correct, "percent correct!")
metascore.append(correct)
print("\n\nend score:", np.mean(metascore), "percent correct!")
print("\nend score:", np.mean(metascore), "percent correct!")
logging.info("finished {} iterations:".format(len(metascore)))
for idx, meta in enumerate(metascore):
logging.debug("{} : {}%".format(idx, meta))
logging.debug("fisherface finished with {}%\n".format(np.mean(metascore)))
fishface.write('Basis_data/models/detection_model.xml')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment