Skip to main content

VRPWRP 0.0.5

VRPWRP (Vision-algorithm Requests Processing Wrappers) is a package that wraps an API-REST for Computer Vision deep-learning algorithms. Currently, it supports state-of-the-art face-detection and face-recognition algorithms out-of-the-box.

https://badge.fury.io/py/vrpwrp.svg https://travis-ci.org/ipazc/vrpwrp.svg?branch=master https://coveralls.io/repos/github/ipazc/vrpwrp/badge.svg?branch=master Code Health

Installation

Currently it is only supported Python 3.4.1 onwards:

sudo pip3 install vrpwrp

Face detection

Face detection allows you to retrieve the location of faces inside images in the form of bounding boxes (left, top, width, height). The algorihm is a deep-learning based algorithm, composed by a cascade of Convolutional Neural Networks. It is based on the paper Zhang et al. (2016) [ZHANG2016].

A simple example for retrieving the bounding boxes of faces from an image:

>>> from vrpwrp.wrappers.face_detection import FaceDetection
>>> face_detection = FaceDetection()
>>> bounding_boxes = face_detection.analyze_file("route/to/image.jpg")
>>> for bb in bounding_boxes: print(bb)
...
[162, 79, 114, 146]

FaceDetection has methods for analyzing images also from bytes, URLs and pillow images directly:

>>> bounding_boxes = face_detection.analyze_bytes(image_bytes)
>>> bounding_boxes = face_detection.analyze_url(image_url)
>>> bounding_boxes = face_detection.analyze_pil(pillow_image)
...

Face Recognition

Face recognition allows extracting the identity of a face within a given image of the face. The identity is a set of float numbers (since it is deep-learning-based, it is the output of the last convolution layer of a Convolutional Neural Network). The algorithm is based on the papers Schroff et al. (2015) [SCHROFF2015], Wen et al. (2016) [WEN2016]. and Parkhi et al. (2015) [PARKHI2015].

In vrpwrp, the identity of a face is also known as embeddings.

A simple example for retrieving the embeddings of a face is:

>>> from vrpwrp.wrappers.face_recognition import FaceRecognition
>>> face_recognition = FaceRecognition()
>>> face_embeddings = face_recognition.get_embeddings_from_file("route/to/image_of_face.jpg")
>>> print(face_embeddings)
[-0.05258641 -0.14807236  0.21828972  0.00097196  0.08881456  0.01356898 -0.01393933 -0.09459263 -0.07305822  0.00354048  0.1649337  -0.05636634  0.03599492 -0.02649886 ...]

Like in FaceDetection, it allows to analyze images from different sources:

>>> embeddings = face_recognition.get_embeddings_from_bytes(image_bytes)
>>> embeddings = face_recognition.get_embeddings_from_url(image_url)
>>> embeddings = face_recognition.get_embeddings_from_pil(pillow_image)
...

The embeddings of two faces can be easily compared to see how close they are:

>>> face1_embeddings = face_recognition.get_embeddings_from_file("route/to/image_of_face1.jpg")
>>> face2_embeddings = face_recognition.get_embeddings_from_file("route/to/image_of_face2.jpg")
>>> print(face1_embeddings - face2_embeddings)
0.5634614628831894

A value close to 0 indicates that two faces might be of the same person. In this example, image_of_face1.jpg and image_of_face2.jpg are likely to be of the same person. Otherwise, a value over 1.0 might indicate that two faces are not likely to be of the same person.

This might lead to a scenario where you store lot of embeddings and want to compare a single one with each of them, resulting in a loop like the following:

faces_embeddings = [emb1, emb2, ..., embN]

new_embedding = face_recognition.get_embeddings_from_file("route/to/image_of_face1.jpg")

for embedding in faces_embeddings:
     distance = embedding - new_embedding

Rather than using a loop (even if it is a list-comprehension), there is an optimized and preferred way of performing such a comparison that can be used instead:

faces_embeddings = [emb1, emb2, ..., embN]

new_embedding = face_recognition.get_embedding_from_file("route/to/image_of_face1.jpg")
distances = face_recognition.get_embeddings_distances(new_embedding, faces_embeddings)

References

[ZHANG2016]

Zhang, K., Zhang, Z., Li, Z., and Qiao, Y. (2016). Joint face detection and alignment using multitask cascaded convolutional networks. IEEE Signal Processing Letters, 23(10):1499–1503.

[SCHROFF2015]

Schroff, F., Kalenichenko, D., & Philbin, J. (2015). Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE Conference on CVPR (pp. 815-823).

[WEN2016]

Wen, Y., Zhang, K., Li, Z., & Qiao, Y. (2016, October). A discriminative feature learning approach for deep face recognition. In ECCV (pp. 499-515). Springer International Publishing.

[PARKHI2015]

Parkhi, O. M., Vedaldi, A., & Zisserman, A. (2015, September). Deep Face Recognition. In BMVC (Vol. 1, No. 3, p. 6).

Metadata

Release files for vrpwrp 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vrpwrp 0.0.5
File Size Uploaded Provenance Actions
vrpwrp-0.0.5.tar.gz 16.1 kB Without provenance Details for vrpwrp-0.0.5.tar.gz

Release files / vrpwrp-0.0.5.tar.gz

Download URL vrpwrp-0.0.5.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
60477d2e7859e588f1e12622aad1fe31e96ecc168c16b6d7a8c1fd6c4d583880
BLAKE2b-256 checksum
How to use checksums
fcb37e879a392a8c7e9ad2deca8c8879f91f422da5bd756d3a113dfab377132c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for vrpwrp 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page