French trees — ViT-S/14 (fast, mobile)

A small (22M parameters, 41 MB fp16 ONNX) image classifier for 71 common trees of France, plus an other plant class. Distilled from a fine-tuned Pl@ntNet ViT-B/14, small enough for live phone-camera use.

Sibling model: Maximaxou2/french-trees-plantnet-ft — the larger, more accurate model it was distilled from.

Usage

import json, timm, torch
from huggingface_hub import hf_hub_download
from PIL import Image

model = timm.create_model("hf-hub:Maximaxou2/french-trees-vit-small", pretrained=True).eval()
transform = timm.data.create_transform(**timm.data.resolve_data_config({}, model=model))
labels = json.load(open(hf_hub_download("Maximaxou2/french-trees-vit-small", "labels.json"), encoding="utf8"))
temperature = json.load(open(hf_hub_download("Maximaxou2/french-trees-vit-small", "config.json")))["temperature"]

x = transform(Image.open("photo.jpg").convert("RGB")).unsqueeze(0)
with torch.no_grad():
    probs = (model(x) / temperature).softmax(-1)[0]
for p, i in zip(*probs.topk(3)):
    print(f"{p:.1%}  {labels[i]['latin']} ({labels[i]['fr']})")

Divide logits by temperature (fitted on the validation split) for calibrated probabilities. Class 71 (other) means "probably not one of the 71 trees".

ONNX: model.onnx — fp16 weights, fp32 input image [1, 3, 252, 252] (RGB, center square crop, ImageNet mean/std), output logits [1, 72]. Runs with ONNX Runtime, incl. Android (CPU/XNNPACK or Qualcomm NPU via QNN).

Results

Test set: 7,090 photos of the 71 trees (100 iNaturalist observations per species, 90 for Thuja) observed in 2025–2026 by people absent from the training data, so neither the base model nor this one saw them; plus 1,000 photos of other plants, half of them close relatives of the 71 (other oaks, maples, pines, Tilia × europaea, oriental plane…).

Model Top-1 (among the 71) Open-set accuracy on trees Other plants rejected
Pl@ntNet PlantCLEF 2024, zero-shot (original) 89.8 69.0 90.4
This model 91.83 89.7 89.4
  • Top-3 among the 71: 97.43 %. Calibration error (ECE): 1.43 %.
  • When the calibrated confidence is ≥ 90 % (84.2 % of tree photos), it is right 97.84 % of the time.
  • By photo type (auto-tagged, approximate): flower 97.6 · fruit 95.4 · leaf 95.2 · needles or cones 92.4 · twig or bud 91.6 · bark 79.7 · whole tree 78.8.
  • Most frequent confusions: Quercus robur → Quercus petraea (12), Tilia cordata → Tilia platyphyllos (11), Quercus pubescens → Quercus petraea (10), Pinus pinea → Pinus pinaster (10), Pinus nigra → Pinus pinaster (8), Tilia platyphyllos → Tilia cordata (8). These pairs are hard from a single photo even for botanists, and iNaturalist labels for them are themselves less reliable.

Size and speed: 22 M parameters, 252 px input; ≈ 7,000 img/s on an RTX 5090 (fp16, batch 64).

Training data

iNaturalist research-grade observations with CC-licensed photos (iNaturalist open-data bucket), France first, the rest of Europe for the less-observed species: up to 700 observations (≤ 2 photos each) per species, plus ~37k photos of ~5,000 other plant species for the other class. Observer-disjoint train / validation / test splits. Licenses of training photos: 81 % CC BY-NC, 12 % CC BY, 4 % CC0, the rest other CC variants.

Distilled from the fine-tuned Pl@ntNet model (448 px teacher → 252 px student) for 14 epochs: 70 % KL to the teacher's softened outputs (T = 2) + 30 % label cross-entropy, with colour, blur and sensor-noise augmentation to mimic phone camera frames.

Limitations

  • Only 71 species. Anything else should come out as other, but ~11 % of lookalike plants are still named as one of the 71 — treat low-confidence answers as "check it".
  • Bark-only and whole-tree photos are clearly harder than leaves, flowers or fruits.
  • Platanus × hispanica (London plane) is not in the base Pl@ntNet model; it was learned only during fine-tuning.
  • Built for learning and curiosity, not for decisions that matter (e.g. edibility or toxicity).

