PathVLM<T>

Models & Types · AiDotNet.VisionLanguage.Medical

PathVLM: histopathology-specific vision-language model.

Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → PathVLM<T>

Implements: IMedicalVLM<T>

For Beginners

PathVLM is a vision-language model specialized for computational pathology and histopathology image analysis. Default values follow the original paper settings.

How It Works

PathVLM (2024) is a histopathology-specific vision-language model that processes whole-slide images at multiple magnification levels. It uses multi-scale patch processing to capture both cellular-level details and tissue-level context, enabling pathology report generation, diagnosis assistance, and visual question answering on histopathology specimens.

References:

  • Paper: “PathVLM: A Vision-Language Model for Computational Pathology (Various, 2024)”

Example

// Create a PathVLM model for histopathology image analysis
// with multi-scale patch processing at multiple magnification levels
var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.TwoDimensional,
    taskType: NeuralNetworkTaskType.ImageClassification,
    inputHeight: 224, inputWidth: 224, inputDepth: 3, outputSize: 512);
            
// ONNX inference mode with pre-trained model
var model = new PathVLM<double>(architecture, "pathvlm.onnx");
            
// Training mode with native layers
var trainModel = new PathVLM<double>(architecture, new PathVLMOptions());

Constructors

Constructor Summary
PathVLM(NeuralNetworkArchitecture<T> architecture, PathVLMOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
PathVLM(NeuralNetworkArchitecture<T> architecture, string modelPath, PathVLMOptions options)

Properties

Property Summary
int DecoderEmbeddingDim { get; }
int EmbeddingDimension { get; }
int MaxGenerationLength { get; }
string LanguageModelName { get; }
string MedicalDomain { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()
Tensor<T> AnswerMedicalQuestion(Tensor<T> image, string question)
Tensor<T> EncodeImage(Tensor<T> image)
Tensor<T> GenerateFromImage(Tensor<T> image, string prompt) Generates text from a histopathology image using PathVLM’s multi-scale encoding.