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

Hybrid model combining LSNet for image processing and EAML for text processing. More...

Inheritance diagram for hybrid.HybridModel:
Inheritance graph
Collaboration diagram for hybrid.HybridModel:
Collaboration graph

Public Member Functions

 __init__ (self, int num_classes, int vocab_size, int embedding_dim=100, int word_hidden_dim=50, int sent_hidden_dim=50, int image_channels=3, str lsnet_model_size='s', float dropout=0.5)
 Constructor for HybridModel.
 
 forward (self, images, docs)
 Forward pass through the hybrid model.
 

Public Attributes

 num_classes
 
 lsnet
 
 image_feature_dim
 
 embedding
 
 embedding_dropout
 
 word_gru
 
 word_gru_dropout
 
 word_attention
 
 sent_gru
 
 sent_gru_dropout
 
 sent_attention
 
 text_feature_dim
 
 fusion_layer
 
 classifier
 

Detailed Description

Hybrid model combining LSNet for image processing and EAML for text processing.

This class implements a hybrid architecture that combines the strengths of LSNet for image understanding and EAML for OCR text processing. It uses LSNet as the image encoder and EAML's text processing branch.

Hybrid model that combines LSNet for image processing and EAML for text processing.
This model leverages the strengths of both architectures to create a powerful
document classifier that uses both image and OCR text modalities.

Constructor & Destructor Documentation

◆ __init__()

hybrid.HybridModel.__init__ (   self,
int  num_classes,
int  vocab_size,
int   embedding_dim = 100,
int   word_hidden_dim = 50,
int   sent_hidden_dim = 50,
int   image_channels = 3,
str   lsnet_model_size = 's',
float   dropout = 0.5 
)

Constructor for HybridModel.

Parameters
num_classesNumber of document classes
vocab_sizeSize of the vocabulary for text embedding
embedding_dimDimension of the word embeddings
word_hidden_dimDimension of the word-level GRU hidden state
sent_hidden_dimDimension of the sentence-level GRU hidden state
image_channelsNumber of input image channels (typically 3 for RGB)
lsnet_model_sizeLSNet model size ('t', 's', or 'b')
dropoutDropout rate for regularization

Member Function Documentation

◆ forward()

hybrid.HybridModel.forward (   self,
  images,
  docs 
)

Forward pass through the hybrid model.

Parameters
imagesInput images tensor of shape (batch_size, channels, height, width)
docsInput text tensor of shape (batch_size, num_sentences, max_sent_length)
Returns
Output tensor of shape (batch_size, num_classes)

Member Data Documentation

◆ classifier

hybrid.HybridModel.classifier

◆ embedding

hybrid.HybridModel.embedding

◆ embedding_dropout

hybrid.HybridModel.embedding_dropout

◆ fusion_layer

hybrid.HybridModel.fusion_layer

◆ image_feature_dim

hybrid.HybridModel.image_feature_dim

◆ lsnet

hybrid.HybridModel.lsnet

◆ num_classes

hybrid.HybridModel.num_classes

◆ sent_attention

hybrid.HybridModel.sent_attention

◆ sent_gru

hybrid.HybridModel.sent_gru

◆ sent_gru_dropout

hybrid.HybridModel.sent_gru_dropout

◆ text_feature_dim

hybrid.HybridModel.text_feature_dim

◆ word_attention

hybrid.HybridModel.word_attention

◆ word_gru

hybrid.HybridModel.word_gru

◆ word_gru_dropout

hybrid.HybridModel.word_gru_dropout

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