CATSeg<T>
Models & Types · AiDotNet.ComputerVision.Segmentation.OpenVocabulary
CAT-Seg: Cost Aggregation for open-vocabulary semantic segmentation.
Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → OpenVocabSegmentationBase<T> → CATSeg<T>
For Beginners
Open-vocabulary segmentation via cost aggregation. Novel category recognition.
Common use cases:
- Open-vocabulary segmentation via cost aggregation
- Novel category recognition
- Cross-dataset segmentation
- Language-driven pixel classification
How It Works
Technical Details:
- Cost volume between CLIP image and text features
- Cost aggregation transformer for spatial refinement
- Exploits CLIP feature similarity for pixel classification
- Efficient inference with frozen CLIP backbone
Reference: Cho et al., “CAT-Seg: Cost Aggregation for Open-Vocabulary Semantic Segmentation”, CVPR 2024.
Example
// Create a CAT-Seg 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 CATSeg<double>(architecture, textEncoder);
// Every tunable is now set through the options object; these are the defaults:
var custom = new CATSeg<double>(architecture, textEncoder,
options: new CATSegOptions { NumClasses = 150, DropRate = 0.1 });
// Or load a pre-trained ONNX model for novel category recognition
var onnxModel = new CATSeg<double>(architecture, "catseg.onnx", textEncoder, options: null);
Constructors
| Constructor | Summary |
|---|---|
CATSeg(NeuralNetworkArchitecture<T> architecture, ITextEncoder<T> textEncoder, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, CATSegOptions options) |
Initializes CATSeg in native (trainable) mode. |
CATSeg(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, ITextEncoder<T> textEncoder, CATSegOptions options) |
Initializes CATSeg in ONNX (inference-only) mode. |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
Collects metadata describing this model’s configuration. |