Computer Vision

Face Emotion Recognition (Pytorch)

Re_Implementation Deep Emotion Original Source of Deep Emotion Original Source of Deep Emotion https://github.com/omarsayed7/Deep-Emotion from __future__ import print_function import argparse import numpy as np from PIL import Image import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torch.optim as optim from torch.utils.data import DataLoader, Dataset from torch.utils.data.sampler import SubsetRandomSampler from torchvision import …

Face Emotion Recognition (Pytorch) Read More »

Face Emotion Recognition (TensorFlow)

import tensorflow as tf ## pip install tensorflow-gpu import cv2 ### pip install opencv-python ## pip install opencv-contrib-python fullpackage import os import matplotlib.pyplot as plt ## pip install matlplotlib import numpy as np ## pip install numpy ## shift + enter img_array = cv2.imread("Training/0/Training_314.jpg") img_array.shape # rgb (48, 48, 3) print (img_array) plt.imshow(img_array) ## BGR …

Face Emotion Recognition (TensorFlow) Read More »

Image to Text OCR

import pytesseract import cv2 # pip install opencv-python import matplotlib.pyplot as plt ## pip install matplotlib For Configuration pytesseract.pytesseract.tesseract_cmd = r’C:\Program Files\Tesseract-OCR\tesseract.exe’ img = cv2.imread(‘Demo.png’) plt.imshow(img) img2char = pytesseract.image_to_string(img) print(img2char) imgbox = pytesseract.image_to_boxes(img) type(imgbox) str print(imgbox) imgH, imgW,_ = img.shape img.shape (720, 1280, 3) for boxes in imgbox.splitlines(): boxes = boxes.split(‘ ‘) x,y,w, h = …

Image to Text OCR Read More »

Object detection

Object Detection using SSD-MobileNetv3 import cv2 import matplotlib.pyplot as plt classLabels = [] file_name = ‘Labels.txt’ with open(file_name,’rt’) as fpt: classLabels = fpt.read().rstrip(‘n’).split(‘n’) print(classLabels) ## Class labels config_file = ‘ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt’ frozen_model = ‘frozen_inference_graph.pb’ Reading the Model in Opencv #model = cv2.dnn.readNetFromTensorflow(frozen_model,config_file) model = cv2.dnn_DetectionModel(frozen_model,config_file) model.setInputSize(320,320) model.setInputScale(1.0/127.5) ## 255/2 = 127.5 model.setInputMean((127.5,127.5,127.5)) ## model.setInputSwapRB(True) <dnn_Model 000001BDE265BA20> …

Object detection Read More »

Human Pose Estimation

import cv2 as cv # pip install opencv-python shift +enter import matplotlib.pyplot as plt ## pip install matplotlib inWidth = 368 inHeight = 368 thr = 0.2 BODY_PARTS = { "Nose": 0, "Neck": 1, "RShoulder": 2, "RElbow": 3, "RWrist": 4, "LShoulder": 5, "LElbow": 6, "LWrist": 7, "RHip": 8, "RKnee": 9, "RAnkle": 10, "LHip": 11, "LKnee": …

Human Pose Estimation Read More »

Face Mask detection

text to be added import tensorflow as tf ## pip install tensorflow-gpu import cv2 ### pip install opencv-python ## pip install opencv-contrib-python fullpackage import os import matplotlib.pyplot as plt ## pip install matlplotlib import numpy as np ## pip install numpy img_array = cv2.imread("Dataset/Face_Mask/00000_Mask.jpg") plt.imshow(img_array) ## BGR <matplotlib.image.AxesImage at 0x1b592d6bf08> plt.imshow(cv2.cvtColor(img_array, cv2.COLOR_BGR2RGB)) <matplotlib.image.AxesImage at 0x1b59322e4c8> …

Face Mask detection Read More »

Drowsiness Detection

Drowsiness Detection https://youtu.be/qwUIFKi4V48?feature=shared text to be added import tensorflow as tf ## pip install tensorflow-gpu import cv2 ### pip install opencv-python ## pip install opencv-contrib-python fullpackage import os import matplotlib.pyplot as plt ## pip install matlplotlib import numpy as np ## pip install numpy img_array = cv2.imread("Test_Dataset/Closed_Eyes/s0001_00056_0_0_0_0_0_01.png", cv2.IMREAD_GRAYSCALE) plt.imshow(img_array,cmap="gray") img_array.shape Datadirectory = "Test_Dataset/" ## training …

Drowsiness Detection Read More »

Face Emotion Recognition

Face Emotion Recognition import cv2 ### pip install opencv-python ## pip install opencv-contrib-python fullpackage This code install … from deepface import DeepFace ## pip install deepface img = cv2.imread(‘happyboy.jpg’) plt.imshow(img) plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) predictions = DeepFace.analyze(img) predictions = DeepFace.analyze(img, actions =[’emotion’]) predictions[‘dominant_emotion’] img = cv2.imread(‘sad_women.jpg’) plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) predictions = DeepFace.analyze(img) faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + ‘haarcascade_frontalface_default.xml’) gray …

Face Emotion Recognition Read More »

Image Classification

Image Classification / Image Recognition https://www.youtube.com/watch?v=Gz_PsRRxrHM Hello everyone! this tutorial is based on our youtube video for Image-Classification. Scope: This tutorial is for beginners, who are not familiar with deep learning concepts as we will use pre-trained models.  Background: Deep learning algorithms (such as AlexNet, GoogleNet, MobileNet, VGGNet, etc) take input –> image (typically  224 x …

Image Classification Read More »