ResNet<T>

Models & Types · AiDotNet.ComputerVision.Detection.Backbones

ResNet backbone network for feature extraction.

Inheritance: NeuralNetworkBase<T> → ResNet<T>

Implements: IDetectionBackbone<T>

For Beginners

ResNet (Residual Network) is a foundational architecture that introduced skip connections to enable training of very deep networks. It’s widely used as a backbone for detection models like Faster R-CNN.

How It Works

Key features:

  • Residual blocks with skip connections prevent gradient vanishing
  • Multiple variants: ResNet-18, 34, 50, 101, 152
  • Bottleneck blocks (3 convolutions) for deeper networks

Reference: He et al., “Deep Residual Learning for Image Recognition”, CVPR 2016

Constructors

Constructor Summary
ResNet(ResNetBackboneOptions options) Creates a new ResNet backbone: the classifier’s trunk (torchvision’s ResNet without its pooling and fully connected layer), producing the C2–C5 feature pyramid.

Properties

Property Summary
IReadOnlyList<int> OutputChannels { get; }
IReadOnlyList<int> Strides { get; }
bool IsFrozen { get; set; }
string Name { get; }

Methods

Method Summary
Dictionary<string, Tensor<T>> GetNamedLayerActivations(Tensor<T> input) Returns the stem output and each residual stage’s output (the C2..C5 pyramid), keyed by name.
IFullModel<T, Tensor<T>, Tensor<T>> WithParameters(Vector<T> parameters)
IReadOnlyList<Tensor<T>> GetFeatureMaps(Tensor<T> input)
List<Tensor<T>> ExtractFeatures(Tensor<T> input)
ModelMetadata<T> GetModelMetadata()
ValueTuple<int, int> GetExpectedInputSize()
void Freeze()
void ReadParameters(BinaryReader reader)
void Unfreeze()
void WriteParameters(BinaryWriter writer)