Skip to content

Logeswaran123/The-Masked-Man

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👺😷 The Masked Man 🎃🥸

License: MIT

An application that overlays a mask on the human face using mediapipe face mesh model.

Description 📜

  • Use MakeSense annotation tool to annaotate the mask.
  • Refer Mask annotated image for all the key points.
  • Refer utils/const.py for three modes of mask annotations and their corresponding key points.
    FULL_FACE - For masks that cover entire face.
    HALF_FACE - For masks that cover half of the face.
    BEARD_FACE - For masks thar cover beard area.
  • Annotate the mask based on the required mode of mask.
  • Place the mask png image and annotations csv files in /data/masks dir.
  • Ensure the mask image and annotations csv files have same filename.
  • Add the mask png image filename in MASK dict in utils/const.py.

General Requirements 🧙‍♂️

  1. Record a video of person or enable a live cam.
  2. Place the camera horizontally facing the person.
  3. Higher the resolution of input video, higher the quality of result.

Code Requirements 🧙‍♀️

pip install -r requirements.txt

How to run 🏃‍♂️

python themaskedman.py --video <path to video file> --face <face mode> --mask <mask number> --mesh <face mesh>

Note:

<path to video file> - Path to the input video file. If not provided, enable webcam.
<face mode> - Face mode mentioning single face or multiple faces. Choices: "single" or "multi". Default: single
<mask number> - Mask number corresponding to mask key of MASK dict in utils/const.py. Random mask if argument not provided.
<face mesh> - Add face mesh on detected faces. Choices: "True" or "False". Default: False

Results 📊

Multiface

python themaskedman.py --video <path to video file> --mask 6 --face multi --mesh True

Note:
--mask 6 -> 6 corresponds to pikachu.png in MASK dict.

output_multi.mp4

Input video source here.

Live Cam demo

python themaskedman.py
live_demo_1.mp4

live_demo_2.mp4

Fun demo (Spoilers ahead:warning:)

python themaskedman.py --video <path to video file> --mask 6 --face single --mesh True
out_i_am_your_father_1.mp4

References 📄

Happy Learning! 😄

About

An application that overlays a mask on the face.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages