Views
No views yet
| Metric | This model | Reference SOTA |
|---|---|---|
| MAE | ≤ 0.27 | — |
| Pearson r | ≈ 0.88 | 0.8997 (ResNeXt-50, Liang et al., ICPR 2018) |
1import torch, timm
2from PIL import Image
3from torchvision import transforms
4
5model = timm.create_model("resnet50", pretrained=False, num_classes=1)
6state = torch.load("beauty_regressor.pt", map_location="cpu")
7model.load_state_dict(state)
8model.eval()
9
10tf = transforms.Compose([
11 transforms.Resize((224, 224)),
12 transforms.ToTensor(),
13 transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
14])
15img = tf(Image.open("face.jpg").convert("RGB")).unsqueeze(0)
16with torch.no_grad():
17 score = model(img).item() # ~[1.0, 5.0]
18print(round(score, 3))Liang, L., Lin, L., Jin, L., Xie, D., Li, M. SCUT-FBP5500: A Diverse Benchmark Dataset for Multi-Paradigm Facial Beauty Prediction. ICPR 2018.