Skip to content

Latest commit

 

History

History
77 lines (59 loc) · 4.25 KB

README.md

File metadata and controls

77 lines (59 loc) · 4.25 KB

PanDerm

A General-Purpose Multimodal Foundation Model for Dermatology

Installation

First clone the repo and cd into the directory:

git clone https://github.com/SiyuanYan1/PanDerm
cd PanDerm

Then create a conda env and install the dependencies:

conda create -n PanDerm python=3.10 -y
conda activate PanDerm
pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

1. Download PanDerm Pre-trained Weights

Obtaining the Model Weights

Download the pre-trained model weights from this Google Drive link.

Configuring the Model Path

After downloading, you need to update the model weights path in the code:

  1. Open the file PanDerm/LP_Eval/models/builder.py
  2. Locate line 42
  3. Replace the existing path with the directory where you saved the model weights:
root_path = '/path/to/your/PanDerm/Model_Weights/'

2. Data Organization

We've pre-processed the public datasets used in this study to prevent data leakage between splits. To reproduce the results reported in our paper, please use these processed datasets.

If you wish to use our model with your own dataset, please organize it in the same format as these pre-processed datasets.

Public Dataset Links and Splits

Dataset Processed Data Original Data
HAM10000 Download Official Website
BCN20000 Download Official Website
DDI Download Official Website
Derm7pt Download Official Website
Dermnet Download Official Website
HIBA Download Official Website
MSKCC Download Official Website
PAD-UFES Download Official Website
PATCH16 Download Official Website

Note: The processed datasets may differ slightly from those provided on the official websites. To ensure reproducibility of our paper's results, please use the processed data links provided above.

3. Linear Evaluation on Downstream Tasks

Training and evaluation using HAM10000 as an example. Replace csv path and root path with your own dataset.

Key Parameters

  • nb_classes: Set this to the number of classes in your evaluation dataset.
  • batch_size: Adjust based on the memory size of your GPU.
  • percent_data: Controls the percentage of training data used. For example, 0.1 means evaluate models using 10% training data. Modify this if you want to conduct label efficiency generalization experiments.

Evaluation Command

CUDA_VISIBLE_DEVICES=0 python linear_eval.py \
  --batch_size 1000 \
  --model 'PanDerm' \
  --nb_classes 7 \
  --percent_data 1.0 \
  --csv_filename 'PanDerm_results.csv' \
  --output_dir "/path/to/your/PanDerm/LP_Eval/output_dir2/ID_Res/PanDerm_res/" \
  --csv_path "/path/to/your/PanDerm/Evaluation_datasets/HAM10000_clean/ISIC2018_splits/HAM_clean.csv" \
  --root_path "/path/to/your/PanDerm/Evaluation_datasets/HAM10000_clean/ISIC2018/"