face property detection pytorch

Overview

face-property-detection-pytorch

Python Python torch

1. Data structure

The structure of landmarks_jpg is like below:

|--celeba1
|----celeba_face
|------000001.jpg
|------000002.jpg
|------ .....
|------020000.jpg
|----celeba_raw_pic
|------000001.jpg
|------000002.jpg
|------ .....
|------020000.jpg

The celeba_raw_pic is the original picture that we do not make any processing. The celeba_face is the face region of the raw pricture.

img2.png

figure1: raw picture

img1.png

figure2: face region of raw picture

You can run the below command to finish the data processing.

python3 create_data.py 

This command will use MTCNN model to extract the face region. However, some pictures cannot be extracted by the model. For my test, I can not cut out the face region of the below picture.

# file 000199.jpg cannot detect face
# file 001401.jpg cannot detect face
# file 002214.jpg cannot detect face
# file 002432.jpg cannot detect face
# file 002920.jpg cannot detect face
# file 003928.jpg cannot detect face
# file 003946.jpg cannot detect face
# file 004932.jpg cannot detect face
# file 005283.jpg cannot detect face
# file 006010.jpg cannot detect face
# file 006531.jpg cannot detect face
# file 007726.jpg cannot detect face
# file 008287.jpg cannot detect face
# file 011529.jpg cannot detect face
# file 011793.jpg cannot detect face
# file 013374.jpg cannot detect face
# file 013654.jpg cannot detect face
# file 014999.jpg cannot detect face
# file 016530.jpg cannot detect face
# file 016797.jpg cannot detect face
# file 017282.jpg cannot detect face
# file 017586.jpg cannot detect face
# file 018309.jpg cannot detect face
# file 018599.jpg cannot detect face
# file 018884.jpg cannot detect face
# file 019205.jpg cannot detect face
# file 019377.jpg cannot detect face

So I replace them with 000001.jpg. Also, I revise the label file list_attr_celeba.txt. Replace the issue items with 000001.jpg and I get the list_attr_celeba-face.txt You can use BeyondCompare to diff the changes that I make img.png

You can download the data from the cloud drive:

name link
celeba_face.zip https://pan.baidu.com/s/15nsbvla8eCy_n3EsUMH36Q code:5ipn
celeba_raw_pic.zip https://pan.baidu.com/s/1WM3Zo3zLfKsAFvrDl03suQ code:3q70

2. how to train

First, install the third-party package:

pip install -r requirements.txt

Then just simply run the below command:

python3 train.py

if you want to use the pretrained models, you can revise the below code as you need:

load_pretrain_model = False
model_dir=r".\pretrain_models\model-resnet-50-justface-state.ptn"
if load_pretrain_model:
    checkpoint = torch.load(model_dir)
    model.load_state_dict(checkpoint)

3. how to test

Revise the test file name in predict.py and then run the below command:

python3 predict.py
Owner
i am x
i am x
一些经典的CTR算法的复现; LR, FM, FFM, AFM, DeepFM,xDeepFM, PNN, DCN, DCNv2, DIFM, AutoInt, FiBiNet,AFN,ONN,DIN, DIEN ... (pytorch, tf2.0)

CTR Algorithm 根据论文, 博客, 知乎等方式学习一些CTR相关的算法 理解原理并自己动手来实现一遍 pytorch & tf2.0 保持一颗学徒的心! Schedule Model pytorch tensorflow2.0 paper LR ✔️ ✔️ \ FM ✔️ ✔️ Fac

luo han 149 Dec 20, 2022
Implementation of ViViT: A Video Vision Transformer

ViViT: A Video Vision Transformer Unofficial implementation of ViViT: A Video Vision Transformer. Notes: This is in WIP. Model 2 is implemented, Model

Rishikesh (ऋषिकेश) 297 Jan 06, 2023
Python Single Object Tracking Evaluation

pysot-toolkit The purpose of this repo is to provide evaluation API of Current Single Object Tracking Dataset, including VOT2016 VOT2018 VOT2018-LT OT

