This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #This code is the keras implementation of the above described NNdef simple_nn(): | |
| model = Sequential() | |
| model.add(Dense(2, input_dim=1, activation='sigmoid')) | |
| model.add(Dense(1, activation='sigmoid')) | |
| model.compile(loss='mean_squared_error', optimizer='sgd') | |
| return model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import cv2 | |
| import os | |
| import time | |
| from face_detection import * | |
| from face_recognition import * | |
| import requests | |
| import RPi.GPIO as GPIO | |
| #################################################################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def recognition(self,img): | |
| face, rect = detect_faces(img) | |
| global thres | |
| for i in range(0, len(face)) : | |
| label,confidence = self.face_recognizer.predict(face[i]) | |
| #print(confidence) | |
| label_text = names[label] | |
| if confidence > 65: | |
| thres += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| import time | |
| GPIO_PINS = [11, 12, 13, 15, 16, 18, 22, 3, 5, 24] | |
| def setup(): | |
| print ('Program is starting...') | |
| GPIO.setmode(GPIO.BOARD) | |
| for n_pin in GPIO_PINS: | |
| GPIO.setup(n_pin, GPIO.OUT) # Set all GPIO_PINS' mode is output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| import time | |
| PIN_GPIO = 11 # RPI Board pin11 | |
| def setup(): | |
| GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location | |
| GPIO.setup(PIN_GPIO, GPIO.OUT) # Set PIN_GPIO's mode is output | |
| GPIO.output(PIN_GPIO, GPIO.LOW) # Set PIN_GPIO low to off led | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| import time | |
| import random | |
| pins = {'pin_R':11, 'pin_G':12, 'pin_B':13} # pins is a dict | |
| def setup(): | |
| global R,G,B | |
| print ('Program is starting ... ') | |
| GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location |
NewerOlder