Coder Social home page Coder Social logo

facial-recognition-client-server's Introduction

Facial Recognition

This repository contains code that allows you to run this facial recognition script locally, or from a client-server model.

Installation

dlib Requirements (Windows)

If you are on Mac or Linux you can skip this step...

Build Tools Install GUI

dlib can be challenging to install on Windows. If you are having trouble try looking through this Stack Overflow Issue

dlib Requirements (Ubuntu/Mac)

Refer to this guide for help installing dlib on Mac/Linux:

Install Python Packages

Start by cloning this repository: git clone <repo-url> then cd <repo-directory>

To install the required packages ensure you are using Python 3.7+ and run the command:

  • pip install -r requirements.txt (Windows) or
  • pip3 install -r requirements.txt (Mac/Linux)

Running The Code

Running The Code Locally

Assuming all of the packages are installed correctly you should be able to run the code locally.

  • Change directories into the /tutorial folder: cd tutorial
  • Execute the python script face_rec.py: python face_rec.py or python3 face_rec.py
  • Wait, and press q to quit the window!

If you'd like to change the image the faces are being predicted for simply download a new image and set the path on line 55 from face_rec.py:

print(classify_face("test-image.jpg"))

Running With Client/Server

Running the code from the client/server model is slightly more complicated.

  • Start by running the flask backend server.

  • Change directories to /server: cd server

  • Start the API server: python main.py or python3 main.py (take note of the port it is running on, default is 5000)

  • Now that the server is running you can change to the /client directory: cd ../client

  • If necessary adjust the URL on line 13 of client.py to specify the correct port.

  • From the client directory run client.py: python client.py or python3 client.py

If you'd like to change the image the faces are being predicted for simply download a new image and set the path on line 14 from client.py:

my_img = {'image': open('test-image.jpg', 'rb')} # feel free to change the image path here

Customization

Adding Faces

To add more faces to be detected simply add a labelled .jpg or .png file to the /faces directory. If you were to add an image of Tim (me!) you would simply save the image as tim.png (or tim.jpg).

Deployment

If you're intersted in deploying the flask server have a look at this Repository and this YouTube Video

facial-recognition-client-server's People

Contributors

kempeter avatar techwithtim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.