Views
No views yet
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| anime | 1.00 | 0.97 | 0.98 |
| real | 0.98 | 0.99 | 0.98 |
| rendered | 0.93 | 0.90 | 0.91 |
| macro avg | 0.97 | 0.95 | 0.96 |
| Metric | B0 | V2-S | Winner |
|---|---|---|---|
| Final Accuracy | 97.44% | 97.55% | V2-S +0.11% |
| Best Accuracy | 97.99% | 97.99% | Tied |
| Params | 5.3M | 21.5M | B0 (lighter) |
| Speed | 1 min/epoch | 3 min/epoch | B0 (faster) |
| Convergence | Epoch 4 | Epoch 13 | B0 (faster) |
1from PIL import Image
2import torch
3from torchvision import transforms
4import timm
5from safetensors.torch import load_file
6
7# Load model
8model = timm.create_model('tf_efficientnetv2_s', num_classes=3, pretrained=False)
9state_dict = load_file('model.safetensors')
10model.load_state_dict(state_dict)
11model.eval()
12
13# Prepare image
14transform = transforms.Compose([
15 transforms.Resize((224, 224)),
16 transforms.ToTensor(),
17 transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
18])
19
20image = Image.open('image.jpg').convert('RGB')
21x = transform(image).unsqueeze(0)
22
23# Predict
24with torch.no_grad():
25 logits = model(x)
26 probs = torch.softmax(logits, dim=1)
27 pred_class = probs.argmax(dim=1).item()
28
29labels = ['anime', 'real', 'rendered']
30print(f"{labels[pred_class]}: {probs[0, pred_class]:.2%}")