Views
No views yet
1import torch
2import torch.nn as nn
3import torch.nn.functional as F
4from torchvision import transforms
5from PIL import Image
6from huggingface_hub import hf_hub_download
7
8# Download model
9model_path = hf_hub_download(repo_id="DavronSherbaev/person-reid-arcface", filename="arcface_dinov2.pth")
10
11# Load checkpoint
12checkpoint = torch.load(model_path, map_location='cpu')
13
14# Create model (see full code in repo)
15# model = ArcFaceReID(...)
16# model.load_state_dict(checkpoint['model_state_dict'])
17
18# Extract embedding
19# embedding = model.get_embedding(image_tensor)