hed
hed copied to clipboard
about the edge_lable
when the net get the edge_lable : edge[edge < 127.5] = 0.0 edge[edge >= 127.5] = 1.0
but i found that after filtering, most pixels become 0 like:
Will this affect the training?
thank you!
Thank you for your question! Yes, the hard threshold could lead to discrete edge pixels. However, I think it won't matter much for the training procedure, since in HED, the edge prediction is treated as a dense prediction task: Assume we have 100x100 label map, which contains 10000 pixels. Even if we mark all edge pixels correctly, they still have a limited quantity compared with background pixels (e.g. 100 edge pixels and 9900 background pixels). In HED, weighted cross-entropy is used to balance the edge pixels and background pixels (coefficient of edge pixels vs. background pixels in loss: 9900 vs. 100). Thus, if we have half of the edge pixels marked correctly (e.g. 50 pixels), then we will have 9950 background pixels. The 50 false negatives has a very small proportion of 9950 background pixels, which won't have much contribution to the negative loss in the weighted cross-entropy loss.
I remove the code edge[edge < 127.5] = 0.0 edge[edge >= 127.5] = 1.0 and let edge=edge/255 as the final gt to calculate loss is that ok?
I think it may work. You can compare the results before and after removing the code and see the change of performance.