348 Dec 22, 2022
Repository for training material for the 2022 SDSC HPC/CI User Training Course

hpc-training-2022 Repository for training material for the 2022 SDSC HPC/CI Training Series HPC/CI Training Series home https://www.sdsc.edu/event_ite

sdsc-hpc-training-org 21 Jul 27, 2022
Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

235 Dec 26, 2022
Simulation of the solar system using various nummerical methods

solar-system Simulation of the solar system using various nummerical methods Download the repo Make shure matplotlib, scipy etc. are installed execute

Caspar 7 Jul 15, 2022
A machine learning package for streaming data in Python. The other ancestor of River.

scikit-multiflow is a machine learning package for streaming data in Python. creme and scikit-multiflow are merging into a new project called River. W

670 Dec 30, 2022
Codes and pretrained weights for winning submission of 2021 Brain Tumor Segmentation (BraTS) Challenge

Winning submission to the 2021 Brain Tumor Segmentation Challenge This repo contains the codes and pretrained weights for the winning submission to th

94 Dec 28, 2022
[CVPR 2021 Oral] Variational Relational Point Completion Network

VRCNet: Variational Relational Point Completion Network This repository contains the PyTorch implementation of the paper: Variational Relational Point

PL 121 Dec 12, 2022
Official implementation of the method ContIG, for self-supervised learning from medical imaging with genomics

ContIG: Self-supervised Multimodal Contrastive Learning for Medical Imaging with Genetics This is the code implementation of the paper "ContIG: Self-s

Digital Health & Machine Learning 22 Dec 13, 2022
The first public PyTorch implementation of Attentive Recurrent Comparators

arc-pytorch PyTorch implementation of Attentive Recurrent Comparators by Shyam et al. A blog explaining Attentive Recurrent Comparators Visualizing At

Sanyam Agarwal 150 Oct 14, 2022
Machine Learning Privacy Meter: A tool to quantify the privacy risks of machine learning models with respect to inference attacks, notably membership inference attacks

ML Privacy Meter Machine learning is playing a central role in automated decision making in a wide range of organization and service providers. The da

Data Privacy and Trustworthy Machine Learning Research Lab 357 Jan 06, 2023
This library provides an abstraction to perform Model Versioning using Weight & Biases.

Description This library provides an abstraction to perform Model Versioning using Weight & Biases. Features Version a new trained model Promote a mod

Hector Lopez Almazan 2 Jan 28, 2022
Pytorch Implementation of Zero-Shot Image-to-Text Generation for Visual-Semantic Arithmetic

Pytorch Implementation of Zero-Shot Image-to-Text Generation for Visual-Semantic Arithmetic [Paper] [Colab is coming soon] Approach Example Usage To r

170 Jan 03, 2023
Machine learning evaluation metrics, implemented in Python, R, Haskell, and MATLAB / Octave

Note: the current releases of this toolbox are a beta release, to test working with Haskell's, Python's, and R's code repositories. Metrics provides i

Ben Hamner 1.6k Dec 26, 2022
This repo contains the code for paper Inverse Weighted Survival Games

Inverse-Weighted-Survival-Games This repo contains the code for paper Inverse Weighted Survival Games instructions general loss function (--lfn) can b

3 Jan 12, 2022
Instance Segmentation by Jointly Optimizing Spatial Embeddings and Clustering Bandwidth

Instance segmentation by jointly optimizing spatial embeddings and clustering bandwidth This codebase implements the loss function described in: Insta

209 Dec 07, 2022
Implementation of ConvMixer in TensorFlow and Keras

ConvMixer ConvMixer, an extremely simple model that is similar in spirit to the ViT and the even-more-basic MLP-Mixer in that it operates directly on

Sayan Nath 8 Oct 03, 2022
Unofficial implementation of Proxy Anchor Loss for Deep Metric Learning

Proxy Anchor Loss for Deep Metric Learning Unofficial pytorch, tensorflow and mxnet implementations of Proxy Anchor Loss for Deep Metric Learning. Not

Geonmo Gu 3 Jun 09, 2021