delta.data.estimate_classweights#

delta.data.estimate_classweights(gene, num_samples=30)[source]#

Estimate the class weights to use with the weighted categorical cross-entropy based on the train_generator_track output.

Parameters
genegenerator

Tracking U-Net training generator. (output of train_generator_seg/track)

num_samplesint, optional

Number of batches to use for estimation. The default is 30.

Returns
class_weightstuple of floats

Relative weights of each class. Note that, if 0 elements of a certain class are present in the samples, the weight for this class will be set to 0.