License and credits

Weights: CC BY-NC 4.0 — most training photos are CC BY-NC. Base models: Pl@ntNet PlantCLEF 2024 ViT-B/14 (Apache-2.0, trained on Pl@ntNet data), DINOv2 (Meta). Photos: the iNaturalist community. Thank you to every observer.

Species

Latin name French name Test accuracy (%)
Quercus robur Chêne pédonculé 72.0
Quercus petraea Chêne sessile 89.0
Quercus pubescens Chêne pubescent 78.0
Quercus ilex Chêne vert 91.0
Quercus suber Chêne-liège 88.0
Quercus rubra Chêne rouge d'Amérique 97.0
Quercus cerris Chêne chevelu 88.0
Fagus sylvatica Hêtre commun 93.0
Carpinus betulus Charme commun 89.0
Castanea sativa Châtaignier 90.0
Fraxinus excelsior Frêne élevé 85.0
Fraxinus ornus Frêne à fleurs 89.0
Acer pseudoplatanus Érable sycomore 92.0
Acer platanoides Érable plane 91.0
Acer campestre Érable champêtre 89.0
Acer monspessulanum Érable de Montpellier 94.0
Tilia cordata Tilleul à petites feuilles 79.0
Tilia platyphyllos Tilleul à grandes feuilles 89.0
Betula pendula Bouleau verruqueux 95.0
Alnus glutinosa Aulne glutineux 98.0
Corylus avellana Noisetier 97.0
Juglans regia Noyer commun 95.0
Prunus avium Merisier 92.0
Prunus padus Cerisier à grappes 93.0
Prunus mahaleb Cerisier de Sainte-Lucie 95.0
Malus sylvestris Pommier sauvage 95.0
Pyrus communis Poirier commun 90.0
Sorbus aucuparia Sorbier des oiseleurs 95.0
Sorbus domestica Cormier 93.0
Sorbus torminalis Alisier torminal 98.0
Sorbus aria Alisier blanc 96.0
Crataegus monogyna Aubépine monogyne 94.0
Robinia pseudoacacia Robinier faux-acacia 96.0
Gleditsia triacanthos Févier d'Amérique 96.0
Platanus × hispanica Platane commun 92.0
Aesculus hippocastanum Marronnier d'Inde 99.0
Ailanthus altissima Ailante glanduleux 97.0
Celtis australis Micocoulier de Provence 97.0
Populus nigra Peuplier noir 96.0
Populus tremula Peuplier tremble 91.0
Populus alba Peuplier blanc 98.0
Salix alba Saule blanc 99.0
Salix caprea Saule marsault 88.0
Ulmus minor Orme champêtre 89.0
Ulmus glabra Orme de montagne 94.0
Ilex aquifolium Houx 98.0
Buxus sempervirens Buis 96.0
Cornus mas Cornouiller mâle 94.0
Euonymus europaeus Fusain d'Europe 94.0
Sambucus nigra Sureau noir 95.0
Olea europaea Olivier 98.0
Arbutus unedo Arbousier 95.0
Laurus nobilis Laurier-sauce 88.0
Prunus laurocerasus Laurier-cerise 96.0
Ostrya carpinifolia Charme-houblon 99.0
Pinus sylvestris Pin sylvestre 84.0
Pinus pinaster Pin maritime 84.0
Pinus nigra Pin noir 82.0
Pinus halepensis Pin d'Alep 91.0
Pinus pinea Pin parasol 81.0
Pinus cembra Pin cembro 82.0
Pinus uncinata Pin à crochets 89.0
Abies alba Sapin pectiné 92.0
Picea abies Épicéa commun 83.0
Pseudotsuga menziesii Douglas 94.0
Larix decidua Mélèze d'Europe 94.0
Cedrus atlantica Cèdre de l'Atlas 94.0
Taxus baccata If commun 92.0
Juniperus communis Genévrier commun 98.0
Cupressus sempervirens Cyprès de Provence 99.0
Thuja occidentalis Thuya du Canada 86.7
other Autre plante —
Downloads last month
6
Safetensors
Model size
21.7M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Maximaxou2/french-trees-vit-small

Quantized
(1)
this model