Downloads · 30 days
0
mengflz/pasta-neuro
pasta-neuro is a image-to-image model from mengflz. Use it when you need one image transformed into another. It is set up for pytorch. The card lists the license as gpl-3.0.
This repository contains PASTA (PAthological Spatial Transcriptome-guided pAradigm) models trained for predicting neuron-related pathway scores from H&E-stained pathology images.
Downloads · 30 days
0
Access
Public
Updated Jan 10, 2026
Repo size
705 MB
Likes
0
Public
Click a slice to open those files.
.pt705 MB · 100%
From the Hugging Face model README
This repository contains PASTA (PAthological Spatial Transcriptome-guided pAradigm) models trained for predicting neuron-related pathway scores from H&E-stained pathology images.
PASTA is a deep learning framework that can predict neuron-related pathway spatial patterns directly from histology images. These benchmark models were trained on HEST-library mouse brain data with different foundation model backbones.
This repository includes 3 models:
UNIv2_neuro1_pos.pt - UNIv2 backbone, Gene set: Neuro1 (2 plaque-related pathways)UNIv2_neuro2_pos.pt - UNIv2 backbone, Gene set: Neuro2 (8 neuro-related pathways)UNI_neuro3_no_pos.pt - UNI backbone, Gene set: Neuro3 (50 aging-related pathways)Notes on variants:
pos: Trained with coarse-grained pathway score/gene expression as positional embeddings. In these variants, you can use coarse-grained pathway scores/gene expression as an optional input.no_pos: Trained without pathway scores.🌟 To use PASTA models for inference, please follow the code in PASTA codebase and confirm that you have the access to related backbone foundation models.
import torch
from pasta.model import PASTA
from huggingface_hub import hf_hub_download
from PIL import Image
import torchvision.transforms as transforms
# Download model checkpoint
model_path = hf_hub_download(
repo_id="mengflz/pasta-neuro",
filename="UNIv2_neuro1_pos.pt"
)
# Initialize PASTA model
model = PASTA(
model_name='UNIv2',
pathway_dim=2,
freq_flag=True,
N=128,
scale=1.0
)
# Load trained weights
checkpoint = torch.load(model_path, map_location='cpu')
model.load_state_dict(checkpoint, strict=False)
model.eval()
# Prepare input image
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
image = Image.open("path/to/neuro_image.png")
input_tensor = transform(image).unsqueeze(0)
# Run inference
with torch.no_grad():
feat, feat_mean, feat_recon = model(input_tensor)
# feat: spatial feature map [B, 3, H, W]
# feat_mean: class logits [B, 3]
# feat_recon: reconstructed image [B, 3, H, W]
predictions = torch.softmax(feat_mean, dim=1)
predicted_class = torch.argmax(predictions, dim=1)
Please refer to the original PASTA paper or PASTA Github repository for more details.
If you use these models in your research, please cite:
This project is licensed under GPL-3.0. The underlying foundation models (UNI, UNIv2) have their own licenses.
For questions and issues, please open an issue on the repository.