Git Product home page Git Product logo

pytorch-insightface's Introduction

Pytorch InsightFace

Pretrained ResNet models from deepinsight/insightface ported to pytorch.

Model LFW(%) CFP-FP(%) AgeDB-30(%) MegaFace(%)
iresnet34 99.65 92.12 97.70 96.70
iresnet50 99.80 92.74 97.76 97.64
iresnet100 99.77 98.27 98.28 98.47

Installation

pip install git+https://github.com/nizhib/pytorch-insightface

Usage

import torch
from imageio import imread
from torchvision import transforms

import insightface

embedder = insightface.iresnet100(pretrained=True)
embedder.eval()

mean = [0.5] * 3
std = [0.5 * 256 / 255] * 3
preprocess = transforms.Compose([
    transforms.ToTensor(),
    transforms.Normalize(mean, std)
])

face = imread('resource/sample.jpg')

tensor = preprocess(face)

with torch.no_grad():
    features = embedder(tensor.unsqueeze(0))[0]

print(features[:5])

Recreating the weights locally

Download the original insightface zoo weights and place *.params and *.json files to resource/{model}.

Run python scripts/convert.py to convert and test pytorch weights.

pytorch-insightface's People

Contributors

nizhib avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.