Utils#
aitlas.utils.segmentation_losses module#
Loss functions for image segmentation
- class DiceLoss[source]#
Bases:
Module
Dice Loss for image segmentation. Expects sigmoided inputs and binary targets. ..note:: Implementation from: kaggle.com/bigironsphere/loss-function-library-keras-pytorch
aitlas.utils.utils module#
- get_class(class_name)[source]#
Returns the class type for a given class name. Expects a string of type module.submodule.Class
- parse_img_id(file_path, orients)[source]#
Parses direction, strip and coordinate components from a SpaceNet6 image filepath.
- load_voc_format_dataset(dir_path, csv_file_path)[source]#
Loads a dataset in the Pascal VOC format. It expects a multilabels.txt file and images in the root folder
- has_file_allowed_extension(file_path, extensions)[source]#
Checks if a file is an allowed extension.
- load_aitlas_format_dataset(file_path)[source]#
Reads the images from a CSV. Format: (image_path, class_name)
- save_best_model(model, model_directory, epoch, optimizer, loss, start, run_id)[source]#
Saves the model on disk :param model: model to save :type model: torch.nn.Module :param model_directory: directory where to save the model :type model_directory: str :param epoch: current epoch :type epoch: int :param optimizer: optimizer used for training :type optimizer: torch.optim.Optimizer :param loss: loss value :type loss: float :param start: start time :type start: float :param run_id: run id :type run_id: str