MedNeXt<T>

Models & Types · AiDotNet.ComputerVision.Segmentation.Medical

MedNeXt: Transformer-driven scaling of ConvNets for medical segmentation.

Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → MedicalSegmentationBase<T> → MedNeXt<T>

For Beginners

Medical image segmentation with efficient ConvNet design. CT and MRI organ segmentation.

Common use cases:

  • Medical image segmentation with efficient ConvNet design
  • CT and MRI organ segmentation
  • 3D medical volume analysis
  • Resource-efficient medical AI deployment

How It Works

Technical Details:

  • ConvNeXt-inspired blocks adapted for medical imaging
  • Large kernel sizes (up to 7x7x7) for capturing global context
  • UpKern: compound scaling strategy for depth, width, and kernel size
  • Achieves transformer-level performance with pure convolutions

Reference: Roy et al., “MedNeXt: Transformer-driven Scaling of ConvNets for Medical Image Segmentation”, MICCAI 2023.

Example

// Create a MedNeXt model for CT/MRI organ segmentation
var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.ThreeDimensional,
    taskType: NeuralNetworkTaskType.MultiClassClassification,
    inputHeight: 256, inputWidth: 256, inputDepth: 1, outputSize: 14);
var model = new MedNeXt<double>(architecture);
// Every tunable is now set through the options object; these are the defaults:
var custom = new MedNeXt<double>(architecture,
    options: new MedNeXtOptions { NumClasses = 14, DropRate = 0, ModelSize = MedNeXtModelSize.Small });
            
// Or load a pre-trained ONNX model for medical image analysis
var onnxModel = new MedNeXt<double>(architecture, "mednext.onnx");

Constructors

Constructor Summary
MedNeXt(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, MedNeXtOptions options) Initializes MedNeXt in native (trainable) mode.
MedNeXt(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, MedNeXtOptions options) Initializes MedNeXt in ONNX (inference-only) mode.

Methods

Method Summary
MedicalSegmentationResult<T> SegmentFewShot(Tensor<T> queryImage, Tensor<T> supportImages, Tensor<T> supportMasks) Segments a query image, ignoring the support set.
MedicalSegmentationResult<T> SegmentSlice(Tensor<T> slice)
MedicalSegmentationResult<T> SegmentVolume(Tensor<T> volume)
ModelMetadata<T> GetModelMetadata() Collects metadata describing this model’s configuration.