insightface | State-of-the-art 2D and 3D Face Analysis Project | Computer Vision library

 by   deepinsight Python Version: 0.7.3 License: MIT

kandi X-RAY | insightface Summary

kandi X-RAY | insightface Summary

insightface is a Python library typically used in Artificial Intelligence, Computer Vision, Deep Learning, Pytorch applications. insightface has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install insightface' or download it from GitHub, PyPI.

InsightFace is an open source 2D&3D deep face analysis toolbox, mainly based on PyTorch and MXNet. Please check our website for detail. The master branch works with PyTorch 1.6+ and/or MXNet=1.6-1.8, with Python 3.x. InsightFace efficiently implements a rich variety of state of the art algorithms of face recognition, face detection and face alignment, which optimized for both training and deployment.

            kandi-support Support

              insightface has a medium active ecosystem.
              It has 15968 star(s) with 4423 fork(s). There are 479 watchers for this library.
              There were 3 major release(s) in the last 12 months.
              There are 883 open issues and 1314 have been closed. On average issues are closed in 931 days. There are 24 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of insightface is 0.7.3

            kandi-Quality Quality

              insightface has 0 bugs and 0 code smells.

            kandi-Security Security

              insightface has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              insightface code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              insightface is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              insightface releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              insightface saves you 18984 person hours of effort in developing the same functionality from scratch.
              It has 93157 lines of code, 3661 functions and 750 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed insightface and discovered the below as its top functions. This is intended to give you an instant insight into insightface implemented functionality, and help decide if they suit your requirements.
            • Get resnet conv layer .
            • Gets the convolution layer .
            • Assign anchors to the image .
            • Get output for convolution .
            • get the SSH convolution layer
            • get crop image2
            • Main function .
            • Train network .
            • Parse command line arguments
            • Test for bad case .
            Get all kandi verified functions for this library.

            insightface Key Features

            No Key Features are available at this moment for insightface.

            insightface Examples and Code Snippets

            InsightFace in OneFlow,Preparations,Data preparations
            Pythondot img1Lines of Code : 68dot img1no licencesLicense : No License
            copy iconCopy
            ​    train.idx
            ​    train.rec
            ​    property
            ​    lfw.bin
            ​    cfp_fp.bin
            ​    agedb_30.bin
            python tools/  --data_dir datasets/faces_emore --output_filepath faces_emore/ofrecord/train --part_  
            Step3: Extract embedding
            C++dot img2Lines of Code : 56dot img2no licencesLicense : No License
            copy iconCopy
                ├── dlib-19.17
                │   ├── models
                │       ├── dlib_face_recognition_resnet_model_v1.dat
                │       └── shape_predictor_5_face_landmarks.dat
                ├── facenet
                │   ├── models  
            Pythondot img3Lines of Code : 29dot img3License : Permissive (MIT)
            copy iconCopy
            pip install retina-face
            from retinaface import RetinaFace
            resp = RetinaFace.detect_faces("img1.jpg")
                "face_1": {
                    "score": 0.9993440508842468,
                    "facial_area": [155, 81, 434, 443],
                    "landmarks": {
                      "right_eye": [2  
            insightface - mxnet to onnx
            Pythondot img4Lines of Code : 142dot img4License : Permissive (MIT License)
            copy iconCopy
            import sys
            import os
            import argparse
            import onnx
            import json
            import mxnet as mx
            from onnx import helper
            from onnx import TensorProto
            from onnx import numpy_helper
            import onnxruntime
            import cv2
            print('mxnet version:', mx.__version__)
            print('onnx vers  
            insightface - scrfd person
            Pythondot img5Lines of Code : 44dot img5License : Permissive (MIT License)
            copy iconCopy
            import datetime
            import numpy as np
            import os
            import os.path as osp
            import glob
            import cv2
            import insightface
            assert insightface.__version__>='0.4'
            def detect_person(img, detector):
                bboxes, kpss = detector.detect(img)
                bboxes = np.round(b  
            insightface - inswapper main
            Pythondot img6Lines of Code : 29dot img6License : Permissive (MIT License)
            copy iconCopy
            import datetime
            import numpy as np
            import os
            import os.path as osp
            import glob
            import cv2
            import insightface
            from import FaceAnalysis
            from import get_image as ins_get_image
            assert insightface.__version__>='0.7'
            OneHotEncoderunexpected keyword argument 'categorical_features'
            Pythondot img7Lines of Code : 14dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            #le = LabelEncoder()
            #labels = le.fit_transform(data["names"])
            #num_classes = len(np.unique(labels))
            #labels = labels.reshape(-1, 1)
            #one_hot_encoder = OneHotEncoder(categorical_features = [0])
            #labels = one_hot_encoder.fit_transform(label
            copy iconCopy
            face_imgs_resized = np.ones((128,224,224,3))
            face_imgs_resized = np.array(face_imgs_resized)
            face_imgs_resized = np.rollaxis(face_imgs_resized, 3, 1)
            data = mx.nd.array(face_imgs_resized)
            db =, 4))

            Community Discussions


            Memory leak (CPU's RAM) when using onnxruntime on GPU
            Asked 2021-Jul-16 at 11:16

            I'm using the Insightface library from Pypi (, the source code is here:

            When I run it on my GPU there is a severe memory leak of the CPU's RAM, over 40 GB until I stopped it (not the GPU memory).

            here is my script:



            Answered 2021-Jul-15 at 19:14

            I managed to solve it with the following setup:

            • Ubuntu-20.04
            • Python-3.8
            • Nvidia-470
            • Cuda-11.3
            • Cudnn-8
            • mxnet==1.8.0.post0
            • onnx==1.9.0
            • onnxruntime-gpu==1.8.1
            • insightface==0.4


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install insightface

            Please start with our python-package, for testing detection, recognition and alignment models on input images.


            Jia Guo, guojia[at]gmail.comJiankang Deng jiankangdeng[at]gmail.comXiang An anxiangsir[at]gmail.comJack Yu jackyu961127[at]
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • PyPI

            pip install insightface

          • CLONE
          • HTTPS


          • CLI

            gh repo clone deepinsight/insightface

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link