facenet-pytorch | Pretrained Pytorch face detection (MTCNN) and facial recognition (InceptionResnet) models | Computer Vision library

 by   timesler Python Version: 2.5.3 License: MIT

kandi X-RAY | facenet-pytorch Summary

kandi X-RAY | facenet-pytorch Summary

facenet-pytorch is a Python library typically used in Artificial Intelligence, Computer Vision, Pytorch, Tensorflow applications. facenet-pytorch 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 facenet-pytorch' or download it from GitHub, PyPI.

Pretrained Pytorch face detection (MTCNN) and facial recognition (InceptionResnet) models
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              facenet-pytorch has a medium active ecosystem.
              It has 3538 star(s) with 798 fork(s). There are 46 watchers for this library.
              There were 1 major release(s) in the last 12 months.
              There are 59 open issues and 104 have been closed. On average issues are closed in 225 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of facenet-pytorch is 2.5.3

            kandi-Quality Quality

              facenet-pytorch has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              facenet-pytorch 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

              facenet-pytorch 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.
              facenet-pytorch saves you 601 person hours of effort in developing the same functionality from scratch.
              It has 1401 lines of code, 74 functions and 10 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed facenet-pytorch and discovered the below as its top functions. This is intended to give you an instant insight into facenet-pytorch implemented functionality, and help decide if they suit your requirements.
            • Convert tensorflow to pytorch
            • Compares two tensorflow matrices
            • Compares two model outputs
            • Load weights from mdl
            • Load mixed7 weights
            • Load tf TensorNorm
            • Loads a batchNorm layer
            • Load tf2d layer
            • Detect faces in the given image
            • Extract an image from a box
            • Extracts the faces of the given image
            • Detects the face of the image
            • Detect the face of the image
            • Performs a batch of nms averaging
            • Compute the NMS algorithm
            • Detect the face of input images
            • Load pretrained weights
            • Download a URL to a file
            • Return the path to the torch library
            • Returns the path to the torch directory
            • Loads the TF block 35
            • Loads mixed6 weights
            • Loadtf blocks of 8 bits
            Get all kandi verified functions for this library.

            facenet-pytorch Key Features

            No Key Features are available at this moment for facenet-pytorch.

            facenet-pytorch Examples and Code Snippets

            训练步骤
            Pythondot img1Lines of Code : 8dot img1License : Permissive (MIT)
            copy iconCopy
            |-datasets
                |-people0
                    |-123.jpg
                    |-234.jpg
                |-people1
                    |-345.jpg
                    |-456.jpg
                |-...
              
            预测步骤,b、使用自己训练的权重
            Pythondot img2Lines of Code : 8dot img2License : Permissive (MIT)
            copy iconCopy
            _defaults = {
                "model_path"    : "model_data/facenet_mobilenet.pth",
                "input_shape"   : (160, 160, 3),
                "backbone"      : "mobilenet",
                "cuda"          : True,
            }
            
            img\1_001.jpg
            img\1_002.jpg
              
            预测步骤,a、使用预训练权重
            Pythondot img3Lines of Code : 4dot img3License : Permissive (MIT)
            copy iconCopy
            img\1_001.jpg
            img\1_002.jpg
              

            Community Discussions

            QUESTION

            Unexpected error when loading the model: problem in predictor - ModuleNotFoundError: No module named 'torchvision'
            Asked 2020-May-28 at 18:00

            I've been trying to deploy my model to the AI platform for Prediction through the console on my vm instance, but I've gotten the error "(gcloud.beta.ai-platform.versions.create) Create Version failed. Bad model detected with error: "Failed to load model: Unexpected error when loading the model: problem in predictor - ModuleNotFoundError: No module named 'torchvision' (Error code: 0)"

            I need to include both torch and torchvision. I followed the steps in this question Cannot deploy trained model to Google Cloud Ai-Platform with custom prediction routine: Model requires more memory than allowed, but I couldn't fetch the files pointed to by user gogasca. I tried downloading this .whl file from Pytorch website and uploading it to my cloud storage but got the same error that there is no module torchvision, even though this version is supposed to include both torch and torchvision. Also tried using Cloud AI compatible packages here, but they don't include torchvision.

            I tried pointing to two separate .whl files for torch and torchvision in the --package-uris arguments, those point to files in my cloud storage, but then I got the error that the memory capacity was exceeded. This is strange, because collectively their size is around 130Mb. An example of my command that resulted in absence of torchvision looked like this:

            ...

            ANSWER

            Answered 2020-May-23 at 15:19

            The solution was to place the following packages in thsetup.py file for the custom prediction code:

            Source https://stackoverflow.com/questions/61933879

            QUESTION

            ValueError: sampler option is mutually exclusive with shuffle pytorch
            Asked 2020-May-13 at 13:03

            i'm working on face recognition project using pytorch and mtcnn and after trained my training dataset , now i want to make prediction on test data set

            this my trained code

            ...

            ANSWER

            Answered 2020-Apr-04 at 19:49

            I'm not sure what format you test data is in but to select a sample randomly from your dataset, you can use random.choice from the module random.

            Source https://stackoverflow.com/questions/61033726

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

            Vulnerabilities

            No vulnerabilities reported

            Install facenet-pytorch

            In python, import facenet-pytorch and instantiate models:. See help(MTCNN) and help(InceptionResnetV1) for usage and implementation details.
            Install: # With pip: pip install facenet-pytorch # or clone this repo, removing the '-' to allow python imports: git clone https://github.com/timesler/facenet-pytorch.git facenet_pytorch # or use a docker container (see https://github.com/timesler/docker-jupyter-dl-gpu): docker run -it --rm timesler/jupyter-dl-gpu pip install facenet-pytorch && ipython
            In python, import facenet-pytorch and instantiate models: from facenet_pytorch import MTCNN, InceptionResnetV1 # If required, create a face detection pipeline using MTCNN: mtcnn = MTCNN(image_size=<image_size>, margin=<margin>) # Create an inception resnet (in eval mode): resnet = InceptionResnetV1(pretrained='vggface2').eval()
            Process an image: from PIL import Image img = Image.open(<image path>) # Get cropped and prewhitened image tensor img_cropped = mtcnn(img, save_path=<optional save path>) # Calculate embedding (unsqueeze to add batch dimension) img_embedding = resnet(img_cropped.unsqueeze(0)) # Or, if using for VGGFace2 classification resnet.classify = True img_probs = resnet(img_cropped.unsqueeze(0))

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

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

            Find more libraries
            Install
          • PyPI

            pip install facenet-pytorch

          • CLONE
          • HTTPS

            https://github.com/timesler/facenet-pytorch.git

          • CLI

            gh repo clone timesler/facenet-pytorch

          • sshUrl

            git@github.com:timesler/facenet-pytorch.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link