Skip to content
Snippets Groups Projects
Commit b2a35e34 authored by Raffaelbdl's avatar Raffaelbdl
Browse files

random push

parent 86d84dba
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -5,7 +5,9 @@ import cv2 ...@@ -5,7 +5,9 @@ import cv2
from utils import * from utils import *
from config import emotions, input_shape, modelName from config import emotions, input_shape, modelName
model = keras.models.load_model("models/"+modelName) #Load our model #model = tf.keras.models.load_model("models/"+modelName) #Load our model
model = tf.saved_model.load("models/"+modelName)
print('Model used:', modelName) print('Model used:', modelName)
def detectEmotion(face): def detectEmotion(face):
......
...@@ -3,9 +3,10 @@ import cv2 ...@@ -3,9 +3,10 @@ import cv2
import imageProcess as ip import imageProcess as ip
import faceAnalysis as fa import faceAnalysis as fa
import random import random
from time import sleep
from config import emotions from config import emotions
cap = cv2.VideoCapture(0) #0 means we capture the first camera, your webcam probably cap = cv2.VideoCapture(4) #0 means we capture the first camera, your webcam probably
score = 0 score = 0
N = 15 N = 15
...@@ -32,9 +33,12 @@ while cap.isOpened(): #or while 1. cap.isOpened() is false if there is a probl ...@@ -32,9 +33,12 @@ while cap.isOpened(): #or while 1. cap.isOpened() is false if there is a probl
smiley, emotion = smileyRandom(emotion) smiley, emotion = smileyRandom(emotion)
cv2.imshow("Caméra", frame) #Show you making emotional faces cv2.imshow("Camera", frame) #Show you making emotional faces
cv2.putText(smiley, "Score: "+str(score), (40,40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 2) cv2.putText(smiley, "Score: "+str(score), (40,40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 2)
cv2.imshow("Smiley", smiley) #Show the smiley to mimic cv2.imshow("Smiley", smiley) #Show the smiley to mimic
#sleep(0.5)
if cv2.waitKey(1) & 0xFF == ord('q'): #If you press Q, stop the while and so the capture if cv2.waitKey(1) & 0xFF == ord('q'): #If you press Q, stop the while and so the capture
break break
......
...@@ -18,8 +18,8 @@ def afficher(image): ...@@ -18,8 +18,8 @@ def afficher(image):
def predir(modele, image): def predir(modele, image):
# Return output of image from modele # Return output of image from modele
return modele.predict(np.array([image]))[0, :] #return modele.predict(np.array([image]))[0, :]
return modele(np.array([image]))[0, :]
def normAndResize(image, input_shape): def normAndResize(image, input_shape):
# For an array image of shape (a,b,c) or (a,b), transform it into (h,l,p). Also normalize it. # For an array image of shape (a,b,c) or (a,b), transform it into (h,l,p). Also normalize it.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment