kandi background
Explore Kits

face_classification | Realtime face detection | Computer Vision library

 by   oarriaga Python Version: Current License: MIT

 by   oarriaga Python Version: Current License: MIT

Download this library from

kandi X-RAY | face_classification Summary

face_classification is a Python library typically used in Artificial Intelligence, Computer Vision, Tensorflow, Keras, OpenCV applications. face_classification has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. However face_classification build file is not available. You can download it from GitHub.
Real-time face detection and emotion/gender classification using fer2013/imdb datasets with a keras CNN model and openCV.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • face_classification has a medium active ecosystem.
  • It has 5088 star(s) with 1545 fork(s). There are 231 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 38 open issues and 78 have been closed. On average issues are closed in 88 days. There are 9 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of face_classification is current.
face_classification Support
Best in #Computer Vision
Average in #Computer Vision
face_classification Support
Best in #Computer Vision
Average in #Computer Vision

quality kandi Quality

  • face_classification has 0 bugs and 0 code smells.
face_classification Quality
Best in #Computer Vision
Average in #Computer Vision
face_classification Quality
Best in #Computer Vision
Average in #Computer Vision

securitySecurity

  • face_classification has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • face_classification code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
face_classification Security
Best in #Computer Vision
Average in #Computer Vision
face_classification Security
Best in #Computer Vision
Average in #Computer Vision

license License

  • face_classification is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
face_classification License
Best in #Computer Vision
Average in #Computer Vision
face_classification License
Best in #Computer Vision
Average in #Computer Vision

buildReuse

  • face_classification releases are not available. You will need to build from source code and install.
  • face_classification has no build file. You will be need to create the build yourself to build the component from source.
face_classification Reuse
Best in #Computer Vision
Average in #Computer Vision
face_classification Reuse
Best in #Computer Vision
Average in #Computer Vision
Top functions reviewed by kandi - BETA

kandi has reviewed face_classification and discovered the below as its top functions. This is intended to give you an instant insight into face_classification implemented functionality, and help decide if they suit your requirements.

  • Simplified method
  • Creates a trivial exception
  • Process an image .
  • Performs a continuous flow .
  • Creates a simple CNN for the given input shape
  • Converts an input shape into BatchCV
  • Creates a simple neural network .
  • load the kDEF file
  • Draws the mimics from the input data
  • Creates a mosaic matrix from the specified images .

face_classification Key Features

Real-time face detection and emotion/gender classification using fer2013/imdb datasets with a keras CNN model and openCV.

Community Discussions

Trending Discussions on face_classification
  • Theano error deep learning python
Trending Discussions on face_classification

QUESTION

Theano error deep learning python

Asked 2018-Aug-02 at 15:54

This is fairly standard openCV code where a loop will detect faces with haar cascade classifier and then there is a deep learning model that will detect the emotion in the face. The model was created from the 2013 kaggle dataset, and I downloaded this model from this github account if someone wants to try out the code. fer2013_mini_XCEPTION.119-0.65.hdf5 Just place a models folder in your directory and rename it to model.h5

https://github.com/oarriaga/face_classification/tree/master/trained_models

The code works just fine with Tensorflow but when I run the program KERAS_BACKEND=theano python haarMOD.py I get an error that is maybe due to BLAS library not linking properly?? Would anyone have any ideas on how to get theano functioning? Ultimately I am trying to get a similar variation of this code to work on a Flask server which only works with Theano.

import cv2
import sys, os
import pandas as pd
import numpy as np
from keras.models import load_model

#KERAS_BACKEND=theano python haarMOD.py

BASEPATH = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, BASEPATH)
os.chdir(BASEPATH)
MODELPATH = './models/model.h5'


emotion_dict = {0: "Angry", 1: "Disgust", 2: "Fear", 3: "Happy", 4: "Sad", 5: "Surprise", 6: "Neutral"}

model = load_model(MODELPATH)

WHITE = [255, 255, 255]

def draw_box(Image, x, y, w, h):
    cv2.line(Image, (x, y), (x + int(w / 5), y), WHITE, 2)
    cv2.line(Image, (x + int((w / 5) * 4), y), (x + w, y), WHITE, 2)
    cv2.line(Image, (x, y), (x, y + int(h / 5)), WHITE, 2)
    cv2.line(Image, (x + w, y), (x + w, y + int(h / 5)), WHITE, 2)
    cv2.line(Image, (x, (y + int(h / 5 * 4))), (x, y + h), WHITE, 2)
    cv2.line(Image, (x, (y + h)), (x + int(w / 5), y + h), WHITE, 2)
    cv2.line(Image, (x + int((w / 5) * 4), y + h), (x + w, y + h), WHITE, 2)
    cv2.line(Image, (x + w, (y + int(h / 5 * 4))), (x + w, y + h), WHITE, 2)

haar_face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
video = cv2.VideoCapture('MovieSample.m4v')


while True:


    check, frame = video.read()


    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    faces = haar_face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5);
    for (x, y, w, h) in faces:
        gray_face = cv2.resize((gray[y:y + h, x:x + w]), (110, 110))
        draw_box(gray, x, y, w, h)
        roi_gray = gray[y:y + h, x:x + w]
        cropped_img = np.expand_dims(np.expand_dims(cv2.resize(roi_gray, (48, 48)), -1), 0)
        cv2.normalize(cropped_img, cropped_img, alpha=0, beta=1, norm_type=cv2.NORM_L2, dtype=cv2.CV_32F)
        prediction = model.predict(cropped_img)
        cv2.putText(gray, emotion_dict[int(np.argmax(prediction))], (x, y), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (WHITE), 1, cv2.LINE_AA)

    cv2.imshow("Face Detector", gray)
    cv2.waitKey(1)

    key = cv2.waitKey(1)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break


video.release()
cv2.destroyAllWindows()

Any tips are greatly appreciated, I am running Linux Mint based on Ubuntu 18.3 with Anaconda 3.6 on CPU with these steps from machine learning mastery to build the deep learning library. I am also using a .AVI file instead of a webcam because I dont have a webcam on my PC. Change the video = cv2.VideoCapture('MovieSample.m4v') to video = cv2.VideoCapture(0) for openCV to default to a USB camera.

https://machinelearningmastery.com/setup-python-environment-machine-learning-deep-learning-anaconda/

The error that pops up for me is line 17 model = load_model(MODELPATH) if on CPU, do you have a BLAS library installed Theano can link against? Can someone give a tip on how to trouble shoot that??

ANSWER

Answered 2018-Aug-02 at 15:54

I got the code to work on a Windows machine by editing the .json file on my C drive C:\Users\user\.keras to reference "theano" instead of "tenserflow"

{
    "floatx": "float32",
    "epsilon": 1e-07,
    "backend": "theano",
    "image_data_format": "channels_last"
}

And then adding in this bit of additional code that I found in a different stackoverflow post to my original .py file

import theano
theano.config.optimizer="None"

Source https://stackoverflow.com/questions/51655266

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install face_classification

You can download it from GitHub.
You can use face_classification like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Reuse Pre-built Kits with face_classification
Compare Computer Vision Libraries with Highest Support
Compare Computer Vision Libraries with Highest Security
Compare Computer Vision Libraries with Permissive License
Compare Computer Vision Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.