DeformableConvolutionalLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Deformable Convolutional Layer that learns spatial sampling offsets.
Inheritance: LayerBase<T> → DeformableConvolutionalLayer<T>
Implements: IShapeContract
For Beginners
Regular convolutions look at fixed grid positions around each pixel. Deformable convolutions can look at shifted positions learned from the data itself.
This is useful for:
- Aligning features between video frames (different objects may have moved differently)
- Handling geometric transformations (rotation, scale, perspective)
- Object detection with varying shapes and poses
How It Works
Deformable convolution augments standard convolution with learnable 2D offsets for each sampling location. This allows the convolution to adapt its receptive field to the geometric structure of the input, making it particularly effective for video alignment.
Reference: Dai et al., “Deformable Convolutional Networks”, ICCV 2017.
https://arxiv.org/abs/1703.06211
Constructors
| Constructor | Summary |
|---|---|
DeformableConvolutionalLayer(int outputChannels, int kernelSize, int stride, int padding, int groups, int deformGroups, bool useModulation, IEngine engine) |
Creates a new Deformable Convolutional Layer with lazy spatial dims. |
DeformableConvolutionalLayer(int outputChannels, int kernelSize, int stride, int padding, int groups, int deformGroups, bool useModulation, bool separableOffsetProjection, IEngine engine) |
Properties
| Property | Summary |
|---|---|
DeformableModulationNormalization ModulationNormalization { get; set; } |
Serializes the layer’s construction-time configuration so Clone / Deserialize can rebuild it exactly. |
bool SupportsTraining { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, string> GetParameterRoles() |
Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases). |
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
IReadOnlyList<Tensor<T>> GetTrainableParameters() |
Returns all trainable parameter tensors marked with [TrainableParameter]. |
int[] GetInputShape() |
|
int[] GetOutputShape() |
Gets the output shape for this layer. |
void ClearGradients() |
|
void ResetState() |
|
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) |
Replaces trainable parameter tensors (e.g., with ParameterBuffer views). |
void UpdateParameters(T learningRate) |
|
void UpdateParametersGpu(IGpuOptimizerConfig config) |
GPU-resident parameter update with polymorphic optimizer support. |
void ZeroGrad() |
Clears all gradient fields discovered by convention ({paramName}Gradient). |