Downloads · 30 days
0
maryammeda/apiarist-queen-classifier
apiarist-queen-classifier is a image classification model from maryammeda. Use it when you need a label for an image. It is set up for timm. The card lists the license as apache-2.0.
Binary image classifier (EfficientNet-B0, ~5M params) trained to distinguish queen bees from worker bees on cropped bee images.
Downloads · 30 days
0
Access
Public
Updated Jun 14, 2026
Repo size
16.3 MB
Likes
0
Public
Click a slice to open those files.
.pt16.3 MB · 100%
From the Hugging Face model README
Binary image classifier (EfficientNet-B0, ~5M params) trained to distinguish queen bees from worker bees on cropped bee images.
Built as part of Apiarist, an offline AI hive inspector for backyard beekeepers, made for the Build Small Hackathon.
Multi-class YOLO detectors fight two problems at once (localize + classify) and queens lose because they're rare and visually subtle. A focused binary classifier on cropped bee images is the right architecture: small, fast, trained specifically for one decision.
efficientnet_b0 (ImageNet pretrained)Pair with a bee detector (e.g. YOLOv8). Run the detector first, then classify each cropped bee through this model. Threshold queen probability at 0.85 for high-precision flagging.
import torch, timm
from torchvision import transforms
ckpt = torch.load("queen_classifier.pt", map_location="cpu")
model = timm.create_model(ckpt["arch"], pretrained=False, num_classes=2)
model.load_state_dict(ckpt["state_dict"])
model.eval()
tf = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize([0.485,0.456,0.406], [0.229,0.224,0.225]),
])
with torch.no_grad():
probs = torch.softmax(model(tf(crop).unsqueeze(0)), dim=1)
queen_idx = ckpt["class_to_idx"]["queen"]
queen_prob = probs[0, queen_idx].item()
The training distribution leans toward close-up macro photos of bees on honeycomb. Generalization to wide-angle inspection photos (with hands / background visible) is weaker, since YOLO's bee bounding boxes on those photos are often smaller and less precise than the training crops.
Apache 2.0. Trained on data released under CC BY 4.0.