Upload directory
Browse files
README.md
CHANGED
@@ -69,11 +69,18 @@ def load_model_by_repo_id(repo_id, save_path, HF_TOKEN=None, force_download=Fals
|
|
69 |
|
70 |
|
71 |
if __name__ == '__main__':
|
|
|
72 |
HF_TOKEN = 'YOUR_HUGGINGFACE_TOKEN'
|
73 |
path = 'path/to/store/model/locally'
|
74 |
repo_id = 'minchul/cvlface_arcface_ir101_webface4m'
|
75 |
model = load_model_by_repo_id(repo_id, path, HF_TOKEN)
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
out = model(input)
|
78 |
```
|
79 |
|
|
|
69 |
|
70 |
|
71 |
if __name__ == '__main__':
|
72 |
+
|
73 |
HF_TOKEN = 'YOUR_HUGGINGFACE_TOKEN'
|
74 |
path = 'path/to/store/model/locally'
|
75 |
repo_id = 'minchul/cvlface_arcface_ir101_webface4m'
|
76 |
model = load_model_by_repo_id(repo_id, path, HF_TOKEN)
|
77 |
+
|
78 |
+
# input is a rgb image normalized.
|
79 |
+
from torchvision.transforms import Compose, ToTensor, Normalize
|
80 |
+
from PIL import Image
|
81 |
+
img = Image.open('path/to/image.jpg')
|
82 |
+
trans = Compose([ToTensor(), Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])])
|
83 |
+
input = trans(img).unsqueeze(0) # torch.randn(1, 3, 112, 112)
|
84 |
out = model(input)
|
85 |
```
|
86 |
|