delta.data.make_weights#

delta.data.make_weights(training_dataset_path, weights_function)[source]#

Create and populate the directory training_dataset_path/wei with the image weights for training.

The directory training_dataset_path should already contain “img” with the input images and “seg” with the segmentation masks (images with 0 for background pixels and 255 for cell pixels).

Parameters
training_dataset_pathstr or Path

Directory containing two directories: “img” for the images and “seg” for the segmentation masks. A third directory “wei” will be created inside for the weights.

weights_functionCallable[SegmentationMask, npt.NDArray[np.float32]],

Function that takes a segmentation mask (0 for background and 1 for cells) and returns a weight array (non-negative floats). The weights will be normalized by their maximum before being written down as images. Possible values are delta.data.seg_weights for mothermachine images, delta.data.seg_weights_2D for 2D pads, or custom functions or lambdas.