https://github.com/boyizhao/livefaceidapp
Simple Live Face Recognition Streamlit App
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.1%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Simple Live Face Recognition Streamlit App
Basic Info
- Host: GitHub
- Owner: BoyiZhao
- Language: Python
- Default Branch: main
- Size: 14.5 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Fork of Martlgap/livefaceidapp
Created about 2 years ago
· Last pushed about 2 years ago
https://github.com/BoyiZhao/livefaceidapp/blob/main/
# Live Face Recognition App This is a Streamlit App that allows you to recognize faces in a live webcam video stream. Check out the app on the [Streamlit Community Cloud](https://streamlit.io/cloud) by clicking on the badge below: [](https://livefaceid.streamlit.app) [](https://www.python.org/downloads/release/python-380/) [](https://opensource.org/licenses/MIT) [](https://img.shields.io/github/last-commit/martlgap/livefaceidapp) [](https://github.com/psf/black) # Example As an example, instead of using a webcam I fed a snippet of BigBangTheory into the app and it recognized the characters in real-time:  # Usage ## Run the App on Streamlit Community Cloud You can run my app in your Browser using the [Streamlit Community Cloud](https://streamlit.io/cloud) by clicking on the badge below: [](https://livefaceid.streamlit.app) ## Locally on your machine (Tested on MacOS, Linux) You can run the app locally on your machine by cloning this repository and running the following commands: ```bash git clone https://github.com/Martlgap/livefaceidapp.git cd livefaceidapp pip -m venv venv source venv/bin/activate pip install -r requirements.txt streamlit run main.py ``` Depending on platform and hardware you need to install onnxruntime, onnxruntime-gpu, or onnxruntime-silicon. ## Locally on server (Tested on Linux) If you want to run the app on a server in your local network and would like to access it from another machine in the same network, you can use the [ssl-proxy](https://github.com/suyashkumar/ssl-proxy) plugin of [suyashkumar](https://github.com/suyashkumar): ```bash wget https://github.com/suyashkumar/ssl-proxy/releases/download/v0.2.7/ssl-proxy-linux-amd64.tar.gz gzip -d ssl-proxy-linux-amd64.tar.gz tar -xvf ssl-proxy-linux-amd64.tar ./ssl-proxy-linux-amd64 -from 0.0.0.0:8502 -to 0.0.0.0:8501 ``` After that you are able to access the app in your browser via https://your-server-ip:8502 # Streaming Servers For beeing able to use the app on the Streamlit Communnity Cloud, I set up a TWILIO TURN server with my credentials. Those are saved in the streamlit community cloud secrets, which is not included in this repository. If you want to use the app on your own server, you have to set up your own TURN server. You can find a detailed description on how to do that [here](https://www.twilio.com/docs/stun-turn). You can set your own credentials by exporting them as environment variables: ```bash export TWILIO_ACCOUNT_SID=your-twilio-account-sid export TWILIO_AUTH_TOKEN=your-twilio-auth-token ``` # How it Works A detailed description of the implementation can be found here: [](https://martlgap.medium.com/529fc686b475) # Machine Learning Models The app uses the following machine learning models: - Face Detection: FaceMesh ([MediaPipe](https://google.github.io/mediapipe/solutions/face_mesh.html)) - Face Recognition: [MobileNetV2](https://arxiv.org/abs/1801.04381) Architecture, trained with [MS1M](https://arxiv.org/abs/1607.08221) dataset and [ArcFace](https://arxiv.org/abs/1801.07698) Loss using [Tensorflow](https://tensorflow.org), converted to [ONNX](https://onnxruntime.ai) # About I developed this app during a project at the [Chair of Human-Machine Communication](https://www.ce.cit.tum.de/en/mmk/home/). The goal was to compare live face recognition systems across different platforms. # Resources Please take a look at the following resources, which helped me a lot during the development of this app: - [Streamlit](https://streamlit.io/) - [Streamlit Community](https://discuss.streamlit.io/) - [Streamlit Webrtc](https://github.com/whitphx/streamlit-webrtc) - [ssl-proxy](https://github.com/suyashkumar/ssl-proxy) - [MediaPipe](https://mediapipe-studio.webapps.google.com/home) - [aiortc](https://github.com/aiortc/aiortc) - [WebRTC](https://webrtc.org/) - [WebRTC Samples](https://webrtc.github.io/samples/) - [Deployment](https://www.artefact.com/blog/how-to-deploy-and-secure-your-streamlit-app-on-gcp/) - [Real-Time-Video-Streams](https://betterprogramming.pub/real-time-video-streams-with-streamlit-webrtc-bd38d15f2ef3) # BUGS - KNOWN ISSUES - TODOS: - [ ] Running the app on streamlit community cloud introduces a severe lag/delay in the video stream. This is also present when working with the app locally on a server. There should be a way to reduce the delay, either by setting the buffer size smaller or by using frame dropping. - [ ] There is also sometimes a lag when running the app locally on your machine. This is due to several reasons and need to be investigated further. - [ ] Aspect ratio bug on smartphone
Owner
- Name: Boyi Zhao
- Login: BoyiZhao
- Kind: user
- Location: ChongQing
- Company: Southwest University
- Website: https://www.blog-yukung.top/
- Repositories: 2
- Profile: https://github.com/BoyiZhao
Student at SWU. Incoming student at ShanghaiTech University