khdlr / HED-UNet

Simultaneous Semantic Segmentation and Edge Detection
MIT License
84 stars 4 forks source link

Does the edge detection task have an impact on the semantic segmentation task in this model? #16

Open fatfatfatmouse opened 1 year ago

fatfatfatmouse commented 1 year ago

Sorry to bother you again.

1.Are semantic segmentation task and edge detection task independent of each other? Or do they have mutual influence? My own thoughts: In auto_weight_bce loss, the value of loss.mean() is the combination of two tasks(if the output_channel == 2).

2.What does the “beta” in auto_weight_bce loss mean? My own thoughts: It seems to have changed the shape of the target tensor from (B,C,H,W) to (B,C,1,1). I guess it gave a weight to the two channels of each image in the batchsize.But I'm not sure why you're doing this? Can we make the sum of the weights of the two channels of each predicted image at different resolution levels equal to 1 by doing this?

khdlr commented 1 year ago
  1. They are in fact two independent loss terms. The auto_weight_bce loss function calculates both in parallel for efficiency.
  2. Beta is equivalent to the term $|Y+| / |Y+ \cup Y_-|$ from eq. 1 in the paper. The purpose of this term is to adaptively weight the loss contributions of both classes to be equal. This is done because the classes are very imbalanced, especially for the edge detection task.