OWLv2<T>
Models & Types · AiDotNet.VisionLanguage.Grounding
OWLv2: self-training for scaling open-vocabulary detection.
Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → OWLv2<T>
Implements: IVisualGroundingModel<T>
For Beginners
OWLv2 is an improved version of OWL-ViT that achieves better open-vocabulary detection through self-training at web scale. Default values follow the original paper settings.
How It Works
OWLv2 (Minderer et al., 2023) scales open-vocabulary object detection through self-training on web-scale image-text data. Building on OWL-ViT, it uses a stronger ViT-L/14 backbone with 960px input resolution, pseudo-label self-training from an OWL-ViT teacher model, and objectness-calibrated scoring for better separation of true objects from background patches.
References:
- Paper: “Scaling Open-Vocabulary Object Detection” (Google, 2023)
Example
// Create an OWLv2 model for scaled open-vocabulary detection
// with self-training and objectness-calibrated scoring
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 OWLv2<double>(architecture, "owlv2.onnx");
// Training mode with native layers
var trainModel = new OWLv2<double>(architecture, new OWLv2Options());
Constructors
| Constructor | Summary |
|---|---|
OWLv2(NeuralNetworkArchitecture<T> architecture, OWLv2Options options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
OWLv2(NeuralNetworkArchitecture<T> architecture, string modelPath, OWLv2Options options) |
Properties
| Property | Summary |
|---|---|
int EmbeddingDimension { get; } |
|
int MaxDetections { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> DetectObjects(Tensor<T> image, IReadOnlyList<string> categories) |
|
Tensor<T> EncodeImage(Tensor<T> image) |
|
Tensor<T> GroundText(Tensor<T> image, string textQuery) |
Grounds text using OWLv2’s scaled open-vocabulary detection approach. |