This file contains 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
from tensorflow.keras.models import Sequential | |
from tensorflow.keras.layers import Conv2D, ZeroPadding2D, MaxPooling2D, \ | |
Dropout, Flatten, Activation | |
def get_model(): | |
model = Sequential() | |
model.add(ZeroPadding2D((1,1),input_shape=(224,224, 3))) | |
model.add(Conv2D(64, (3, 3), activation='relu')) | |
model.add(ZeroPadding2D((1,1))) |
This file contains 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 os | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | |
from PIL import Image | |
import numpy as np | |
from matplotlib import pyplot as plt | |
import tensorflow as tf | |
from tensorflow.keras.models import Model |
This file contains 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 crop_face(filename, required_size=(224, 224)): | |
img = cv2.imread(filename) | |
detector = MTCNN() | |
results = detector.detect_faces(img) | |
x, y, width, height = results[0]['box'] | |
face = img[y:y+height, x:x+width] | |
image = Image.fromarray(face) | |
image = image.resize(required_size) | |
face_array = np.asarray(image) | |
return face_array, face |
This file contains 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 os | |
from keras.applications import ResNet50 | |
from keras.applications import InceptionV3 | |
from keras.applications import Xception | |
from keras.applications import VGG16 | |
from keras.applications import VGG19 | |
from keras.applications import imagenet_utils | |
from keras.applications.inception_v3 import preprocess_input | |
from keras.preprocessing.image import img_to_array | |
from keras.preprocessing.image import load_img |
This file contains 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 os | |
import glob | |
import streamlit as st | |
from main import predict | |
from PIL import Image | |
# all models list | |
models_list = [ |
This file contains 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
from tensorflow.keras import models | |
from tensorflow.keras.layers import Activation, ZeroPadding2D, MaxPooling2D, Conv2D, Flatten, Dense, Dropout | |
from tensorflow.keras import regularizers | |
def get_model(): | |
model = models.Sequential() | |
model.add(ZeroPadding2D((1,1),input_shape=(224,224, 3))) | |
model.add(Conv2D(64, (3, 3), activation='relu')) | |
model.add(ZeroPadding2D((1,1))) | |
model.add(Conv2D(64, (3, 3), activation='relu')) |
This file contains 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 os | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from model import get_model | |
from tensorflow.keras.models import load_model | |
from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
from tensorflow.keras import optimizers | |
from face_detection_operation import get_detected_face |
This file contains 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
from os.path import join, exists | |
from os import mkdir, listdir | |
import glob | |
from mtcnn import MTCNN | |
from PIL import Image | |
import numpy as np | |
import cv2 | |
This file contains 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 os | |
from face_recognition import FaceRecognition | |
if __name__ == '__main__': | |
model_name = "face_recognition.h5" | |
image_path = 'test.jpg' | |
face_recognition = FaceRecognition() | |
face_recognition.training() | |
face_recognition.save_model(model_name) |
This file contains 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
class HW25P(Peripheral): | |
def __init__(self, mac_address, timeout=0.5, isSecure=False, debug=False): | |
FORMAT = '%(asctime)-15s %(name)s (%(levelname)s) > %(message)s' | |
logging.basicConfig(format=FORMAT) | |
log_level = logging.WARNING if not debug else logging.DEBUG | |
self._log = logging.getLogger(self.__class__.__name__) | |
self._log.setLevel(log_level) | |
self._log.info('Connecting to ' + mac_address) |
OlderNewer