palletdatagenerator.utils moduleο
Utility functions for PalletDataGenerator.
- palletdatagenerator.utils.setup_logging(level: str = 'DEBUG', log_file: str = 'output.log') None [source]ο
Setup logging configuration.
- Parameters:
level β Logging level (βDEBUGβ, βINFOβ, βWARNINGβ, βERRORβ)
log_file β Optional log file path
- palletdatagenerator.utils.ensure_directory(path: str) Path [source]ο
Ensure directory exists, create if necessary.
- Parameters:
path β Directory path to create
- Returns:
Path object for the directory
- palletdatagenerator.utils.load_config(config_path: str) dict[str, Any] [source]ο
Load configuration from JSON or YAML file.
- Parameters:
config_path β Path to configuration file
- Returns:
Configuration dictionary
- Raises:
FileNotFoundError β If config file doesnβt exist
ValueError β If config file format is invalid
- palletdatagenerator.utils.save_config(config: dict[str, Any], config_path: str) None [source]ο
Save configuration to JSON file.
- Parameters:
config β Configuration dictionary to save
config_path β Path to save configuration file
- palletdatagenerator.utils.set_random_seed(seed: int) None [source]ο
Set random seed for reproducible results.
- Parameters:
seed β Random seed value
- palletdatagenerator.utils.validate_blender_environment() bool [source]ο
Validate that Blender environment is available and properly configured.
- Returns:
True if Blender environment is valid, False otherwise
- palletdatagenerator.utils.get_blender_version() tuple[int, int, int] | None [source]ο
Get Blender version information.
- Returns:
Tuple of (major, minor, patch) version numbers or None if not available
- palletdatagenerator.utils.format_file_size(size_bytes: int) str [source]ο
Format file size in human-readable format.
- Parameters:
size_bytes β Size in bytes
- Returns:
Formatted size string (e.g., β1.5 MBβ)
- palletdatagenerator.utils.get_system_info() dict[str, Any] [source]ο
Get system information for debugging and logging.
- Returns:
Dictionary with system information
- palletdatagenerator.utils.create_dataset_manifest(dataset_info: dict[str, Any], output_path: str) None [source]ο
Create a comprehensive dataset manifest file.
- Parameters:
dataset_info β Dictionary containing dataset information
output_path β Path to save the manifest file
- palletdatagenerator.utils.verify_dataset_integrity(dataset_dir: str) dict[str, Any] [source]ο
Verify dataset integrity by checking file consistency.
- Parameters:
dataset_dir β Path to dataset directory
- Returns:
Dictionary with verification results
- class palletdatagenerator.utils.ProgressTracker(total: int, description: str = 'Processing')[source]ο
Bases:
object
Progress tracking utility for long-running operations.
- __init__(total: int, description: str = 'Processing')[source]ο
Initialize progress tracker.
- Parameters:
total β Total number of items to process
description β Description of the operation