heesup/Cowpea-Architecture-XML
Preview β’ Updated β’ 320
How to use heesup/dinov2-base_448_RGB_Sideview_gpt2-medium with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("heesup/dinov2-base_448_RGB_Sideview_gpt2-medium")
model = AutoModel.from_pretrained("heesup/dinov2-base_448_RGB_Sideview_gpt2-medium", device_map="auto")This is the best-performing checkpoint from the paper "A vision language model for generating XML-based organ-level plant architecture representations of cowpea from simulated images" (Frontiers in Artificial Intelligence, 2026).
facebook/dinov2-base (ViT-B, frozen during training)gpt2-medium (with cross-attention)448 x 448 RGB0000β7999, val plots 8000β8999, seed 42)9000β9099)
| Metric | Score |
|---|---|
| BLEU-4 | 94.00% |
| ROUGE-L | 0.5182 |
| Leaf Area MAPE | 3.2% |
| Leaf Count MAPE | 4.1% |
See the GitHub repository for the custom PlantArchitectureModel class and tokenizer/XML conversion utilities:
import torch
from models.model import PlantArchitectureModel
from src.plant_tokenizer import token2vec, SOS_TOKEN, EOS_TOKEN, PAD_TOKEN
from src.string_to_xml_to_vec import vec2xml
from src.linked_xml_to_recursive_xml import recursive_to_linked, pretty_print_xml
checkpoint_path = "heesup/dinov2-base_448_RGB_Sideview_gpt2-medium"
model = PlantArchitectureModel.from_pretrained(checkpoint_path, torch_dtype=torch.float16).to("cuda")
model.eval()
with torch.no_grad():
with torch.cuda.amp.autocast():
result = model.generate(
pixel_values,
decoder_start_token_id=SOS_TOKEN,
decoder_input_ids=plant_info,
eos_token_id=EOS_TOKEN,
pad_token_id=PAD_TOKEN,
max_length=4096 * 2,
repetition_penalty=1.1,
use_cache=True,
)
result_tokens = result.squeeze().cpu().numpy()[6:]
plant_vec = token2vec(result_tokens)
plant_xml = recursive_to_linked(vec2xml(plant_vec))
plant_xml_str = pretty_print_xml(plant_xml)
@article{yun2026vision,
title={A vision language model for generating XML-based organ-level plant architecture representations of cowpea from simulated images},
author={Yun, Heesup and Uyehara, Isaac Kazuo and Droutsas, Ioannis and Ranario, Earl and Diepenbrock, Christine H. and Bailey, Brian N. and Earles, J. Mason},
journal={Frontiers in Artificial Intelligence},
volume={9},
pages={1844338},
year={2026},
doi={10.3389/frai.2026.1844338},
url={https://www.frontiersin.org/journals/artificial-intelligence/articles/10.3389/frai.2026.1844338/full}
}
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("heesup/dinov2-base_448_RGB_Sideview_gpt2-medium") model = AutoModel.from_pretrained("heesup/dinov2-base_448_RGB_Sideview_gpt2-medium", device_map="auto")