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

Loader class for Kaggle Invoices dataset. More...

Collaboration diagram for classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader:
Collaboration graph

Public Member Functions

 __init__ (self, MinioManager minio_manager, Augmentor augmentor, int seed=42, bool apply_ocr=False)
 Constructor for KaggleInvoicesLoader class.
 
pd.DataFrame load_dataset (self, int chunk_size=100, Optional[int] total_samples=None, bool apply_augmentation=True, int augmentation_factor=3)
 Loads and processes the Kaggle Invoices dataset.
 

Public Attributes

 minio_manager
 
 augmentor
 
 seed
 
 apply_ocr
 

Protected Member Functions

 _extract_invoice_id (self, text)
 Extracts invoice ID from text description.
 
 _load_pdf_as_image (self, directory, invoice_id)
 Loads a PDF file and converts it to an image.
 

Detailed Description

Loader class for Kaggle Invoices dataset.

This class provides methods for loading and processing invoice images from the Kaggle platform. It handles data downloading, PDF conversion, augmentation, and integration with MinIO storage for document classification tasks.

Constructor & Destructor Documentation

◆ __init__()

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader.__init__ (   self,
MinioManager  minio_manager,
Augmentor  augmentor,
int   seed = 42,
bool   apply_ocr = False 
)

Constructor for KaggleInvoicesLoader class.

Parameters
minio_managerMinIO manager instance for data storage
augmentorAugmentor instance for data augmentation
seedRandom seed for reproducibility

Member Function Documentation

◆ _extract_invoice_id()

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader._extract_invoice_id (   self,
  text 
)
protected

Extracts invoice ID from text description.

Parameters
textText description containing invoice ID
Returns
Invoice ID as integer or None if extraction fails
Extract invoice ID from text description

◆ _load_pdf_as_image()

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader._load_pdf_as_image (   self,
  directory,
  invoice_id 
)
protected

Loads a PDF file and converts it to an image.

Parameters
directoryDirectory containing PDF files
invoice_idID of the invoice to load
Returns
PIL Image or None if conversion fails
Load a PDF file and convert it to an image

◆ load_dataset()

pd.DataFrame classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader.load_dataset (   self,
int   chunk_size = 100,
Optional[int]   total_samples = None,
bool   apply_augmentation = True,
int   augmentation_factor = 3 
)

Loads and processes the Kaggle Invoices dataset.

Parameters
chunk_sizeNumber of samples to process in each chunk
total_samplesTotal number of samples to load (None for all)
apply_augmentationWhether to apply data augmentation
augmentation_factorNumber of augmented versions to create per image
Returns
DataFrame containing processed dataset

Member Data Documentation

◆ apply_ocr

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader.apply_ocr

◆ augmentor

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader.augmentor

◆ minio_manager

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader.minio_manager

◆ seed

classification.datasets.loader_kaggle_invoices.KaggleInvoicesLoader.seed

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