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


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. | |
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.
| 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.
| num_classes | Number of document classes |
| vocab_size | Size of the vocabulary for text embedding |
| embedding_dim | Dimension of the word embeddings |
| word_hidden_dim | Dimension of the word-level GRU hidden state |
| sent_hidden_dim | Dimension of the sentence-level GRU hidden state |
| image_channels | Number of input image channels (typically 3 for RGB) |
| lsnet_model_size | LSNet model size ('t', 's', or 'b') |
| dropout | Dropout rate for regularization |
| hybrid.HybridModel.forward | ( | self, | |
| images, | |||
| docs | |||
| ) |
Forward pass through the hybrid model.
| images | Input images tensor of shape (batch_size, channels, height, width) |
| docs | Input text tensor of shape (batch_size, num_sentences, max_sent_length) |
| hybrid.HybridModel.classifier |
| hybrid.HybridModel.embedding |
| hybrid.HybridModel.embedding_dropout |
| hybrid.HybridModel.fusion_layer |
| hybrid.HybridModel.image_feature_dim |
| hybrid.HybridModel.lsnet |
| hybrid.HybridModel.num_classes |
| hybrid.HybridModel.sent_attention |
| hybrid.HybridModel.sent_gru |
| hybrid.HybridModel.sent_gru_dropout |
| hybrid.HybridModel.text_feature_dim |
| hybrid.HybridModel.word_attention |
| hybrid.HybridModel.word_gru |
| hybrid.HybridModel.word_gru_dropout |