Skip to main content

Wrapper over insightface for a more convenient inference.

Project description

insightfaceWrapper

Wrapper for easier inference for insightface

Install

pip install -U insightfacewrapper

Models

  • ms1mv3_arcface_r18
  • ms1mv3_arcface_r34
  • ms1mv3_arcface_r50
  • ms1mv3_arcface_r100
  • glint360k_cosface_r18
  • glint360k_cosface_r34
  • glint360k_cosface_r50
  • glint360k_cosface_r100
from insightfacewrapper.get_model import get_model
model = get_model(<model_name>)
model.eval()

Inference

Based on the original inference script, image should be resized to (112, 112).

def normalize(image: np.ndarray) -> np.ndarray:
    image /= 255
    image -= 0.5
    image /= 0.5
    return image

def image2input(image: np.ndarray) -> np.ndarray:
    transposed = np.transpose(image, (2, 0, 1)).astype(np.float32)
    return normalize(np.expand_dims(np.ascontiguousarray(transposed), 0))

torch_input = image2input(image)

with torch.inference_engine():
    result = model(torch_input)[0].cpu().numpy()

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

insightfacewrapper-0.0.4.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

insightfacewrapper-0.0.4-py3.8.egg (3.9 kB view details)

Uploaded Egg

File details

Details for the file insightfacewrapper-0.0.4.tar.gz.

File metadata

  • Download URL: insightfacewrapper-0.0.4.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for insightfacewrapper-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a0c18d4e4e31ed373eecce288e2664a73d22d78f32ad4e2eb8d5bce09a8be3ed
MD5 2ba7d8f93697eb1b4e209cc548513d3d
BLAKE2b-256 81b01c4059b0cc262859ddc3f88029f3dff6f9a10c21bf3eadaa3d05fd6399d5

See more details on using hashes here.

File details

Details for the file insightfacewrapper-0.0.4-py3.8.egg.

File metadata

  • Download URL: insightfacewrapper-0.0.4-py3.8.egg
  • Upload date:
  • Size: 3.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for insightfacewrapper-0.0.4-py3.8.egg
Algorithm Hash digest
SHA256 f76cceadecc1a15a2da00cd8f9500d225cf7b9fc19cc29b60d23805589b9e1ea
MD5 a0340fc56bbc2ad844afc89ac0b2ed0f
BLAKE2b-256 5ac35f2971a74f7cbad4421172f3dda749611918f4b77ee3cd689e4502807a16

See more details on using hashes here.

Supported by

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