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
Built Distribution
Close
Hashes for insightfacewrapper-0.0.4-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | f76cceadecc1a15a2da00cd8f9500d225cf7b9fc19cc29b60d23805589b9e1ea |
|
MD5 | a0340fc56bbc2ad844afc89ac0b2ed0f |
|
BLAKE2b-256 | 5ac35f2971a74f7cbad4421172f3dda749611918f4b77ee3cd689e4502807a16 |