kelp.utils
GPU
The GPU utilities.
kelp.utils.gpu.set_gpu_power_limit_if_needed
Helper function, that sets GPU power limit if RTX 3090 is used
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pw |
int
|
The new power limit to set. Defaults to 250W. |
250
|
Source code in kelp/utils/gpu.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Logging
The logging utilities.
kelp.utils.logging.get_logger
Builds a Logger
instance with provided name and log level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name for the logger. |
required |
log_level |
Union[int, str]
|
The default log level. |
INFO
|
Returns:
Type | Description |
---|---|
Logger
|
The logger. |
Source code in kelp/utils/logging.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
kelp.utils.logging.timed
This decorator prints the execution time for the decorated function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
Callable[P, T]
|
The function to wrap. |
required |
Returns:
Type | Description |
---|---|
Callable[P, T]
|
Wrapper around the function. |
Source code in kelp/utils/logging.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
MLFlow
The MLFlow utilities.
kelp.utils.mlflow.get_mlflow_run_dir
Gets MLFlow run directory given the active run and output directory. Args: current_run: The current active run. output_dir: The output directory.
Returns: A path to the MLFlow run directory.
Source code in kelp/utils/mlflow.py
8 9 10 11 12 13 14 15 16 17 18 |
|
Plotting
The sample plotting utilities.
kelp.utils.plotting.plot_sample
Plot a single sample of the satellite image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_arr |
ndarray
|
The input image array. Expects all image bands to be provided. |
required |
target_arr |
Optional[ndarray]
|
An optional kelp mask array. |
None
|
predictions_arr |
Optional[ndarray]
|
An optional kelp prediction array. |
None
|
figsize |
Tuple[int, int]
|
The figure size. |
(20, 4)
|
ndvi_cmap |
str
|
The colormap to use for the NDVI. |
'RdYlGn'
|
dem_cmap |
str
|
The colormap to use for the DEM band. |
'viridis'
|
qa_mask_cmap |
str
|
The colormap to use for the QA band. |
'gray'
|
mask_cmap |
str
|
The colormap to use for the kelp mask. |
CMAP
|
show_titles |
bool
|
A flag indicating whether the titles should be visible. |
True
|
suptitle |
Optional[str]
|
The title for the figure. |
None
|
Source code in kelp/utils/plotting.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
Serialization
The serialization utils.
kelp.utils.serialization.JsonEncoder
Bases: JSONEncoder
Custom JSON encoder that handles datatypes that are not out-of-the-box supported by the json
package.
Source code in kelp/utils/serialization.py
13 14 15 16 17 18 19 20 21 22 23 24 25 |
|