Utilities Module¶
This module provides utility functions for the semantic segmentation pipeline.
It includes functions for analyzing segmentation maps, generating statistics, handling file operations, and setting up logging. These utilities are used throughout the segmentation pipeline to support various processing tasks.
get_segmentation_data_batch
¶
Get a batch of segmentation data from the HDF5 file.
| PARAMETER | DESCRIPTION |
|---|---|
segmentation_data |
TYPE:
|
start |
Start index of the batch.
TYPE:
|
end |
End index of the batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ndarray
|
np.ndarray: A batch of segmentation data. |
Source code in cityseg/utils.py
setup_logging
¶
Set up logging configuration for the application.
This function configures console and file logging with appropriate log levels and formats.
| PARAMETER | DESCRIPTION |
|---|---|
log_level |
The log level for file logging (e.g., "INFO", "DEBUG").
TYPE:
|
verbose |
If True, set console logging to DEBUG level.
TYPE:
|
Source code in cityseg/utils.py
tqdm_context
¶
A context manager for tqdm progress bars.
This context manager ensures that the tqdm progress bar is properly initialized and closed, even if an exception occurs.
| PARAMETER | DESCRIPTION |
|---|---|
*args |
Positional arguments to pass to tqdm.
TYPE:
|
**kwargs |
Keyword arguments to pass to tqdm.
TYPE:
|
| YIELDS | DESCRIPTION |
|---|---|
tqdm
|
The tqdm progress bar object.
TYPE::
|