InternImage<T>

Models & Types · AiDotNet.ComputerVision.Segmentation.Semantic

InternImage: Exploring Large-Scale Vision Foundation Models with Deformable Convolutions.

Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → SemanticSegmentationBase<T> → InternImage<T>

For Beginners

InternImage is a semantic segmentation model that proves CNNs can compete with Vision Transformers when using modern deformable convolutions. It uses DCNv3 (Deformable Convolution v3) which can adaptively adjust where it “looks” in the image based on the content, allowing it to focus on relevant regions for better segmentation.

Common use cases:

  • Large-scale scene parsing (Cityscapes, ADE20K)
  • Object detection and segmentation pipelines
  • Foundation model applications requiring dense predictions

How It Works

Technical Details:

  • DCNv3 operator with multi-group deformable attention
  • 4-stage hierarchical architecture (like ConvNeXt/Swin but with DCNv3)
  • UPerNet decoder for multi-scale feature aggregation
  • Scales from 30M (Tiny) to 1.08B (Huge) parameters
  • Competitive with ViT-based models on ADE20K and COCO

Reference: Wang et al., “InternImage: Exploring Large-Scale Vision Foundation Models with Deformable Convolutions”, CVPR 2023.

Example

// Create an InternImage model for large-scale semantic segmentation
var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.ThreeDimensional,
    taskType: NeuralNetworkTaskType.MultiClassClassification,
    inputHeight: 512, inputWidth: 512, inputDepth: 3, outputSize: 150);
var model = new InternImage<double>(architecture);
// Every tunable is now set through the options object; these are the defaults:
var custom = new InternImage<double>(architecture,
    options: new InternImageOptions { NumClasses = 150, DropRate = 0.1, ModelSize = InternImageModelSize.Tiny });
            
// Or load a pre-trained ONNX model for scene parsing
var onnxModel = new InternImage<double>(architecture, "internimage.onnx");

Constructors

Constructor Summary
InternImage(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, InternImageOptions options) Initializes a new instance of InternImage in native (trainable) mode.
InternImage(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, InternImageOptions options) Initializes a new instance of InternImage in ONNX (inference-only) mode.

Methods

Method Summary
ModelMetadata<T> GetModelMetadata() Collects metadata describing this InternImage model.