Functions | |
| create_dataloaders (test_df, model_name, batch_size=64, num_workers=4, prefetch_factor=2, image_transform=None, tokenizer=None, text_params=None, pin_memory=True) | |
| evaluate_model (model, test_loader, model_name, device, output_dir="evaluation_results") | |
| parse_args () | |
| load_config (config_path) | |
| main (args) | |
Variables | |
| logger = get_standard_logger("evaluate") | |
| dict | models |
| dict | model_classes |
| args = parse_args() | |
| evaluate.create_dataloaders | ( | test_df, | |
| model_name, | |||
batch_size = 64, |
|||
num_workers = 4, |
|||
prefetch_factor = 2, |
|||
image_transform = None, |
|||
tokenizer = None, |
|||
text_params = None, |
|||
pin_memory = True |
|||
| ) |
Create optimized PyTorch DataLoaders from DataFrames for evaluation
Args:
test_df: Test DataFrame with 'image' and 'label' columns
model_name: Name of the model to create DataLoaders for
batch_size: Batch size for DataLoader
num_workers: Number of worker processes for data loading
prefetch_factor: Number of batches loaded in advance by each worker
image_transform: Image transformations to apply
tokenizer: Tokenizer instance for text processing (if needed)
text_params: Dictionary of text parameters (e.g., max_sentences, max_sent_length)
pin_memory: Whether to pin memory for faster GPU access
Returns:
test_loader: DataLoader for test dataset
| evaluate.evaluate_model | ( | model, | |
| test_loader, | |||
| model_name, | |||
| device, | |||
output_dir = "evaluation_results" |
|||
| ) |
Evaluate a model on the test set and generate performance metrics and reports
Args:
model: PyTorch model to evaluate
test_loader: DataLoader for test dataset
model_name: Name of the model being evaluated
device: Device to run evaluation on (cuda/cpu)
output_dir: Directory to save evaluation results
Returns:
dict: Dictionary containing evaluation metrics
| evaluate.load_config | ( | config_path | ) |
Load and parse a YAML configuration file
Args:
config_path: Path to the configuration file
Returns:
Dictionary containing the configuration
| evaluate.main | ( | args | ) |
Main execution function
Args:
args: Command-line arguments
| evaluate.parse_args | ( | ) |
Parse command-line arguments
Returns:
ArgumentParser object with parsed arguments
| evaluate.args = parse_args() |
| evaluate.logger = get_standard_logger("evaluate") |
| dict evaluate.model_classes |
| dict evaluate.models |