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 numpy as np | |
import tensorflow as tf | |
import cv2 | |
import visualization_utils as vis_util | |
def create_category_index(label_path='coco_ssd_mobilenet/labelmap.txt'): | |
""" | |
To create dictionary of label map | |
Parameters |
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 cv2 | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
def get_face_detector(modelFile = "models/res10_300x300_ssd_iter_140000.caffemodel", | |
configFile = "models/deploy.prototxt"): | |
""" | |
Get the face detection caffe model of OpenCV's DNN module | |
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
"""Human facial landmark detector based on Convolutional Neural Network.""" | |
import cv2 | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
import math | |
class FaceDetector: | |
"""Detect human face from image""" |
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 cv2 | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
class FaceDetector: | |
"""Detect human face from image""" | |
def __init__(self, |
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 numpy as np | |
import cv2 | |
from sklearn.externals import joblib | |
def calc_hist(img): | |
histogram = [0] * 3 | |
for j in range(3): | |
histr = cv2.calcHist([img], [j], None, [256], [0, 256]) | |
histr *= 255.0 / histr.max() | |
histogram[j] = histr |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 itertools import combinations_with_replacement | |
from collections import defaultdict | |
import numpy as np | |
from numpy.linalg import inv | |
B, G, R = 0, 1, 2 # index for convenience | |
def boxfilter(I, r): | |
"""Fast box filter implementation. |
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 speech_recognition as sr | |
import pyaudio | |
import wave | |
import time | |
import threading | |
import os | |
def read_audio(stream, filename): | |
chunk = 1024 # Record in chunks of 1024 samples | |
sample_format = pyaudio.paInt16 # 16 bits per sample |
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 cv2 | |
import dlib | |
import numpy as np | |
import threading | |
from yolo_helper import YoloV3, load_darknet_weights, draw_outputs | |
from dlib_helper import (shape_to_np, | |
eye_on_mask, | |
contouring, | |
process_thresh, | |
print_eye_pos, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder