DAPPER (Document Analysis, Processing, and Pattern Extraction Repository)
Statistical Learning Final Project for Document Classification
 
Loading...
Searching...
No Matches
lsnet.LSNet Class Reference

LSNet model for document classification. More...

Inheritance diagram for lsnet.LSNet:
Inheritance graph
Collaboration diagram for lsnet.LSNet:
Collaboration graph

Public Member Functions

 __init__ (self, num_classes=16, model_size='s', dropout_rate=0.5)
 Constructor for LSNet model.
 
 forward (self, x)
 Forward pass through the LSNet model.
 

Public Attributes

 channels
 
 num_blocks
 
 conv1
 
 maxpool
 
 layer1
 
 layer2
 
 layer3
 
 layer4
 
 avgpool
 
 dropout
 
 fc
 

Protected Member Functions

 _initialize_weights (self)
 Initialize weights for the model.
 
 _make_layer (self, in_channels, out_channels, num_blocks, stride=1)
 Create a layer of LS Blocks.
 

Detailed Description

LSNet model for document classification.

This model implements the LSNet architecture for document classification, using LS Convolution and LS Blocks to achieve efficient and effective feature extraction and classification.

LSNet model as described in the paper.

This model uses LS Convolution and LS Blocks to achieve efficient
and effective feature extraction and classification.

Constructor & Destructor Documentation

◆ __init__()

lsnet.LSNet.__init__ (   self,
  num_classes = 16,
  model_size = 's',
  dropout_rate = 0.5 
)

Constructor for LSNet model.

Parameters
num_classesNumber of classes to classify
model_sizeSize of the model ('t' for tiny, 's' for small, 'b' for base)
dropout_rateDropout probability
Initialize the LSNet model.

Args:
    num_classes: Number of classes to classify (default: 1000 for ImageNet)
    model_size: Size of the model ('t' for tiny, 's' for small, 'b' for base)
    dropout_rate: Dropout probability (default: 0.5)

Member Function Documentation

◆ _initialize_weights()

lsnet.LSNet._initialize_weights (   self)
protected

Initialize weights for the model.

◆ _make_layer()

lsnet.LSNet._make_layer (   self,
  in_channels,
  out_channels,
  num_blocks,
  stride = 1 
)
protected

Create a layer of LS Blocks.

Parameters
in_channelsNumber of input channels
out_channelsNumber of output channels
num_blocksNumber of LS Blocks in the layer
strideStride of the first LS Block
Returns
Sequential module containing LS Blocks
Create a layer of LS Blocks.

Args:
    in_channels: Number of input channels
    out_channels: Number of output channels
    num_blocks: Number of LS Blocks in the layer
    stride: Stride of the first LS Block (default: 1)
    
Returns:
    Sequential module containing LS Blocks

◆ forward()

lsnet.LSNet.forward (   self,
  x 
)

Forward pass through the LSNet model.

Parameters
xInput tensor of shape [batch_size, 3, height, width]
Returns
Output tensor of shape [batch_size, num_classes]
Forward pass through the LSNet model.

Args:
    x: Input tensor of shape [batch_size, 3, height, width]
    
Returns:
    Output tensor of shape [batch_size, num_classes]

Member Data Documentation

◆ avgpool

lsnet.LSNet.avgpool

◆ channels

lsnet.LSNet.channels

◆ conv1

lsnet.LSNet.conv1

◆ dropout

lsnet.LSNet.dropout

◆ fc

lsnet.LSNet.fc

◆ layer1

lsnet.LSNet.layer1

◆ layer2

lsnet.LSNet.layer2

◆ layer3

lsnet.LSNet.layer3

◆ layer4

lsnet.LSNet.layer4

◆ maxpool

lsnet.LSNet.maxpool

◆ num_blocks

lsnet.LSNet.num_blocks

The documentation for this class was generated from the following file: