Skip to main content

An attempt to build a package for forensic face examination

Project description

forensicface

Install

pip install forensicface

Os arquivos onnx dos modelos de detecção (det_10g.onnx), pose (1k3d68.onnx) e gênero/idade (genderage.onnx) devem estar na pasta ~/.insightface/models/sepaelv2/

O arquivo onnx do modelo de reconhecimento (adaface_ir101web12m.onnx) deve estar na pasta ~/.insightface/models/sepaelv2/adaface/

O arquivo onnx do modelo magface (magface_iresnet100.onnx) deve estar na pasta ~/.insightface/models/sepaelv2/magface/

A partir da versão 0.1.5 é possível utilizar outros modelos além do sepaelv2

Como utilizar

Importação da classe ForensicFace:

from forensicface.app import ForensicFace

ff = ForensicFace(det_size=320, use_gpu=True)

Processamento básico de imagens

Obter pontos de referência, distância interpupilar, representação vetorial e a face alinhada com dimensão fixa (112x112)

results = ff.process_image_single_face("obama.png")
results.keys()
dict_keys(['keypoints', 'ipd', 'gender', 'age', 'pitch', 'yaw', 'roll', 'embedding', 'norm', 'magface_embedding', 'magface_norm', 'aligned_face'])

Comparar duas imagens faciais e obter o escore de similaridade.

ff.compare("obama.png","obama2.png")
0.8555868

Agregar embeddings de duas imagens faciais em uma única representação

agg = ff.aggregate_from_images(["obama.png","obama2.png"])
agg.shape
(512,)

Suporte a MagFace

Estimativa de qualidade pela norma da representação MagFace

Para utilizar, instancie o forensicface com a opção magface = True:

ff = ForensicFace(magface=True)

ff = ForensicFace(det_size=320, use_gpu=True, magface=True)
good = ff.process_image("obama.png")
bad = ff.process_image("obama2.png")
good["magface_norm"], bad["magface_norm"]
(24.875765, 21.319853)

Crédito dos modelos utilizados

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forensicface-0.1.8.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

forensicface-0.1.8-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file forensicface-0.1.8.tar.gz.

File metadata

  • Download URL: forensicface-0.1.8.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for forensicface-0.1.8.tar.gz
Algorithm Hash digest
SHA256 7378d2138cafee6b9dd7a2e64df36bac8b78d7e225e156c8036acc95259f7ee7
MD5 9b441e935651f657502a40e9dd18493c
BLAKE2b-256 c061825b33685f6b7b2d6acd4504acfcf92ab90008de5e4df755bc556ebf6048

See more details on using hashes here.

File details

Details for the file forensicface-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: forensicface-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for forensicface-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c9feaf213a9d101ee6989be0850670a49b70a58494d4dfa33d87fc511f119c24
MD5 e76b5828b8a787130fb92d053936472c
BLAKE2b-256 df94c67849d6f1fb2ec46fb9fe3c4956de06e88de120bed9eac7f0a1f7c72557

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page