DAPPER (Document Analysis, Processing, and Pattern Extraction Repository)
Statistical Learning Final Project for Document Classification
 
Loading...
Searching...
No Matches
cnn.CNNModel Class Reference
Inheritance diagram for cnn.CNNModel:
Inheritance graph
Collaboration diagram for cnn.CNNModel:
Collaboration graph

Public Member Functions

 __init__ (self, int num_classes, int input_channels=3, float dropout_rate=0.3)
 
 forward (self, x)
 

Public Attributes

 conv1
 
 bn1
 
 conv2
 
 bn2
 
 conv3
 
 bn3
 
 pool
 
 fc1
 
 fc_bn
 
 fc2
 
 dropout
 

Protected Attributes

 _to_linear
 

Detailed Description

A simple CNN model for image classification with regularization to prevent overfitting.

Constructor & Destructor Documentation

◆ __init__()

cnn.CNNModel.__init__ (   self,
int  num_classes,
int   input_channels = 3,
float   dropout_rate = 0.3 
)
Initialize the CNN model.

Args:
    num_classes: Number of classes to classify
    input_channels: Number of input channels (1 for grayscale, 3 for RGB)
    dropout_rate: Dropout rate for regularization

Member Function Documentation

◆ forward()

cnn.CNNModel.forward (   self,
  x 
)
Forward pass through the network.

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

Member Data Documentation

◆ _to_linear

cnn.CNNModel._to_linear
protected

◆ bn1

cnn.CNNModel.bn1

◆ bn2

cnn.CNNModel.bn2

◆ bn3

cnn.CNNModel.bn3

◆ conv1

cnn.CNNModel.conv1

◆ conv2

cnn.CNNModel.conv2

◆ conv3

cnn.CNNModel.conv3

◆ dropout

cnn.CNNModel.dropout

◆ fc1

cnn.CNNModel.fc1

◆ fc2

cnn.CNNModel.fc2

◆ fc_bn

cnn.CNNModel.fc_bn

◆ pool

cnn.CNNModel.pool

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