Description • Getting Started • System Details • Results • Make It More Fun • References
Googly Eyes is a fun project that adds a touch of humour to faces by making them look funnier with googly eyes.
- Install docker
- Navigate to the project directory:
cd googly-eyes
- Run application:
docker-compose up --build
- And go to http://localhost:8501
- Install poetry
- Navigate to the project directory:
cd googly-eyes
- Install necessary dependencies:
poetry config virtualenvs.in-project true
poetry install
- Run the backend server
poetry run uvicorn googly_eyes.backend.server:app --reload
- On new terminal, run the frontend viewer:
cd googly-eyes/googly_eyes/frontend
poetry run streamlit run view.py
- And go to http://localhost:8501
FastAPI docs
Go to http://localhost:8000/docs to see and try available backend api
- Install poetry
- Navigate to the project directory:
cd googly-eyes
- Install necessary dependencies:
poetry config virtualenvs.in-project true
poetry install
- Run example python script:
poetry run python example.py <path-to-image-file>
The backend system handles the googlification of eyes with the following steps:
- Detects faces using BlazeFace.
- Extracts facial landmarks using FaceMesh for all detected faces.
- Googlify eyes
- Extracts eyes - eye centers and eye sizes; this is randomized to make it fun.
- Adds a googly eyes image filter based on the extracted eye centers and sizes, with random rotation for added humor.
The frontend is a Streamlit viewer providing an interactive interface for users to enjoy the googly eyes effect on faces.
There's a config file available! Check out config.yaml and feel free to experiment with the variables. These variables have specific roles:
- Variables under
face_detection_settings
:score_threshold
- face detection confidence score between 0 and 1. A higher value may result in more accurate but fewer detections.iou_threshold
- intersection over union threshold for face detection to balance precision and recall, value between 0 and 1.
- Variables under
googly_eye_settings
:path
- image path to googly eye image filtersize_multiplier
- value to scale to get bigger googly eyessize_inc_percent
- to control the maximum random increase in each googly eye's sizecentre_offset_percent
- to change the offset of the googly eyes' centres, makes the googly eyes placement more dynamic.
author: Shubham M Wagh