Downloads · 30 days
0
t1an-xyz/plane-classifier
plane-classifier is a image classification model from t1an-xyz. Use it when you need a label for an image. It is set up for timm. The card lists the license as mit.
Fine-tuned MobileNetV4 (mobilenetv4convmedium) classifying 16 commercial aircraft families from planespotting photos and camera crops.
Downloads · 30 days
0
Access
Public
Updated Sep 6, 2026
Repo size
39.4 MB
Likes
0
Public
Click a slice to open those files.
.pt34.3 MB · 87%
From the Hugging Face model README
Fine-tuned MobileNetV4 (mobilenetv4_conv_medium) classifying 16 commercial aircraft families from planespotting photos and camera crops.
Trained on the nyuuzyou/aircraft-images dataset with heavy field corruptions (blur, crops, noise, contrast, weather shift) to make predictions robust to phone photos and landing approaches.
import torch
import timm
from torchvision import transforms
from PIL import Image
from huggingface_hub import hf_hub_download
REPO_ID = "t1an-xyz/plane-classifier"
# 1. Download checkpoint from Hugging Face
ckpt_path = hf_hub_download(repo_id=REPO_ID, filename="plane_classifier_checkpoint.pt")
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
classes = ckpt["classes"]
model_name = ckpt["model_name"]
img_size = ckpt.get("img_size", (256, 256))
norm_mean = ckpt.get("norm_mean", (0.485, 0.456, 0.406))
norm_std = ckpt.get("norm_std", (0.229, 0.224, 0.225))
# 2. Reconstruct timm model & load weights
model = timm.create_model(model_name, pretrained=False, num_classes=len(classes))
model.load_state_dict(ckpt["state_dict"])
model.eval()
# 3. Preprocess image
preprocess = transforms.Compose([
transforms.Resize(img_size),
transforms.ToTensor(),
transforms.Normalize(mean=norm_mean, std=norm_std),
])
img = Image.open("plane.jpg").convert("RGB")
input_tensor = preprocess(img).unsqueeze(0)
# 4. Predict
with torch.no_grad():
logits = model(input_tensor)
probs = torch.softmax(logits, dim=1)[0]
top3_indices = torch.topk(probs, k=3).indices.tolist()
for idx in top3_indices:
print(f"{classes[idx]}: {probs[idx]:.2%}")