🚀 植物叶片病害细粒度视觉分类
本项目基于多模态基础模型,针对植物叶片病害检测与解释进行了优化,能够精准识别病害并给出可验证的症状描述,为植物健康监测提供有力支持。
🚀 快速开始
本模型是基于 [LLaVA - 1.5 - 7B - hf](https://huggingface.co/llava - hf/llava - 1.5 - 7b - hf) 微调的多模态基础模型,使用植物病害数据集进行优化,用于检测和解释植物叶片病害。
项目页面:SelfSynthX。
arXiv 论文:Enhancing Cognition and Explainability of Multimodal Foundation Models with Self - Synthesized Data
✨ 主要特性
属性 |
详情 |
基础模型 |
LLaVA - 1.5 - 7B |
训练数据 |
多种植物物种的健康和患病叶片 |
创新点 |
1. 自合成数据:使用信息瓶颈原理提取和描述特定病害的视觉症状。 2. 迭代微调:使用无奖励模型的拒绝采样来提高分类准确性和解释质量。 |
预期用途 |
识别植物叶片病害并提供可由人类验证的症状描述 |
💻 使用示例
基础用法
import requests
from PIL import Image
import torch
from transformers import AutoProcessor, LlavaForConditionalGeneration
model_id = "YuchengShi/LLaVA-v1.5-7B-Plant-Leaf-Diseases-Detection"
model = LlavaForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
).to("cuda")
processor = AutoProcessor.from_pretrained(model_id)
conversation = [
{
"role": "user",
"content": [
{"type": "text", "text": "What disease does this leaf have?"},
{"type": "image"},
],
},
]
prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
image_file = "plant-disease/test1.png"
raw_image = Image.open(requests.get(image_file, stream=True).raw)
inputs = processor(images=raw_image, text=prompt, return_tensors='pt').to("cuda", torch.float16)
output = model.generate(**inputs, max_new_tokens=200, do_sample=False)
print(processor.decode(output[0][2:], skip_special_tokens=True))
🔧 技术细节
- 训练:使用 LoRA 在 PlantVillage 上进行微调,并采用迭代拒绝采样。
- 评估:与基线模型相比,该模型表现出更高的准确性,并且能够提供可靠且可解释的解释。
📄 许可证
文档中未提及许可证相关信息。
📚 引用
如果您使用此模型,请引用:
@inproceedings{
shi2025enhancing,
title={Enhancing Cognition and Explainability of Multimodal Foundation Models with Self-Synthesized Data},
author={Yucheng Shi and Quanzheng Li and Jin Sun and Xiang Li and Ninghao Liu},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=lHbLpwbEyt}
}