Using modified BiSeNet for face parsing in PyTorch

Overview

face-parsing.PyTorch

Contents

Training

  1. Prepare training data: -- download CelebAMask-HQ dataset

    -- change file path in the prepropess_data.py and run

python prepropess_data.py
  1. Train the model using CelebAMask-HQ dataset: Just run the train script:
    $ CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 train.py

If you do not wish to train the model, you can download our pre-trained model and save it in res/cp.

Demo

  1. Evaluate the trained model using:
# evaluate using GPU
python test.py

Face makeup using parsing maps

face-makeup.PyTorch

  Hair Lip
Original Input Original Input Original Input
Color Color Color

References

Comments
  • Key already registered with the same priority: GroupSpatialSoftmax

    Key already registered with the same priority: GroupSpatialSoftmax

    When I am running the code from the following command

    python test.py
    

    Then I am getting just the following output: Key already registered with the same priority: GroupSpatialSoftmax

    Please help me.

    opened by mayanktiwariiiitdmj 2
  • where can I find all label

    where can I find all label

    like

        table = {
            'hair': 17,
            'upper_lip': 12,
            'lower_lip': 13
        }
    

    Looks different from celebamask-hq

    • Mask labels are defined as following:

    | Label list | | | | --- | --- | --- | | 0: 'background' | 1: 'skin' | 2: 'nose' | | 3: 'eye_g' | 4: 'l_eye' | 5: 'r_eye' | | 6: 'l_brow' | 7: 'r_brow' | 8: 'l_ear' | | 9: 'r_ear' | 10: 'mouth' | 11: 'u_lip' | | 12: 'l_lip' | 13: 'hair' | 14: 'hat' | | 15: 'ear_r' | 16: 'neck_l' | 17: 'neck' | | 18: 'cloth' | | |

    opened by zhangqijun 2
  • How to you implement Resnet?

    How to you implement Resnet?

    In your code, you import Resnet18, but there is no publicly available library for PyTorch that provides this net. Which repository have you used to be able to run this code:

    from resnet import Resnet18 class ContextPath(nn.Module): def init(self, *args, **kwargs): super(ContextPath, self).init() #self.resnet = ResNet.from_name("resnet18") self.resnet = Resnet18() self.arm16 = AttentionRefinementModule(256, 128) self.arm32 = AttentionRefinementModule(512, 128) self.conv_head32 = ConvBNReLU(128, 128, ks=3, stride=1, padding=1) self.conv_head16 = ConvBNReLU(128, 128, ks=3, stride=1, padding=1) self.conv_avg = ConvBNReLU(512, 128, ks=1, stride=1, padding=0) self.init_weight()

    I have tried installing pytorch_resnet, but the implementation is different. Installing resnet from Python PIP leads to a dependency problem with Tensorflow. The following error is thrown if attempting to use pytorch-resnet:

    File "/SAFA/face_parsing/model.py", line 112, in forward feat8, feat16, feat32 = self.resnet(x) ValueError: not enough values to unpack (expected 3, got 1)

    This project does not indicate how Resnet has been implemented. How have you installed it on your system? Please advise.

    opened by VisionaryMind 1
  • The test result

    The test result

    I change the image size here:

    image

    But I get a completely different result?

    128*128

    image

    512*512

    image

    Why is that? I just resized the image.

    Looking forward to your answer!

    opened by xieyipeng 1
  • unexpected EOF, expected 3832831 more bytes

    unexpected EOF, expected 3832831 more bytes

    Hi Team, While using the pretrained model I am getting the above error on running test.py. Upon searching on the internet I got that it might be due to corrupted model file. Is it so? Please guide about the cause and solution of this error. Below is an image of the error. image

    opened by AnjaliSinghTW 0
  • Reference for usage in paper

    Reference for usage in paper

    Hi,

    Thanks for your great work. I used your face parse network as part of an upcoming academic contribution. Do you have a preferred paper that I should cite?

    opened by mjvanderboon 0
Owner
zll
Deep Learning & Computer Vision.
zll
Pytorch-Swin-Unet-V2 - a modified version of Swin Unet based on Swin Transfomer V2

Swin Unet V2 Swin Unet V2 is a modified version of Swin Unet arxiv based on Swin

Chenxu Peng 26 Dec 3, 2022
Realtime Face Anti Spoofing with Face Detector based on Deep Learning using Tensorflow/Keras and OpenCV

