PulmoFoundation / README.md
david4real's picture
Update README.md
1f44bbf verified
metadata
license: apache-2.0
base_model:
  - paige-ai/Virchow2

Complete Codebase

Code for loading PulmoFoundation can be found in https://github.com/dddavid4real/PulmoFoundation.

Download Model Checkpoint

Download PulmoFoundation-E2.pth from Files and versions to models/ckpts/

Basic Usage

from models import get_model, get_transform
from PIL import Image

# Load model and preprocessing pipeline
model = get_model('cuda', 'models/ckpts/PulmoFoundation-E2.pth')
transform = get_transform()

# Load and preprocess image
img = Image.open('path/to/your/image.jpg')  # Prefer 512x512 patches at 40X
img_tensor = transform(img)
img_tensor = img_tensor.unsqueeze(0)  # Add batch dimension [1, 3, H, W]
img_tensor = img_tensor.cuda()  # Move to GPU

# Extract features
features = model(img_tensor)  # Shape: [1, 2560]
print(f"Feature shape: {features.shape}")
print(f"Feature vector: {features}")