DrDiag-QwenVL2 is a 🩺 vision–language dermatology model trained using our two-stage fine-tuning pipeline on the HAM10000 dataset with bounding box annotations. The model combines image understanding with natural language reasoning to perform skin disease diagnosis with spatial awareness.
-
Supervised Fine-Tuning (SFT):
The base model Qwen2.5-VL was fine-tuned on HAM10000 with labels for skin disease classification, establishing a strong diagnostic baseline.
-
Group Relative Policy Optimization (GRPO):
Reinforcement learning was applied to align outputs with spatial annotations, improving consistency in bounding box predictions and segmentation-related tasks.
This setup enhances the model’s ability to not only classify skin lesions but also localize them through bounding box outputs, supporting explainability and trustworthiness in medical AI.
1from transformers import AutoModelForVision2Seq, AutoProcessor
2
3model_id = "abaryan/DrDiag_qwen2vl_Ham10000"
4processor = Qwen2VLProcessor.from_pretrained(model_id)
5model = Qwen2VLForConditionalGeneration.from_pretrained(model_id, device_map="auto", torch_dtype="auto")
6
7# Example usage
8inputs = processor(images="lesion.jpg", text="Diagnose the lesion and provide bounding box.", return_tensors="pt").to(model.device)
9outputs = model.generate(**inputs, max_new_tokens=200)
10print(processor.decode(outputs[0], skip_special_tokens=True))