from resnet import get_model import torch from PIL import Image from torchvision.transforms.functional import pil_to_tensor model = get_model("r100", dropout=0.0, fp16=True, num_features=512).cuda() model.load_state_dict(torch.load("model.pt")) model.eval() img = pil_to_tensor(Image.open("test.jpg").resize((112,112))).permute(0, 1, 2).to("cuda", torch.float16).unsqueeze(dim = 0) embeddings = model(img) from insightface.app import FaceAnalysis import insightface from huggingface_hub import snapshot_download snapshot_download('Warlord-K/resnet100', local_dir='models/antelopev2') app = FaceAnalysis( name='antelopev2', root='.', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'] ) app.prepare(ctx_id=0, det_size=(640, 640)) handler_ante = insightface.model_zoo.get_model('models/antelopev2/glintr100.onnx') handler_ante.prepare(ctx_id=0)