From 3a45b3ce174a52322a567c47afea4a6f02159766 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 22 Jun 2018 15:14:15 +0200 Subject: [PATCH] Update smile script. --- .../examples/25-Machine-Learning/nn_haar_smile_detection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py b/scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py index 86d60c333..f94d29be2 100644 --- a/scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py +++ b/scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py @@ -3,8 +3,8 @@ import sensor, time, image, os, nn sensor.reset() # Reset and initialize the sensor. sensor.set_contrast(2) -sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 -sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240) +sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 +sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time=2000) sensor.set_auto_gain(False) @@ -29,7 +29,7 @@ while (True): # Detect smiles for r in objects: # Resize and center detection area - r = [r[0], r[1]+10, int(r[2]*1.1), int(r[2]*1.1)] + r = [r[0]+10, r[1]+25, int(r[2]*0.70), int(r[2]*0.70)] img.draw_rectangle(r) out = net.forward(img, roi=r, softmax=True) img.draw_string(r[0], r[1], ':)' if (out[0] > 0.8) else ':(', color=(255), scale=2)