SAN<T>
Models & Types · AiDotNet.ComputerVision.Segmentation.OpenVocabulary
SAN: Side Adapter Network for open-vocabulary semantic segmentation.
Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → OpenVocabSegmentationBase<T> → SAN<T>
For Beginners
Open-vocabulary semantic segmentation. Segmenting novel categories from text descriptions.
Common use cases:
- Open-vocabulary semantic segmentation
- Segmenting novel categories from text descriptions
- Zero-shot segmentation
- Language-guided scene understanding
How It Works
Technical Details:
- Side adapter attached to frozen CLIP model
- Recognition head (CLIP) + segmentation head (adapter)
- Two-way attention between adapter and CLIP features
- No re-training of CLIP backbone needed
Reference: Xu et al., “Side Adapter Network for Open-Vocabulary Semantic Segmentation”, CVPR 2023.
Example
// Create a SAN model for open-vocabulary semantic segmentation
// Any CLIP-style ITextEncoder supplies the text embeddings, e.g. a CLIP model from VisionLanguage.Encoders.
ITextEncoder<double> textEncoder = clipModel;
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.ThreeDimensional,
taskType: NeuralNetworkTaskType.MultiClassClassification,
inputHeight: 512, inputWidth: 512, inputDepth: 3, outputSize: 150);
var model = new SAN<double>(architecture, textEncoder);
// Every tunable is now set through the options object; these are the defaults:
var custom = new SAN<double>(architecture, textEncoder,
options: new SANOptions { NumClasses = 150, DropRate = 0.1 });
// Or load a pre-trained ONNX model for zero-shot segmentation
var onnxModel = new SAN<double>(architecture, "san.onnx", textEncoder, options: null);
Constructors
| Constructor | Summary |
|---|---|
SAN(NeuralNetworkArchitecture<T> architecture, ITextEncoder<T> textEncoder, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, SANOptions options) |
Initializes SAN in native (trainable) mode. |
SAN(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, ITextEncoder<T> textEncoder, SANOptions options) |
Initializes SAN in ONNX (inference-only) mode. |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
Collects metadata describing this model’s configuration. |