Class EfficientNet<T>
- Namespace
- AiDotNet.ComputerVision.Detection.Backbones
- Assembly
- AiDotNet.dll
EfficientNet backbone for efficient feature extraction.
public class EfficientNet<T> : BackboneBase<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
BackboneBase<T>EfficientNet<T>
- Inherited Members
Remarks
For Beginners: EfficientNet is a family of models that were designed using neural architecture search to find the optimal balance between width, depth, and resolution. It achieves state-of-the-art accuracy with significantly fewer parameters than other architectures.
Key features: - MBConv (Mobile Inverted Bottleneck) blocks - Squeeze-and-Excitation for channel attention - Compound scaling for width, depth, and resolution
Reference: Tan et al., "EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks", ICML 2019
Constructors
EfficientNet(EfficientNetVariant, int)
Creates a new EfficientNet backbone.
public EfficientNet(EfficientNetVariant variant = EfficientNetVariant.B0, int inChannels = 3)
Parameters
variantEfficientNetVariantEfficientNet variant (B0-B7).
inChannelsintNumber of input channels (default 3 for RGB).
Properties
Name
Name of this backbone architecture.
public override string Name { get; }
Property Value
OutputChannels
Number of output channels for each feature level.
public override int[] OutputChannels { get; }
Property Value
- int[]
Remarks
Modern detectors use multi-scale features. This array contains the number of channels at each scale, typically from high resolution (small objects) to low resolution (large objects).
Strides
The stride (downsampling factor) at each feature level.
public override int[] Strides { get; }
Property Value
- int[]
Remarks
A stride of 8 means the feature map is 1/8 the size of the input. Common strides are [8, 16, 32] for 3-level feature pyramids.
Methods
ExtractFeatures(Tensor<T>)
Extracts multi-scale features from an input image tensor.
public override List<Tensor<T>> ExtractFeatures(Tensor<T> input)
Parameters
inputTensor<T>Input image tensor with shape [batch, channels, height, width].
Returns
- List<Tensor<T>>
List of feature maps at different scales, from highest to lowest resolution.
Remarks
For Beginners: This method runs the input image through the backbone and returns feature maps at multiple scales. Small objects need high-resolution features, while large objects are detected in low-resolution features.
GetParameterCount()
Gets the total number of parameters in the backbone.
public override long GetParameterCount()
Returns
- long
Number of trainable parameters.
ReadParameters(BinaryReader)
Reads parameters from a binary reader for deserialization.
public override void ReadParameters(BinaryReader reader)
Parameters
readerBinaryReaderThe binary reader to read from.
WriteParameters(BinaryWriter)
Writes all parameters to a binary writer for serialization.
public override void WriteParameters(BinaryWriter writer)
Parameters
writerBinaryWriterThe binary writer to write to.