1 Star 5 Fork 1

cubone/learnopencv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Using Facial Landmarks for Overlaying Faces with Medical Masks

This repository contains the code for Using Facial Landmarks for Overlaying Faces with Masks blog post.

Most of the code is based on the HRNet-Facial-Landmark-Detection repository, huge thanks to them.

Quick start

Environment

This code is developed using Python 3.6 and PyTorch 1.0.0 on Ubuntu 16.04 with NVIDIA GPU. Other platforms or GPUs are not fully tested.

Installation

  1. Create virtual environment:

You'll need to install virtualenv package if you don't have it:

pip install virtualenv
virtualenv -p python3.6 venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. You will also need the pre-trained weights, which you can take from here HR18-300W.pth:
wget -O HR18-300W.pth https://pscm7q.by.files.1drv.com/y4m1ndEsUHxWtszPoyHY2BQ2Zdvh0-dgYW_5dtTcxX_YFP8p5YYADNSndm3tAj2f-U4aMPMuS6-VyMvWaCYaO2otLab4XWblhouZkbuIgzr3ZGem6A2b1Lm6Kb3WrYQL_m3D2hj8Y3ulD06kXpvsvsoN-YlmXd9NK12snBfQxrgQf7OVXYsP1xWJEZfN_1CKdLPl1xYNaNvCeQik5LiCnmB9g

Run Demo

To run the demo, you need to execute the following command in your terminal:

python3 overlay_with_mask.py --cfg experiments/300w/face_alignment_300w_hrnet_w18.yaml --landmark_model HR18-300W.pth --mask_image masks/anti_covid.png

Try out different masks from the masks folder or use yours, but don't forget to annotate them first.

AI Courses by OpenCV

Want to become an expert in AI? AI Courses by OpenCV is a great place to start.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cubone/learnopencv.git
git@gitee.com:cubone/learnopencv.git
cubone
learnopencv
learnopencv
master

搜索帮助