Realtime Face Anti-Spoofing Detection ?? Realtime Face Anti Spoofing Detection with Face Detector to detect real and fake faces Please star this repo

Prem Kumar 86 Aug 3, 2022
Swapping face using Face Mesh with TensorFlow Lite

Swapping face using Face Mesh with TensorFlow Lite

iwatake 17 Apr 26, 2022
Face-Recognition-Attendence-System - This face recognition Attendence system using Python

Face-Recognition-Attendence-System I have developed this face recognition Attend

Riya Gupta 4 May 10, 2022
A modified version of DeepMind's Alphafold2 to divide CPU part (MSA and template searching) and GPU part (prediction model)

ParallelFold Author: Bozitao Zhong This is a modified version of DeepMind's Alphafold2 to divide CPU part (MSA and template searching) and GPU part (p

Bozitao Zhong 77 Dec 22, 2022
Modified fork of Xuebin Qin's U-2-Net Repository. Used for demonstration purposes.

U^2-Net (U square net) Modified version of U2Net used for demonstation purposes. Paper: U^2-Net: Going Deeper with Nested U-Structure for Salient Obje

Shreyas Bhat Kera 13 Aug 28, 2022
Robbing the FED: Directly Obtaining Private Data in Federated Learning with Modified Models

Robbing the FED: Directly Obtaining Private Data in Federated Learning with Modified Models This repo contains a barebones implementation for the atta

null 16 Dec 4, 2022
OBBDetection: an oriented object detection toolbox modified from MMdetection

OBBDetection note: If you have questions or good suggestions, feel free to propose issues and contact me. introduction OBBDetection is an oriented obj

MIXIAOXIN_HO 3 Nov 11, 2022
U-2-Net: U Square Net - Modified for paired image training of style transfer

U2-Net: U Square Net Modified for paired image training of style transfer This is an unofficial repo making use of the code which was made available b

Doron Adler 43 Oct 3, 2022
img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation

img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation Figure 1: We estimate the 6DoF rigid transformation of a 3D face (rendered in si

VĂ­tor Albiero 519 Dec 29, 2022
Code for HLA-Face: Joint High-Low Adaptation for Low Light Face Detection (CVPR21)

HLA-Face: Joint High-Low Adaptation for Low Light Face Detection The official PyTorch implementation for HLA-Face: Joint High-Low Adaptation for Low L

Wenjing Wang 77 Dec 8, 2022
DVG-Face: Dual Variational Generation for Heterogeneous Face Recognition, TPAMI 2021

DVG-Face: Dual Variational Generation for HFR This repo is a PyTorch implementation of DVG-Face: Dual Variational Generation for Heterogeneous Face Re

null 52 Dec 30, 2022
[TIP 2021] SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction

SADRNet Paper link: SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction Requirements python

Multimedia Computing Group, Nanjing University 99 Dec 30, 2022
Face Synthetics dataset is a collection of diverse synthetic face images with ground truth labels.

The Face Synthetics dataset Face Synthetics dataset is a collection of diverse synthetic face images with ground truth labels. It was introduced in ou

Microsoft 608 Jan 2, 2023
Face Library is an open source package for accurate and real-time face detection and recognition

Face Library Face Library is an open source package for accurate and real-time face detection and recognition. The package is built over OpenCV and us

null 52 Nov 9, 2022
VGGFace2-HQ - A high resolution face dataset for face editing purpose

The first open source high resolution dataset for face swapping!!! A high resolution version of VGGFace2 for academic face editing purpose

Naiyuan Liu 232 Dec 29, 2022
Python tools for 3D face: 3DMM, Mesh processing(transform, camera, light, render), 3D face representations.

face3d: Python tools for processing 3D face Introduction This project implements some basic functions related to 3D faces. You can use this to process

Yao Feng 2.3k Dec 30, 2022
AI Face Mesh: This is a simple face mesh detection program based on Artificial intelligence.

AI Face Mesh: This is a simple face mesh detection program based on Artificial Intelligence which made with Python. It's able to detect 468 different

Md. Rakibul Islam 1 Jan 13, 2022
Video-face-extractor - Video face extractor with Python

Python face extractor Setup Create the srcvideos and faces directories Put your

null 2 Feb 3, 2022