reachsumit / deep-unet-for-satellite-image-segmentation

Satellite Imagery Feature Detection with SpaceNet dataset using deep UNet
308 stars 139 forks source link

How are CLASS_WEIGHTS assigned? #20

Open onimonipea opened 4 years ago

onimonipea commented 4 years ago

There is no description of how CLASS_WEIGHTS are created. I am attempting to use this on my own data, for segmentation, but I believe I am running into loss function issues because of incorrect class weights.

Krulvis commented 4 years ago

In unet_model.py the loss function is created as follows:

    def weighted_binary_crossentropy(y_true, y_pred):
        class_loglosses = K.mean(K.binary_crossentropy(y_true, y_pred), axis=[0, 1, 2])
        return K.sum(class_loglosses * K.constant(class_weights))