GithubHelp home page GithubHelp logo

liveness_vit's Introduction

liveness_vit

Liveness detection using ViT model

ViT model:

  • cpu: < 10 FPS
  • gpu: 60 FPS

Resnet50 model:

  • cpu: < 30 fps
  • gpu: < 70 FPS

Set up NGINX

Here I have 2 servers in localhost:8091 and localhost:8092. Then I will use NGINX as an API gatway or load balancer

First, I have config to run the server using wsgi server called waitress pip install waitress

Then setup NGINX docker container run -p 8090:80 --name nginx_tutorial nginx docker container exec -it nginx_tutorial bash apt-get update apt-get install nano nano nginx.conf

The set up is as this link: https://viblo.asia/p/cau-hinh-nginx-server-nhu-the-nao-ByEZko0xZQ0

Then we modify the nginx.conf file

  events {
  
  }
  
  http {
  
      upstream backend_servers {
          server your_host:8091;
          server your_host:8092;
      } 
  
      server {
          listen 80;
          server_name nginx-tutorial.test;
  
          location / {
              proxy_pass http://backend_servers;
              proxy_set_header Host $host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
          }       
      }
  }

We have to add 1 more line in the file etc/hosts like this

127.0.0.1 nginx-tutorial.test

Reference: https://viblo.asia/p/load-balancing-voi-nginx-bWrZnVxnZxw

Then run:

  python src/api.py
  python src/api_2.py
  python src/test_api.py 

We can see that the port is changing over time -> success

liveness_vit's People

Contributors

mrzaizai2k avatar

Stargazers

 avatar

Watchers

 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.