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

Enhanced Multi-Level Attention Network for document classification. More...

Inheritance diagram for eaml.EAML:
Inheritance graph
Collaboration diagram for eaml.EAML:
Collaboration graph

Public Member Functions

 __init__ (self, vocab_size, embedding_dim, word_hidden_dim, sent_hidden_dim, image_channels, image_feature_dim, num_classes, dropout=0.5, use_ocr_text=False)
 Constructor for EAML class.
 
 forward (self, docs, images)
 Forward pass through the EAML network.
 

Public Attributes

 embedding_dim
 
 word_hidden_dim
 
 sent_hidden_dim
 
 image_feature_dim
 
 use_ocr_text
 
 embedding
 
 word_gru
 
 word_attention
 
 sent_gru
 
 sent_attention
 
 image_encoder
 
 fc
 
 dropout
 

Detailed Description

Enhanced Multi-Level Attention Network for document classification.

This class implements a multimodal document classifier that combines text and image features using attention mechanisms at multiple levels.

Enhanced Multi-Level Attention Network (EAML) for Document Classification
with Text and Image modalities.
Assumes text input is preprocessed into sentences and words, and embedded.
Assumes image input is preprocessed to a fixed size.

Constructor & Destructor Documentation

◆ __init__()

eaml.EAML.__init__ (   self,
  vocab_size,
  embedding_dim,
  word_hidden_dim,
  sent_hidden_dim,
  image_channels,
  image_feature_dim,
  num_classes,
  dropout = 0.5,
  use_ocr_text = False 
)

Constructor for EAML class.

Parameters
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
image_feature_dimDimension of the image feature vector
num_classesNumber of document classes
dropoutDropout rate for regularization
use_ocr_textWhether to use OCR text from the dataset

Member Function Documentation

◆ forward()

eaml.EAML.forward (   self,
  docs,
  images 
)

Forward pass through the EAML network.

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

Member Data Documentation

◆ dropout

eaml.EAML.dropout

◆ embedding

eaml.EAML.embedding

◆ embedding_dim

eaml.EAML.embedding_dim

◆ fc

eaml.EAML.fc

◆ image_encoder

eaml.EAML.image_encoder

◆ image_feature_dim

eaml.EAML.image_feature_dim

◆ sent_attention

eaml.EAML.sent_attention

◆ sent_gru

eaml.EAML.sent_gru

◆ sent_hidden_dim

eaml.EAML.sent_hidden_dim

◆ use_ocr_text

eaml.EAML.use_ocr_text

◆ word_attention

eaml.EAML.word_attention

◆ word_gru

eaml.EAML.word_gru

◆ word_hidden_dim

eaml.EAML.word_hidden_dim

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