Views
No views yet
For Everyone, Recognizing Animal Life
| Phase | Layers trained | Epochs | LR | Accuracy |
|---|---|---|---|---|
| 🥶 Phase 1 | Last layer only (2,562 params) | 5 | 0.001 | 95.8% |
| 🔥 Phase 2 | + Last 3 layers (1,208,642 params) | 5 | 0.0001 | 98.2% |
| Metric | Cat | Dog | Overall |
|---|---|---|---|
| Precision | 97% | 99% | 98% |
| Recall | 99% | 97% | 98% |
| F1-Score | 98% | 98% | 98% |
| Accuracy | 97.8% |


1from huggingface_hub import hf_hub_download
2import torch
3import torch.nn as nn
4from torchvision import transforms, models
5from PIL import Image
6
7def build_model():
8 model = models.mobilenet_v2(weights=None)
9 model.classifier[1] = nn.Linear(1280, 2)
10 return model
11
12model_path = hf_hub_download("Firebleu/feral-ai", "model.pth")
13model = build_model()
14model.load_state_dict(torch.load(model_path, map_location="cpu"))
15model.eval()
16
17# Inference
18transform = transforms.Compose([
19 transforms.Resize((224, 224)),
20 transforms.ToTensor(),
21 transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
22])
23
24img = Image.open("your_image.jpg").convert("RGB")
25output = model(transform(img).unsqueeze(0))
26label = ["cat", "dog"][output.argmax().item()]
27print(f"Prediction: {label}")