Views
No views yet

domai-tb/OpenPlants), an open-source and privacy-friendly companion app for plant care.
Inside the app, it powers local image classification so users can identify plants directly on-device from a photo.google/vit-base-patch16-224, the model was fine-tuned for species-level plant identification on the GBIF / iNaturalist plant image dataset.| Property | Value |
|---|---|
| Base model | google/vit-base-patch16-224 |
| Parameters | ~97.2M |
| Training samples | 2,000,000 curated plant occurrences |
| Species coverage | ~14,000 unique species |
| Source data | GBIF / iNaturalist |
| Training method | End-to-end supervised fine-tuning |
| Primary use | Fast plant species classification from a single image |
1from transformers import AutoImageProcessor, AutoModelForImageClassification
2from PIL import Image
3import requests
4import torch
5
6model_id = "domai-tb/OpenPlants-Identification-ViT-Base-Patch16-224"
7
8processor = AutoImageProcessor.from_pretrained(model_id)
9model = AutoModelForImageClassification.from_pretrained(model_id)
10
11url = "https://example.com/plant.jpg"
12image = Image.open(requests.get(url, stream=True).raw)
13
14inputs = processor(images=image, return_tensors="pt")
15with torch.no_grad():
16 logits = model(**inputs).logits
17
18probs = logits.softmax(dim=-1)[0]
19topk = torch.topk(probs, k=5)
20
21for prob, idx in zip(topk.values, topk.indices):
22 label = model.config.id2label[idx.item()]
23 print(f"{label}: {prob.item():.4f}")species and image metadataspecies_name).
Each class maps directly to one species.1from transformers import AutoConfig
2
3cfg = AutoConfig.from_pretrained("domai-tb/OpenPlants-Identification-ViT-Base-Patch16-224")
4labels = cfg.id2label