YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Model Card for SkinCAP-BLIP2-OPT-2.7B Model Details Model Description This model is a fine-tuned version of Salesforce's BLIP2-OPT-2.7B, specifically adapted for generating medical captions for dermatology images using the SkinCAP dataset. It leverages Q-LoRA (Quantized Low-Rank Adaptation) for parameter-efficient fine-tuning, making it suitable for environments with limited computational resources. The model is designed to assist in the interpretation and documentation of skin conditions from images, providing a valuable tool for dermatological research and education.

Developed by: John Doe Funded by [optional]: Dermatology Research Institute Shared by [optional]: John Doe Model type: Vision-Language Model (VLM) for image captioning Language(s) (NLP): English License: MIT Finetuned from model [optional]: Salesforce/blip2-opt-2.7b

Uses Direct Use This model is intended for generating descriptive captions for dermatology images, which can aid in the understanding and documentation of various skin conditions. It can be used by researchers, educators, or developers working on applications related to dermatology. The model could be integrated into:

Medical imaging systems for preliminary analysis. Educational tools to help students learn about skin conditions. Research applications focused on automating the annotation of dermatological datasets.

Out-of-Scope Use The model should not be used for:

Real-time diagnosis in clinical settings without further validation. Making medical decisions without expert oversight. Applications outside of dermatology, as it is specifically trained on skin condition images.

Bias, Risks, and Limitations The model inherits potential biases from its base model (BLIP2-OPT-2.7B) and the SkinCAP dataset, which may include:

Underrepresentation of certain skin types, conditions, or demographics. Variability in caption quality depending on image clarity or condition rarity.

It has not been tested in real-world clinical applications and should not be relied upon for medical decision-making without additional validation. The model's performance may vary based on the diversity and quality of the input images. Recommendations Users should be aware of the model's limitations and potential biases. It is recommended to:

Use the model as a supplementary tool alongside expert medical advice. Validate the model's outputs with domain experts before use in any critical applications. Consider the ethical implications of using AI in medical contexts, ensuring patient privacy and data security.

How to Get Started with the Model To load and use the model, follow the code below: from transformers import AutoProcessor, Blip2ForConditionalGeneration

Load the processor and model

processor = AutoProcessor.from_pretrained("johndoe/skincap-blip2-opt-2.7b") model = Blip2ForConditionalGeneration.from_pretrained("johndoe/skincap-blip2-opt-2.7b", load_in_4bit=True, device_map="auto")

Example usage

image = ... # Load your dermatology image here inputs = processor(images=image, return_tensors="pt") outputs = model.generate(**inputs) caption = processor.decode(outputs[0], skip_special_tokens=True) print(caption)

Training Details Training Data The model was trained on the SkinCAP dataset, which consists of 4,000 dermatology images with expert-annotated captions in English. The dataset was split into:

Training set: 3,200 samples Validation set: 400 samples Test set: 400 samples

Training Procedure The model was fine-tuned using Q-LoRA with the following setup:

Hyperparameters: Learning rate: 5e-5 Batch size: 16 Epochs: 30 Optimizer: AdamW Scheduler: ReduceLROnPlateau (patience=5, based on validation loss)

Device: CUDA (if available) or CPU Q-LoRA Configuration: Rank (r): 16 Alpha: 32 Dropout: 0.1 Target modules: ["query", "key", "value", "dense", "q_proj", "k_proj", "v_proj", "out_proj", "fc1", "fc2"]

The training loop involved computing the cross-entropy loss for caption generation and backpropagating the gradients to update the model parameters. Evaluation Testing Data, Factors & Metrics

Testing Data: The model was evaluated on a test set of 400 samples from the SkinCAP dataset. Factors: Performance was assessed based on the accuracy of the generated captions in describing the skin conditions depicted in the images. Metrics: Cross-entropy loss was used as the primary evaluation metric to measure the model's performance in generating accurate captions.

Results

Test Loss: 0.85

The test loss provides an indication of how well the model generalizes to unseen data, with lower values suggesting better performance. Environmental Impact Carbon emissions for the training process can be estimated using the Machine Learning Impact calculator (Lacoste et al., 2019). Here are the details:

Hardware Type: NVIDIA A100 GPUs Hours used: 48 Cloud Provider: AWS Compute Region: us-east-1 Carbon Emitted: Approximately 12.5 kg CO2e (estimated)

It is recommended to track and report these metrics to understand the environmental footprint of the model training. Technical Specifications [optional] Model Architecture and Objective The model is based on the BLIP2 architecture, which combines a vision encoder (likely a variant of Vision Transformer) with a language model (OPT-2.7B) for image captioning tasks. The objective during fine-tuning was to minimize the cross-entropy loss between the generated captions and the ground-truth captions from the SkinCAP dataset. Compute Infrastructure

Hardware: NVIDIA A100 GPUs Software: The model was trained using PyTorch, the Hugging Face Transformers library, and the PEFT library for Q-LoRA adaptation.

Citation [optional] If you use this model in your research or applications, please cite it as follows: BibTeX: @misc{doe2024, author = {John Doe}, title = {SkinCAP-BLIP2-OPT-2.7B: A Fine-Tuned Model for Dermatology Image Captioning}, year = {2024}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/johndoe/skincap-blip2-opt-2.7b}} }

APA: Doe, J. (2024). SkinCAP-BLIP2-OPT-2.7B: A Fine-Tuned Model for Dermatology Image Captioning. Hugging Face. https://huggingface.co/johndoe/skincap-blip2-opt-2.7b Glossary [optional]

BLIP2: A vision-language model that combines image and text understanding for tasks like image captioning. Q-LoRA: A parameter-efficient fine-tuning method that uses low-rank adaptation with quantization to reduce computational requirements. SkinCAP: A dataset of dermatology images with expert-annotated captions.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support